|
@@ -583,34 +583,71 @@ class AutoReplyCardsMonitor(AutoReplyCardsMonitorConst):
|
|
|
continue
|
|
continue
|
|
|
|
|
|
|
|
account_detail = fetch_response[0]
|
|
account_detail = fetch_response[0]
|
|
|
- status = account_detail.get("status")
|
|
|
|
|
- if not status:
|
|
|
|
|
|
|
+ gh_id = account_detail.get("gh_id")
|
|
|
|
|
+ if not gh_id:
|
|
|
|
|
+ await self.log_service.log(
|
|
|
|
|
+ contents={
|
|
|
|
|
+ "task": "auto_reply_cards_monitor",
|
|
|
|
|
+ "function": "follow_gzh_task",
|
|
|
|
|
+ "status": "fail",
|
|
|
|
|
+ "message": f"账号缺少 gh_id: {account_name}",
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
|
|
+ continue
|
|
|
|
|
+
|
|
|
|
|
+ # 调用 blogger 接口检查账号实时状态(违规/迁移)
|
|
|
|
|
+ blogger_response = await get_article_list_from_account(
|
|
|
|
|
+ gh_id, is_cache=False
|
|
|
|
|
+ )
|
|
|
|
|
+ if not blogger_response:
|
|
|
await self.log_service.log(
|
|
await self.log_service.log(
|
|
|
contents={
|
|
contents={
|
|
|
"task": "auto_reply_cards_monitor",
|
|
"task": "auto_reply_cards_monitor",
|
|
|
"function": "follow_gzh_task",
|
|
"function": "follow_gzh_task",
|
|
|
"status": "warn",
|
|
"status": "warn",
|
|
|
- "message": f"账号已经迁移或者封禁: {account_name}",
|
|
|
|
|
|
|
+ "message": f"blogger 接口无响应, 跳过: {account_name}, gh_id={gh_id}",
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
continue
|
|
continue
|
|
|
|
|
|
|
|
- gh_id = account_detail.get("gh_id")
|
|
|
|
|
- if not gh_id:
|
|
|
|
|
|
|
+ blogger_code = blogger_response.get("code")
|
|
|
|
|
+ if blogger_code != 0:
|
|
|
|
|
+ blogger_msg = blogger_response.get("msg", "")
|
|
|
|
|
+ if blogger_code == 25013:
|
|
|
|
|
+ alert_title = f"自动回复卡片-账号违规: {account_name}"
|
|
|
|
|
+ else:
|
|
|
|
|
+ alert_title = f"自动回复卡片-账号异常(可能已迁移): {account_name}"
|
|
|
|
|
+
|
|
|
|
|
+ await self.mapper.set_account_as_invalid(gh_id)
|
|
|
|
|
+ try:
|
|
|
|
|
+ await feishu_robot.bot(
|
|
|
|
|
+ title=alert_title,
|
|
|
|
|
+ detail={
|
|
|
|
|
+ "account_name": account_name,
|
|
|
|
|
+ "gh_id": gh_id,
|
|
|
|
|
+ "code": blogger_code,
|
|
|
|
|
+ "msg": blogger_msg,
|
|
|
|
|
+ },
|
|
|
|
|
+ mention=True,
|
|
|
|
|
+ env="long_articles_task",
|
|
|
|
|
+ )
|
|
|
|
|
+ except Exception:
|
|
|
|
|
+ pass
|
|
|
|
|
+
|
|
|
await self.log_service.log(
|
|
await self.log_service.log(
|
|
|
contents={
|
|
contents={
|
|
|
"task": "auto_reply_cards_monitor",
|
|
"task": "auto_reply_cards_monitor",
|
|
|
"function": "follow_gzh_task",
|
|
"function": "follow_gzh_task",
|
|
|
- "status": "fail",
|
|
|
|
|
- "message": f"账号缺少 gh_id: {account_name}",
|
|
|
|
|
|
|
+ "status": "warn",
|
|
|
|
|
+ "message": f"账号状态异常, 已标记无效并跳过: {account_name}, gh_id={gh_id}, code={blogger_code}, msg={blogger_msg}",
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
continue
|
|
continue
|
|
|
|
|
|
|
|
- # print(gh_id, account_name, uv, priority)
|
|
|
|
|
- await self.create_auto_reply_single_account_task(
|
|
|
|
|
- gh_id, account_name, priority
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ print(gh_id, account_name, priority)
|
|
|
|
|
+ # await self.create_auto_reply_single_account_task(
|
|
|
|
|
+ # gh_id, account_name, priority
|
|
|
|
|
+ # )
|
|
|
|
|
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
|
await self.log_service.log(
|
|
await self.log_service.log(
|