mandealAllLogs.py 1.2 KB

12345678910111213141516171819202122232425
  1. from .flightDB import flightDB
  2. import datetime
  3. from unitls.LogerinTxt import app_logger
  4. def mandealAllLogs(database:flightDB,name:str,mode):
  5. try:
  6. if mode =="norm":
  7. now=datetime.datetime.now()
  8. clear=database.queryTabel('logs',"编号","警告信息 !='' and 处理时间 ='' and 变更字段 !='人工待办' and 变更字段 !='准备组任务' ")
  9. newdic = {"处理人": "'%s'" % name, "处理时间": "'%s'" % now,"信息状态":"'人工一键处理'"}
  10. if len(clear) != 0:
  11. for i in clear:
  12. database.lazyUpdateItem('logs',newdic,"编号='%s'"%i[0])
  13. elif mode == "super":
  14. now = datetime.datetime.now()
  15. clear = database.queryTabel('logs', "编号", "警告信息 !='' and 处理时间 ='' and 变更字段 !='人工待办'")
  16. newdic = {"处理人": "'%s'" % name, "处理时间": "'%s'" % now, "信息状态": "'人工一键处理'"}
  17. if len(clear) != 0:
  18. for i in clear:
  19. database.lazyUpdateItem('logs', newdic, "编号='%s'" % i[0])
  20. database.FunctionCommit()
  21. except Exception as e:
  22. app_logger.log_error(e)
  23. database.FunctionCommit()