calledChecked.py 1.2 KB

1234567891011121314151617181920
  1. from .flightDB import flightDB
  2. import datetime
  3. from unitls.LogerinTxt import app_logger
  4. def calledChecked(fdb: flightDB):
  5. try:
  6. now=datetime.datetime.now()
  7. now_5 = now - datetime.timedelta(minutes=8)
  8. callist = fdb.queryTabel("Calllist", "*", "接通时间 ='' and (创建时间<'%s' or CAST(拨号次数 AS integer)>3)"%now_5)
  9. if len(callist) != 0:
  10. for i in callist:
  11. if len(fdb.queryTabel("logs", "航班编号", "航班编号 ='%s' and 处理时间=''"%i[0])) == 0:
  12. newdic = {"航班编号": "%s" %i[0], "警告信息": "%s %s超过自动联系超过8min或连续拨号超过3次无响应,请人工处理!!"%(i[4],i[3]), "信息状态": "", "提示信息": "",
  13. "产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "无法联系", "显示对象": "", "提示内容": ""}
  14. fdb.lazyInsertData('logs', newdic)
  15. newdic1={"接通时间":"'%s推送人工处理'"%now}
  16. fdb.lazyUpdateItem("Calllist",newdic1,"航班编号='%s'"%i[0])
  17. fdb.FunctionCommit()
  18. except Exception as e:
  19. fdb.FunctionCommit()
  20. app_logger.log_error(e)