|
@@ -25,6 +25,8 @@ class FwhDataRecycle:
|
|
|
|
|
|
STAT_PERIOD = 2 * 24 * 3600
|
|
|
|
|
|
+ ARTICLE_ILLEGAL_CODE = 25012
|
|
|
+
|
|
|
def __init__(self):
|
|
|
self.denet_client = DatabaseConnector(denet_config)
|
|
|
self.denet_client.connect()
|
|
@@ -56,6 +58,26 @@ class FwhDataRecycle:
|
|
|
account_name = fetch_response[0]["account_name"] if fetch_response else None
|
|
|
return account_name
|
|
|
|
|
|
+ def illegal_article_bot(
|
|
|
+ self,
|
|
|
+ account_name:str,
|
|
|
+ gh_id:str,
|
|
|
+ group_id: str,
|
|
|
+ illegal_msg: str,
|
|
|
+ publish_date: str,
|
|
|
+ ):
|
|
|
+ self.feishu_robot.bot(
|
|
|
+ title="服务号文章违规告警,请前往微信公众平台处理",
|
|
|
+ detail={
|
|
|
+ "account_name": account_name,
|
|
|
+ "gh_id": gh_id,
|
|
|
+ "group_id": group_id,
|
|
|
+ "illegal_msg": illegal_msg,
|
|
|
+ "publish_date": str(publish_date)
|
|
|
+ },
|
|
|
+ env="server_account_publish_monitor"
|
|
|
+ )
|
|
|
+
|
|
|
|
|
|
class FwhGroupPublishRecordManager(FwhDataRecycle):
|
|
|
|
|
@@ -240,12 +262,23 @@ class SaveFwhDataToDatabase(FwhDataRecycle):
|
|
|
gh_id = article["gh_id"]
|
|
|
user_group_id = article["user_group_id"]
|
|
|
url = article["url"]
|
|
|
+ publish_date = article["publish_date"]
|
|
|
# get article detail info with spider
|
|
|
|
|
|
try:
|
|
|
article_detail_info = get_article_detail(
|
|
|
url, is_count=True, is_cache=False
|
|
|
)
|
|
|
+ response_code = article_detail_info["code"]
|
|
|
+ if response_code == self.ARTICLE_ILLEGAL_CODE:
|
|
|
+ self.illegal_article_bot(
|
|
|
+ account_name=account_name,
|
|
|
+ gh_id=gh_id,
|
|
|
+ group_id=user_group_id,
|
|
|
+ illegal_msg=article_detail_info["msg"],
|
|
|
+ publish_date=publish_date,
|
|
|
+ )
|
|
|
+
|
|
|
time.sleep(1)
|
|
|
content_url = article_detail_info["data"]["data"]["content_link"]
|
|
|
app_msg_id = content_url.split("mid=")[-1].split("&")[0]
|