|
@@ -3,8 +3,7 @@ from model.DataBaseUtils import *
|
|
|
from model.log import logger
|
|
|
from model.CommonUtils import *
|
|
|
du = DateUtils()
|
|
|
-ck = CkUtils()
|
|
|
-db = MysqlUtils()
|
|
|
+
|
|
|
log = logger()
|
|
|
|
|
|
"""根据公众号获取投手"""
|
|
@@ -21,12 +20,12 @@ def get_channel_belong_pitcher(channel):
|
|
|
def get_channels_from_user(user):
|
|
|
sql=f"""SELECT a.nick_name FROM t_mp_account a
|
|
|
left join t_sys_user b on a.oper_user_id=b.user_id where b.nick_name='{user}'"""
|
|
|
- return tuple(db.zx.getOneList(sql))
|
|
|
+ return tuple(MysqlUtils().zx.getOneList(sql))
|
|
|
|
|
|
|
|
|
|
|
|
def get_pitcher_panel_channel(pitcher,channel,start,end,page,page_size,order_by,order):
|
|
|
-
|
|
|
+ ck=CkUtils()
|
|
|
sql=f"""select channel,stage,platform,book,
|
|
|
formatDateTime(dt,'%Y-%m-%d') as date,
|
|
|
toDecimal32(cost,2),
|
|
@@ -61,6 +60,7 @@ def get_pitcher_panel_channel(pitcher,channel,start,end,page,page_size,order_by,
|
|
|
|
|
|
|
|
|
def get_pitcher_panel_daily(pitcher, start, end, page, page_size, order_by, order):
|
|
|
+ ck = CkUtils()
|
|
|
sql=f"""
|
|
|
select formatDateTime(dt,'%Y-%m-%d') date,'{pitcher}' pitcher,cost,first_order_amount,first_roi,
|
|
|
order_amount,today_roi,total_amount,total_cost,total_amount-total_cost total_profit,
|
|
@@ -91,7 +91,7 @@ if(total_cost=0,0,total_amount/total_cost) total_roi from
|
|
|
|
|
|
|
|
|
def get_pitcher_panel_overview(pitcher):
|
|
|
-
|
|
|
+ ck = CkUtils()
|
|
|
sql=f"""select pitcher,
|
|
|
cost cost,
|
|
|
amount amount,
|
|
@@ -122,7 +122,7 @@ def get_pitcher_panel_overview(pitcher):
|
|
|
|
|
|
|
|
|
def get_channel_overview(channel,pitcher,start,end,page,page_size,order_by,order):
|
|
|
-
|
|
|
+ ck = CkUtils()
|
|
|
sql="""select channel,toString(dt) date,
|
|
|
view_count,click_count,
|
|
|
toDecimal32(if(view_count=0,0,click_count/view_count),4) click_rate,
|
|
@@ -174,7 +174,7 @@ def get_channel_overview(channel,pitcher,start,end,page,page_size,order_by,order
|
|
|
|
|
|
|
|
|
def get_channel_again_order_trend(channel,date,pitcher):
|
|
|
-
|
|
|
+ ck = CkUtils()
|
|
|
# if get_channel_belong_pitcher(channel)!=pitcher:
|
|
|
# return []
|
|
|
|
|
@@ -338,7 +338,7 @@ select
|
|
|
|
|
|
|
|
|
def get_channel_active(channel,pitcher,start,end,page,page_size,order_by,order):
|
|
|
-
|
|
|
+ ck = CkUtils()
|
|
|
channel_op=f" and channel='{channel}' " if channel!='' else ''
|
|
|
if pitcher != '赞象 admin':
|
|
|
if get_channels_from_user(pitcher).__len__() == 0:
|
|
@@ -469,7 +469,7 @@ select toDate(formatDateTime(reg_time,'%Y-%m-%d')) dt,channel,
|
|
|
return li,total
|
|
|
|
|
|
def get_channel_order_trend(channel,pitcher,start,end,page,page_size,order_by,order):
|
|
|
-
|
|
|
+ ck = CkUtils()
|
|
|
|
|
|
channel_op =f" and channel='{channel}' " if channel!='' else ''
|
|
|
if pitcher != '赞象 admin':
|
|
@@ -738,7 +738,7 @@ from order where dt>='{start}' {channel_op} group by formatDateTime(reg_time,'
|
|
|
return data,total
|
|
|
|
|
|
def get_channel_summary(channel,pitcher,page,page_size,order_by,order,state):
|
|
|
-
|
|
|
+ ck = CkUtils()
|
|
|
channel_op=f" and channel='{channel}'" if channel!='' else ''
|
|
|
|
|
|
if pitcher!='赞象 admin':
|