Browse Source

更新字段类型

lijunliang 1 năm trước cách đây
mục cha
commit
ae6ed86cd6
4 tập tin đã thay đổi với 15 bổ sung18 xóa
  1. 1 1
      apps/models.py
  2. 1 1
      apps/normal_field.py
  3. 10 9
      apps/send_email.py
  4. 3 7
      callServer.py

+ 1 - 1
apps/models.py

@@ -157,7 +157,7 @@ class CallRecords(db.Model):
     RingingTime = db.Column(db.DateTime(), comment="响铃时间")  # 开始呼叫时间
     Begin = db.Column(db.DateTime(), comment="摘机接通时间")  # 摘机接通时间
     End = db.Column(db.DateTime(), comment="通话结束时间")
-    CallTimeLength = db.Column(db.String(20), comment="通话时长(单元:秒)")
+    CallTimeLength = db.Column(db.Integer(), comment="通话时长(单元:秒)")
     QueueTime = db.Column(db.DateTime(), comment="呼入来电进入技能组时间")
     Queue = db.Column(db.String(100), comment="呼入来电进入的技能组")
     QueueId = db.Column(db.String(30), comment="呼入来电进入的技能组号")

+ 1 - 1
apps/normal_field.py

@@ -36,6 +36,6 @@ if __name__ == '__main__':
             'job': '', 'regtime': "2022-04-02 10:47:42", 'lastUpdateTime': "None",
             'status999': 'status6'}
     body = repair_time(body, "regtime")
-    body = repair_int(body, "lastUpdateTime")
+    body = repair_int(body, "unique_id")
     print(body)
 

+ 10 - 9
apps/send_email.py

@@ -5,13 +5,14 @@ from loguru import logger
 
 
 def sendMail(content: str):
-    content = content + '<br>' + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-    api_url = 'http://172.17.145.179:19281/_send/_mail'
-    api_parm = {
-        'to': "yaojingge@topnet.net.cn",
-        'title': '客户数据同步异常',
-        'body': content,
-    }
-    response = requests.get(api_url, api_parm)
-    logger.info('邮件发送 ' + response.text)
+    # content = content + '<br>' + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
+    # api_url = 'http://172.17.145.179:19281/_send/_mail'
+    # api_parm = {
+    #     'to': "yaojingge@topnet.net.cn",
+    #     'title': '客户数据同步异常',
+    #     'body': content,
+    # }
+    # response = requests.get(api_url, api_parm)
+    # logger.info('邮件发送 ' + response.text)
+    print(content)
 

+ 3 - 7
callServer.py

@@ -125,7 +125,6 @@ def tell():
         # 查询
         exists_body = Customer.query.filter(Customer.unique_id == unique_id).first()
         if not exists_body:
-            body["createTime"] = body["lastUpdateTime"]
             state = insert_body(body)
             body["logCreateTime"] = body["lastUpdateTime"]
             body["updateStatus"] = 1 if state else 0
@@ -155,14 +154,10 @@ def tell():
         return "200"
 
 
-@app.route('/', methods=['POST'])
-def tell():
-    pass
-
 
 @app.route('/voice', methods=['GET'])
 def voice_sync():
-    time_dict = {"Ring": "time", "RingingTime": "time", "Begin": "time", 'End': "time", 'QueueTime': "time"}
+    time_dict = {"Ring": "time", "RingingTime": "time", "Begin": "time", 'End': "time", 'QueueTime': "time","CallTimeLength":"int"}
     if request.method == 'GET':
         body = dict(request.args)
         is_real = verify_code(body)
@@ -184,7 +179,8 @@ def voice_sync():
         setattr(call, "createTime", this_time)
         for attr_key, value in body.items():
             if attr_key in CallRecords.__dict__:
-                value = value.strip()
+                if attr_key !="CallTimeLength":
+                    value = value.strip()
                 setattr(call, attr_key, value)
         state = insert2db(call, f"语音同步失败-->{call_sheet_id}")
         if not state: