|
@@ -23,31 +23,26 @@ CREATE TABLE `publish_content_miniprogram` (
|
|
|
"""
|
|
|
import json
|
|
|
|
|
|
-import pymysql
|
|
|
-from functions import RateDetail
|
|
|
+import pandas as pd
|
|
|
+from datetime import datetime
|
|
|
+from functions import RateDetail, MatchRate
|
|
|
|
|
|
-
|
|
|
-def table_structure():
|
|
|
- """
|
|
|
- sensitive words
|
|
|
- :return:
|
|
|
- """
|
|
|
- connection = pymysql.connect(
|
|
|
- host="rm-t4na9qj85v7790tf84o.mysql.singapore.rds.aliyuncs.com", # 数据库IP地址,内网地址
|
|
|
- port=3306, # 端口号
|
|
|
- user="crawler_readonly", # mysql用户名
|
|
|
- passwd="cyber#crawler_2023", # mysql用户登录密码
|
|
|
- db="aigc-admin-prod", # 数据库名
|
|
|
- charset="utf8mb4" # 如果数据库里面的文本是utf8编码的,charset指定是utf8
|
|
|
- )
|
|
|
- sql = "select status, trace_id, error_msg from publish_content_miniprogram where create_timestamp > 1716739200000;"
|
|
|
- cursor = connection.cursor()
|
|
|
- cursor.execute(sql)
|
|
|
- data = cursor.fetchall()
|
|
|
- result = [list(line) for line in data]
|
|
|
- return result
|
|
|
-
|
|
|
-
|
|
|
-result = table_structure()
|
|
|
-obj = RateDetail().rate_and_error_list(result_list=result)
|
|
|
-print(json.dumps(obj, ensure_ascii=False, indent=4))
|
|
|
+M = MatchRate()
|
|
|
+R = RateDetail()
|
|
|
+time_stamp_list = M.generate_stamp_list("20240528", "20240529")
|
|
|
+df = []
|
|
|
+for item in time_stamp_list:
|
|
|
+ s_d = int(item)
|
|
|
+ e_d = int(item) + 24 * 60 * 60 * 1000
|
|
|
+ result = M.match_rate(s_d, e_d)
|
|
|
+ s = 0
|
|
|
+ f = 0
|
|
|
+ p = 0
|
|
|
+ for obj in result:
|
|
|
+ if obj[0] == 2:
|
|
|
+ s += 1
|
|
|
+ elif obj[0] == 3:
|
|
|
+ f += 1
|
|
|
+ elif obj[0] == 1:
|
|
|
+ p += 1
|
|
|
+ print(s, f, p)
|