增加更新时间

master
Jing Li 2023-09-07 21:42:51 +08:00
parent 04a4e9f156
commit 39c73fa3f2
1 changed files with 2 additions and 1 deletions

View File

@ -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():