callon.py 1.0 KB

12345678910111213141516171819
  1. from .flightDB import flightDB
  2. from unitls.LogerinTxt import app_logger
  3. import datetime
  4. def callon(fdb:flightDB,phonenum):
  5. try:
  6. now = datetime.datetime.now()
  7. now1=datetime.datetime.now()- datetime.timedelta(seconds=5)
  8. if phonenum !="" and phonenum !=None:
  9. calllist = fdb.sort_queryTable2("航班编号", "Calllist", "电话 ='%s' and 接通时间 =''"%phonenum, "拨号次数", "ASC", "创建时间", "ASC")
  10. if len(calllist) != 0:
  11. lasttime = fdb.sort_queryTable("接通时间", "Calllist", "接通时间 !='' and 接通时间 not like '%人工%'", "接通时间", "desc")
  12. #print("lasttime", lasttime[0][0])
  13. if len(lasttime) == 0 or(len(lasttime) != 0 and now1 > datetime.datetime.strptime(lasttime[0][0][:19],"%Y-%m-%d %H:%M:%S")):
  14. newdic = {"接通时间": "'%s'" % now}
  15. fdb.upDateItem("Calllist", newdic, "航班编号='%s'" % calllist[0][0])
  16. except Exception as e:
  17. app_logger.log_error(e)