Browse Source

MOD:添加接口注释,修改提醒

cxyu 3 years ago
parent
commit
a975e6f7f9

+ 3 - 2
app/api_data/platform_order/yangguang.py

@@ -56,7 +56,7 @@ def get_yg_data(stage,vip_id,client_id,token,start,end):
     }
     headers={"Content-Type":"application/json"}
     r=requests.post(url=url,data=json.dumps(params),headers=headers)
-    print(r.text)
+    print(vip_id,r.text)
     task_id = json.loads(r.text).get("data").get("task_id")
     db.quchen_text.execute(f"replace into yangguang_path(vip_id,task_id,stage,type) values ('{vip_id}','{task_id}','{stage}','order')")
 
@@ -183,7 +183,7 @@ def check():
         time.sleep(60)
         x += 1
         if x > 10:
-            DingTalkUtils.send('阳光订单回调延时10min', '18860455786')
+            DingTalkUtils.send('阳光订单回调延时10min', '15168342316')
             info = '回调未完成'
             break
     return info
@@ -251,5 +251,6 @@ if __name__ == '__main__':
     #     yangguang(i[0], i[1])
 
     # parse_order_data()
+    # get_channel_info()
     yangguang()
 

+ 5 - 4
app/api_data/tx_ad_cost/cost_util.py

@@ -81,7 +81,7 @@ def get_campaign(account_id, access_token, flag,campaign_ids,dt):
 
 
 def get_adcreatives(account_id,access_token,flag,adc_ids,dt):  # 获取创意
-
+    #接口https://developers.e.qq.com/docs/api/adsmanagement/adcreatives/adcreatives_get?version=1.3
     url = 'https://api.e.qq.com/v1.1/adcreatives/get'
     li =[]
     page = 1
@@ -202,7 +202,7 @@ def get_adcreatives(account_id,access_token,flag,adc_ids,dt):  # 获取创意
 
 
 def images_info_get(account_id,access_token,image_ids):  # 获取图片信息
-
+    #接口https://developers.e.qq.com/docs/api/business_assets/image/images_get?version=1.3
     fields = ('image_id','width','height','file_size','signature','preview_url')
     interface = 'images/get'
     url = 'https://api.e.qq.com/v1.3/' + interface
@@ -269,7 +269,7 @@ def images_info_get(account_id,access_token,image_ids):  # 获取图片信息
 
 
 def video_info_get(account_id,access_token,image_ids):  # 获取视频信息
-
+    #接口https://developers.e.qq.com/docs/api/business_assets/video/videos_get?version=1.3
     fields = ('video_id','width','height','file_size','signature','preview_url')
     interface = 'videos/get'
     url = 'https://api.e.qq.com/v1.3/' + interface
@@ -363,7 +363,7 @@ def ad_info():
 
 def get_ad_info(account_id, access_token, flag,ad_ids,dt):
 
-
+    #接口为https://developers.e.qq.com/docs/apilist/ads/ad?version=1.3#a3
     path = 'ads/get'
     fields = ('ad_id', 'ad_name', 'adcreative_id', 'adgroup_id', 'campaign_id')
     url = 'https://api.e.qq.com/v1.3/' + path
@@ -429,6 +429,7 @@ def get_ad_cost_day(account_id,access_token,flag,st,et):
 
 
 def ad_cost_day_gdt(account_id,access_token,st,et):
+    #接口文档https://developers.e.qq.com/docs/api/insights/ad_insights/daily_reports_get?version=1.3
     url = 'https://api.e.qq.com/v1.3/daily_reports/get'
     fields = ('date', 'ad_id','adgroup_id', 'cost', 'view_count', 'ctr', 'follow_count','web_order_count','order_amount')
     li = []

+ 2 - 1
app/crontab_task/ad_hourly.py

@@ -10,12 +10,13 @@ if __name__ == '__main__':
 
     st = time.time()
 
