|
@@ -110,13 +110,17 @@ where 1=1 {op1}
|
|
|
return db.dm.getData_json(sql)
|
|
|
|
|
|
|
|
|
-def get_channel_overview(channel,pitcher,stage,start,end,page,page_size,order_by,order):
|
|
|
+def get_channel_overview(user_id,channel,pitcher,stage,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 a.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 ''
|
|
@@ -152,7 +156,7 @@ def get_channel_overview(channel,pitcher,stage,start,end,page,page_size,order_by
|
|
|
round(reg_order_amount/reg_order_user,2) user_per_amount,
|
|
|
round(follow_user/click_count,4) click_follow_rate,
|
|
|
round(reg_order_user/follow_user,4) follow_order_rate
|
|
|
-from dw_channel where 1=1 {op1} {op2} {op3} {op4} {op6} {op5} """
|
|
|
+from dw_channel where 1=1 {op} {op1} {op2} {op3} {op4} {op6} {op5} """
|
|
|
|
|
|
print(sql)
|
|
|
sumsql=f"""select '总计' date,
|
|
@@ -577,23 +581,16 @@ left join src_book_info c on a.dt=c.dt and a.book=c.book and a.type=c.type and
|
|
|
def get_channel_summary(user_id,channel,pitcher,page,page_size,order_by,order,state,location,start,end):
|
|
|
db=MysqlUtils()
|
|
|
|
|
|
-
|
|
|
-
|
|
|
if user_id in super_auth:
|
|
|
- op =''
|
|
|
+ op = ''
|
|
|
else:
|
|
|
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))}"
|
|
|
|
|
|
-
|
|
|
op1=f" and a.channel='{channel}'" if channel else ''
|
|
|
-
|
|
|
- if pitcher:
|
|
|
- op2=f" and pitcher='{pitcher}'" if get_channels_from_user(pitcher).__len__()==0 else f" and a.channel in {get_channels_from_user(pitcher)}"
|
|
|
- else:
|
|
|
- op2=''
|
|
|
+ op2=f" and pitcher='{pitcher}'" if pitcher else ''
|
|
|
op4=f" and location='{location}' " if location else ''
|
|
|
op5=f" and state='{state}'" if state else ''
|
|
|
op6=f" and a.dt>='{start}'" if start else ''
|