|
@@ -1,6 +1,7 @@
|
|
|
from app.api_data.order_util import *
|
|
|
from model.DataBaseUtils import MysqlUtils
|
|
|
from concurrent.futures import ThreadPoolExecutor
|
|
|
+from model.DingTalkUtils import DingTalkUtils
|
|
|
db=MysqlUtils()
|
|
|
|
|
|
|
|
@@ -11,8 +12,14 @@ def get_account(plactform):
|
|
|
new_data.append(i[0].replace('\n', '').split(","))
|
|
|
return new_data
|
|
|
|
|
|
+def get_new_account(plactform):
|
|
|
+ data = db.quchen_text.getData(f"select text from order_account_text where platform='{plactform}' and create_time>='{du.get_n_days(-1)}'")
|
|
|
+ new_data = []
|
|
|
+ for i in data:
|
|
|
+ new_data.append(i[0].replace('\n', '').split(","))
|
|
|
+ return new_data
|
|
|
|
|
|
-def yangguang(start=None, end=None):
|
|
|
+def yangguang(start=None, end=None,new=None):
|
|
|
|
|
|
if start:
|
|
|
start = start+' 00:00:00'
|
|
@@ -23,7 +30,11 @@ def yangguang(start=None, end=None):
|
|
|
|
|
|
client_id = 10008097
|
|
|
token = '2xa1d55tTPBjeEA8Ho'
|
|
|
- accounts=get_account("阳光")
|
|
|
+ accounts=get_account("阳光") if new is None else get_new_account('阳光')
|
|
|
+ if accounts.__len__()==0:
|
|
|
+ return
|
|
|
+ else:
|
|
|
+ print(f"阳光账号数:{accounts.__len__()}")
|
|
|
|
|
|
for i in accounts:
|
|
|
stage = i[0]
|
|
@@ -31,30 +42,41 @@ def yangguang(start=None, end=None):
|
|
|
print(vip_id)
|
|
|
get_yg_vip_channel(stage, vip_id, client_id, token)
|
|
|
get_yg_data(stage, vip_id, client_id, token, start, end)
|
|
|
-
|
|
|
+ x=1
|
|
|
while True:
|
|
|
a = db.quchen_text.getOne("select count(1) from yangguang_path where update_time is null")
|
|
|
print(f" vip 待处理数量 {a} 正在等待数据回调")
|
|
|
if a == 0:
|
|
|
break
|
|
|
time.sleep(60)
|
|
|
+ x+=1
|
|
|
+ if x>15:
|
|
|
+ DingTalkUtils.send('阳光订单回调延时15min','18860455786')
|
|
|
+ break
|
|
|
|
|
|
for i in accounts:
|
|
|
vip_id = i[1]
|
|
|
- parse_yg_data(vip_id)
|
|
|
+ stage=i[0]
|
|
|
+ parse_yg_data(vip_id,stage)
|
|
|
|
|
|
|
|
|
-def huasheng(start=None,end=None):
|
|
|
+def huasheng(start=None,end=None,new=None):
|
|
|
if start is None:
|
|
|
start = end = du.getTodayOrYestoday()
|
|
|
|
|
|
executor = ThreadPoolExecutor(max_workers=5)
|
|
|
- accounts = get_account("花生")
|
|
|
+ accounts = get_account("花生") if new is None else get_new_account('花生')
|
|
|
+ if len(accounts)==0:
|
|
|
+ return
|
|
|
+ else:
|
|
|
+ print(f'花生有账号{len(accounts)}个')
|
|
|
li = []
|
|
|
for account in accounts:
|
|
|
channel_data = get_hs_channel(account)
|
|
|
if not channel_data:
|
|
|
continue
|
|
|
+ else:
|
|
|
+ print(f"账号:{account[2]} 有channel{len(channel_data)}个")
|
|
|
for merchant in channel_data:
|
|
|
executor.submit(get_huasheng_order_task, start, end, account, merchant,li)
|
|
|
executor.shutdown(True)
|