+
     # 广告数据
     get_cost.hourly()  # 广告相关消耗数据
     dw_image_cost_day.hourly()
 
     if int(time.time()-st)>1500:
-        DingTalkUtils.send(f"小时任务耗时{int(time.time()-st)}秒",phone="18860455786")
+        DingTalkUtils.send(f"小时任务耗时{int(time.time()-st)}秒",phone="15168342316")
 
 
 

+ 1 - 1
app/crontab_task/hourlyRun.py

@@ -18,7 +18,7 @@ if __name__ == '__main__':
     data_stat_run.hourly()
 
     if int(time.time()-st)>1500:
-        DingTalkUtils.send(f"小时任务耗时{int(time.time()-st)}秒",phone="18860455786")
+        DingTalkUtils.send(f"小时任务耗时{int(time.time()-st)}秒",phone="15168342316")
 
 
 

+ 21 - 17
app/etl/data_stat_run.py

@@ -1,8 +1,8 @@
 from model.DateUtils import DateUtils
 import logging
 from model.DingTalkUtils import DingTalkUtils
-from data_stat_task import *
-from sync_to_ck_task import *
+from app.etl.data_stat_task import *
+from app.etl.sync_to_ck_task import *
 from app.etl.dm.dm_pitcher_daily_overview import dm_pitcher_daily_overview
 from app.etl.dw.dw_channel_daily import dw_channel_daily
 from app.etl.dw.dw_pitcher_daily import dw_pitcher_trend
@@ -15,21 +15,25 @@ logger = logging.getLogger("")
 # logger.setLevel(logging.ERROR)
 logging.getLogger().setLevel(logging.WARNING)
 
-def do_order(st,et):
-    for i in du.getDateLists(st,et):
+
+def do_order(st, et):
+    for i in du.getDateLists(st, et):
         print(i)
         order_sync_ck(i)
-def do_cost(st,et):
-    for i in du.getDateLists(st,et):
+
+
+def do_cost(st, et):
+    for i in du.getDateLists(st, et):
         print(i)
         channel_by_account_daily(i)
         channel_info_daily(i)
         dw_daily_channel_cost(i)
 
-def main(st,et):
+
+def main(st, et):
     try:
-        do_order(st,et)
-        do_cost(st,et)
+        do_order(st, et)
+        do_cost(st, et)
         src_book_info()  # 书籍卡点信息
         # book_annual_expect_profit.run() # 年预期收益
         dw_channel_daily()
@@ -38,25 +42,25 @@ def main(st,et):
         dm_pitcher_daily_overview()
     except Exception as e:
         print(e)
-        DingTalkUtils.send("hourlyRun fail!! "+str(e),'18860455786')
+        DingTalkUtils.send("hourlyRun fail!! " + str(e), '15168342316')
 
 
 def hourly():
-    thedate=du.getTodayOrYestoday()
+    thedate = du.getTodayOrYestoday()
     main(thedate, thedate)
 
 
 def daily():
     "往前跑10天"
-    st=du.get_n_days(-10)
-    et=du.get_n_days(-1)
+    st = du.get_n_days(-10)
+    et = du.get_n_days(-1)
     do_order(st, et)
     do_cost(st, et)
-    
 
 
 if __name__ == '__main__':
-    # hourly()
-    # do_cost('2021-02-10','2021-02-10')
+    hourly()
+    # daily()
+    # daily('2021-06-30','2021-07-04')
 
-    do_order('2021-05-11','2021-05-11')
+    # do_order('2021-05-30', '2021-06-29')

+ 1 - 1
model/DingTalkUtils.py

@@ -8,7 +8,7 @@ import random
 
 url = "https://oapi.dingtalk.com/robot/send?access_token=ba21cd5591c44593ca7cac05902835e33298c7bf566a5381dc3f01e41c8d5c30"
 headers = {'Content-Type': 'application/json;charset=utf-8'}
-members = ["13726204048", "18860455786"]
+members = ["13726204048", "15168342316"]
 
 class DingTalkUtils:
     """