feat: 更新fight_record_status方法以支持报告ID、报告时间和后续状态
This commit is contained in:
parent
93d32e89f5
commit
da353920ae
11
DB.py
11
DB.py
@ -329,19 +329,24 @@ class DBVidcon:
|
||||
return self.cursor.fetchall()
|
||||
|
||||
@mysql_retry()
|
||||
def update_fight_record_status(self, record_id: int, new_status: int, errinfo: str = ""):
|
||||
def update_fight_record_status(self, id: int, report_id: int, new_status: int, errinfo: str = "",
|
||||
report_time: int = 0,
|
||||
subsequent_status: int = 1, ):
|
||||
sql = """
|
||||
UPDATE
|
||||
sh_dm_fight_records
|
||||
SET
|
||||
status = %s,
|
||||
errinfo = %s,
|
||||
updata_time = %s
|
||||
updata_time = %s,
|
||||
report_id = %s,
|
||||
subsequent_status = %s,
|
||||
report_time= %s
|
||||
WHERE
|
||||
id = %s
|
||||
"""
|
||||
now_ts = int(time.time())
|
||||
self.cursor.execute(sql, (new_status, errinfo, now_ts, record_id))
|
||||
self.cursor.execute(sql, (new_status, errinfo, now_ts, report_id, subsequent_status, report_time, id))
|
||||
|
||||
@mysql_retry()
|
||||
def update_video_ts_status(self):
|
||||
|
10
report.py
10
report.py
@ -7,6 +7,11 @@ import logger
|
||||
db = DBVidcon()
|
||||
d = DailymotionClient()
|
||||
|
||||
k = {
|
||||
"open":1,
|
||||
"solved":2,
|
||||
"awaiting your reply":3,
|
||||
}
|
||||
while True:
|
||||
lis = db.get_report_video()
|
||||
if len(lis) == 0:
|
||||
@ -15,8 +20,9 @@ while True:
|
||||
for li in lis:
|
||||
logger.logger.info(f"name:{li['name_title']},link:{li['link']} ")
|
||||
try:
|
||||
info = d.process_ticket(li['name_title'], li['link'])
|
||||
db.update_fight_record_status(li['id'], 2, f"http://123.58.197.91:5000/image/{info}")
|
||||
info,report_id,status,report_ts, = d.process_ticket(li['name_title'], li['link'])
|
||||
subsequent_status = k.get(status, 1)
|
||||
db.update_fight_record_status(li['id'],report_id, 2, f"http://123.58.197.91:5000/image/{info}", report_ts, subsequent_status)
|
||||
db.flush()
|
||||
time.sleep(5 * 60)
|
||||
except Exception as e:
|
||||
|
@ -100,7 +100,7 @@ class DailymotionClient:
|
||||
self._pw = sync_playwright().start()
|
||||
self.browser: Browser = self._pw.chromium.launch(
|
||||
headless=self.headless,
|
||||
proxy={'server':'http://127.0.0.1:7890'}
|
||||
proxy={'server': 'http://127.0.0.1:7890'}
|
||||
)
|
||||
self.context = self.browser.new_context(
|
||||
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
||||
@ -264,7 +264,7 @@ class DailymotionClient:
|
||||
if self.page.url != self.url:
|
||||
self.page.goto(self.url, timeout=30000)
|
||||
|
||||
return file_path
|
||||
return file_path, report_id, subsequent_status, timestamp
|
||||
|
||||
def close(self):
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user