Kaynağa Gözat

MOD:修改七悦数据

cxyu 3 yıl önce
ebeveyn
işleme
9893197455
1 değiştirilmiş dosya ile 18 ekleme ve 21 silme
  1. 18 21
      app/api_data/platform_order/QiYue.py

+ 18 - 21
app/api_data/platform_order/QiYue.py

@@ -25,7 +25,7 @@ def get_qiyue_order_task(start, end, account):
     """一分钟请求60次的限制"""
     order_list = []
     # 参数
-    order_url = "https://api.zhangwenwenhua.com" + "/v1/orders"
+    order_url = "https://a-api.zhangwenwenhua.com" + "/v1/orders"
     stage = account[0]
     token = account[1]
     size = 50
@@ -41,11 +41,12 @@ def get_qiyue_order_task(start, end, account):
             response_result_json = rsp.json()
             # print(response_result_json)
 
-            freq += 1
-            if freq == 59:
-                print("一分钟请求60次的限制 等待中")
-                time.sleep(61)
-                freq = 0
+            # 无限制了
+            # freq += 1
+            # if freq == 59:
+            #     print("一分钟请求60次的限制 等待中")
+            #     time.sleep(61)
+            #     freq = 0
 
             code = response_result_json['code']
             if code != 0:
@@ -90,15 +91,14 @@ def get_qiyue_order_task(start, end, account):
             page += 1
         # print(len(order_list))
     print(f'{stage} [{start}-{end}] 有订单{order_list.__len__()}')
-        # print(order_list)
+    # print(order_list)
     if order_list.__len__() > 0:
         save_order2(order_list)
 
 
-
 # 获取七悦用户信息
-def get_qiyue_user_info(account,date=None):
-    order_url = "https://api.zhangwenwenhua.com" + "/v1/users"
+def get_qiyue_user_info(account, date=None):
+    order_url = "https://a-api.zhangwenwenhua.com" + "/v1/users"
     stage = account[0]
     token = account[1]
     page = 1
@@ -110,7 +110,7 @@ def get_qiyue_user_info(account,date=None):
     while True:
         timestamp = int(time.time())
         url = order_url + "?" + "token=" + str(token) + "&timestamp=" + str(timestamp) + "&page=" + str(
-            page) + "&size=" + str(size) +"&date=" + dt
+            page) + "&size=" + str(size) + "&date=" + dt
         r = requests.get(url=url).json()
         print(r)
 
@@ -136,24 +136,21 @@ def get_qiyue_user_info(account,date=None):
                        i['free_kandian'],
                        i['vip_endtime']
 
-            ))
+                       ))
 
         if len(r['data']['data']) < size:
             break
         page += 1
     print(f"{stage} 有粉丝{len(li)}")
-    if len(li)>0:
-        sql="replace into platform_user_info values (%s,%s,%s,%s,%s,%s,%s,%s,%s)"
-        db.quchen_text.executeMany(sql,li)
-
-
-
+    if len(li) > 0:
+        sql = "replace into platform_user_info values (%s,%s,%s,%s,%s,%s,%s,%s,%s)"
+        db.quchen_text.executeMany(sql, li)
 
 
 if __name__ == '__main__':
-    st ='2021-06-07'
-    et ='2021-06-07'
+    st = '2021-06-07'
+    et = '2021-06-07'
 
     for account in get_account("七悦"):
         get_qiyue_order_task(st, et, account)
-        # get_qiyue_user_info(account)
+        # get_qiyue_user_info(account)