From 881782de9909e31cbcf61f01c45baf3fce54155e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dongdonglin=28=E6=9E=97=E5=90=91=E4=B8=9C=29?= Date: Wed, 17 Oct 2018 17:36:46 +0800 Subject: [PATCH] fix(dao): add time --- app/dao/time_series_detector/anomaly_op.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/dao/time_series_detector/anomaly_op.py b/app/dao/time_series_detector/anomaly_op.py index 3bb4e5f..8cc658d 100644 --- a/app/dao/time_series_detector/anomaly_op.py +++ b/app/dao/time_series_detector/anomaly_op.py @@ -114,8 +114,7 @@ class AbnormalOperation(object): def insert_anomaly(self, data): insert_str = "INSERT INTO anomaly(view_id, view_name, attr_name, attr_id, time, data_c, data_b, data_a) values(%s, %s, %s, %s, %s, %s, %s, %s);" - time_str = datetime.datetime.fromtimestamp(int(time.time())).strftime("%Y-%m-%d %H:%M:%S") - params = [data['view_id'], data['view_name'].encode('utf8'), data['attr_name'].encode('utf8'), data['attr_id'], time_str, data['data_c'], data['data_b'], data['data_a']] + params = [data['view_id'], data['view_name'].encode('utf8'), data['attr_name'].encode('utf8'), data['attr_id'], data['time'], data['data_c'], data['data_b'], data['data_a']] record_num = self.__cur.execute(insert_str, params) self.__conn.commit() return OP_SUCCESS, record_num