Browse Source

feat(run): 恢复紧急任务判断逻辑并移除调试代码

恢复了对紧急任务数量的判断逻辑,当任务状态无效时会检查是否存在紧急任务,
若无紧急任务则直接返回。同时移除了多余的调试注释代码,保持逻辑清晰。
master
zzx 1 month ago
parent
commit
b05b88937d
  1. 35
      run.py

35
run.py

@ -71,41 +71,16 @@ def get_spider(platform_id, prompt, brand, browser) -> None | DeepseekSpider | T
async def ai_seo_job(browser, platform_ids, time_range, job_id, type_name, run_id): async def ai_seo_job(browser, platform_ids, time_range, job_id, type_name, run_id):
status, date = calc_task_date(time_range) status, date = calc_task_date(time_range)
# if not status:
# # 是否有紧急任务
# task_result = await AiSeoApis.get_urgent_task_count()
# if task_result['count'] <= 0:
# return
if not status:
# 是否有紧急任务
task_result = await AiSeoApis.get_urgent_task_count()
if task_result['count'] <= 0:
return
current_job = scheduler.get_job(job_id) current_job = scheduler.get_job(job_id)
# current_job.pause() # current_job.pause()
platform_str = ','.join(platform_ids) platform_str = ','.join(platform_ids)
# 获取任务信息 # 获取任务信息
task_data = await AiSeoApis.get_one_task(date=date, platform_ids=platform_str) task_data = await AiSeoApis.get_one_task(date=date, platform_ids=platform_str)
# task_data = {
# "id": "778877538494716115",
# "project_id": "778865951931242406",
# "keyword_id": "778865954200359933",
# "keyword": "考研班哪个机构好",
# "brand": "高顿教育",
# "platform_id": "13",
# "gather_date": "2025-06-26",
# "gather_time": "00:00",
# "gather_filter": "2025-06-26 00:00:00",
# "status": 2,
# "retry_count": 0,
# "screen_flag": 2,
# "thinking": 1,
# "is_deal": 1,
# "screen_url": "",
# "priority": 999,
# "start_time": "null",
# "end_time": "null",
# "create_time": "2025-06-26 15:09:24",
# "update_time": "2025-06-26 18:19:55",
# "delete_time": 0,
# "create_by": "777786292267261539",
# "update_by": "777786292267261539"
# }
if not task_data: if not task_data:
logger.info(f'[{type_name}]未获取到任务信息') logger.info(f'[{type_name}]未获取到任务信息')
# current_job.resume() # current_job.resume()

Loading…
Cancel
Save