|
@@ -118,7 +118,7 @@ def get_channel_overview(user_id,channel,pitcher,stage,start,end,page,page_size,
|
|
|
if len(UserAuthUtils.get_auth_channel(user_id)) == 0:
|
|
|
return None, None, None
|
|
|
else:
|
|
|
- op = f" and a.channel in {str(UserAuthUtils.get_auth_channel(user_id))}"
|
|
|
+ op = f" and channel in {str(UserAuthUtils.get_auth_channel(user_id))}"
|
|
|
|
|
|
op1 = f" and pitcher ='{pitcher}' " if pitcher else ''
|
|
|
op2 = f" and channel='{channel}'" if channel else ''
|
|
@@ -363,13 +363,16 @@ select
|
|
|
return [json1]
|
|
|
|
|
|
|
|
|
-def get_channel_active(channel,pitcher,start,end,page,page_size,order_by,order):
|
|
|
+def get_channel_active(user_id,channel,pitcher,start,end,page,page_size,order_by,order):
|
|
|
db = MysqlUtils()
|
|
|
- if pitcher:
|
|
|
- op1 = f" and pitcher='{pitcher}'" if get_channels_from_user(
|
|
|
- pitcher).__len__() == 0 else f" and channel in {get_channels_from_user(pitcher)}"
|
|
|
+ if user_id in super_auth:
|
|
|
+ op = ''
|
|
|
else:
|
|
|
- op1 = ''
|
|
|
+ if len(UserAuthUtils.get_auth_channel(user_id)) == 0:
|
|
|
+ return None, None, None
|
|
|
+ else:
|
|
|
+ op = f" and channel in {str(UserAuthUtils.get_auth_channel(user_id))}"
|
|
|
+ op1 = f" and pitcher ='{pitcher}' " if pitcher else ''
|
|
|
op2 = f" and channel='{channel}'" if channel else ''
|
|
|
op3 = f" and dt>='{start}' " if start else ''
|
|
|
op4 = f" and dt<='{end}' " if end else ''
|
|
@@ -421,7 +424,7 @@ concat(dc27-dc26,',',cost/dc27,',',(dc27-dc26)/reg_order_user) d27,
|
|
|
concat(dc28-dc27,',',cost/dc28,',',(dc28-dc27)/reg_order_user) d28,
|
|
|
concat(dc29-dc28,',',cost/dc29,',',(dc29-dc28)/reg_order_user) d29,
|
|
|
concat(dc30-dc29,',',cost/dc30,',',(dc30-dc29)/reg_order_user) d30
|
|
|
-from (select * from dw_channel where cost>0 {op1} {op2} {op3} {op4}) a
|
|
|
+from (select * from dw_channel where cost>0 {op} {op1} {op2} {op3} {op4}) a
|
|
|
left join dw_channel_user_daily b using(dt,channel) {op5}
|
|
|
"""
|
|
|
|
|
@@ -442,13 +445,18 @@ left join dw_channel_user_daily b using(dt,channel) {op5}
|
|
|
|
|
|
return data,total
|
|
|
|
|
|
-def get_channel_order_trend(channel,pitcher,start,end,page,page_size,order_by,order):
|
|
|
- db=MysqlUtils()
|
|
|
- if pitcher:
|
|
|
- op1 = f" and pitcher='{pitcher}'" if get_channels_from_user(
|
|
|
- pitcher).__len__() == 0 else f" and channel in {get_channels_from_user(pitcher)}"
|
|
|
+def get_channel_order_trend(user_id,channel,pitcher,start,end,page,page_size,order_by,order):
|
|
|
+ db = MysqlUtils()
|
|
|
+
|
|
|
+ if user_id in super_auth:
|
|
|
+ op = ''
|
|
|
else:
|
|
|
- op1 = ''
|
|
|
+ if len(UserAuthUtils.get_auth_channel(user_id)) == 0:
|
|
|
+ return None, None, None
|
|
|
+ else:
|
|
|
+ op = f" and channel in {str(UserAuthUtils.get_auth_channel(user_id))}"
|
|
|
+
|
|
|
+ op1 = f" and pitcher ='{pitcher}' " if pitcher else ''
|
|
|
op2 = f" and channel='{channel}'" if channel else ''
|
|
|
op3 = f" and dt>='{start}' " if start else ''
|
|
|
op4 = f" and dt<='{end}' " if end else ''
|
|
@@ -533,7 +541,7 @@ concat(da60-da59 ,',' ,da60/cost ,',', (da60-da59)/cost ,',' ,da60/da1) d60,
|
|
|
concat(dm3-da60 ,',' ,dm3/cost ,',', (dm3-da60)/cost ,',' ,dm3/da1) m3,
|
|
|
concat(dm4-dm3 ,',' ,dm4/cost ,',', (dm4-dm3)/cost ,',' ,dm4/da1) m4,
|
|
|
concat(dm5-dm4 ,',' ,dm5/cost ,',', (dm5-dm4)/cost ,',' ,dm5/da1) m5
|
|
|
-from ( select * from dw_channel where cost+reg_order_amount>0 {op1} {op2} {op3} {op4} ) a
|
|
|
+from ( select * from dw_channel where cost+reg_order_amount>0 {op} {op1} {op2} {op3} {op4} ) a
|
|
|
left join dw_channel_amount_daily b on a.channel=b.channel and a.dt=b.dt
|
|
|
left join src_book_info c on a.dt=c.dt and a.book=c.book and a.type=c.type and a.platform=c.platform
|
|
|
|