增加更新时间
parent
04a4e9f156
commit
39c73fa3f2
|
|
@ -5,6 +5,7 @@ import logging
|
||||||
import pymysql
|
import pymysql
|
||||||
import threading
|
import threading
|
||||||
import json
|
import json
|
||||||
|
import datetime
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
class Camera:
|
class Camera:
|
||||||
|
|
@ -31,7 +32,7 @@ class Camera:
|
||||||
|
|
||||||
with conn:
|
with conn:
|
||||||
with conn.cursor() as cursor:
|
with conn.cursor() as cursor:
|
||||||
cursor.execute("update devices set state = %s where id = %s", (status, self.id))
|
cursor.execute("update devices set state = %s, updated_at = %s where id = %s", (status, datetime.datetime.now(), self.id))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
def init_logger():
|
def init_logger():
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue