diff --git a/common/libraries/market/Sylive2_data_entity.php b/common/libraries/market/Sylive2_data_entity.php
index ee5fcf76..b8f9a06f 100644
--- a/common/libraries/market/Sylive2_data_entity.php
+++ b/common/libraries/market/Sylive2_data_entity.php
@@ -63,7 +63,7 @@ class Sylive2_data_entity{
$biz = $biz_rows[$val['bizId']] ? $biz_rows[$val['bizId']][0] : [];
$tip = $tagId==$val['cfUserId'] ? '本人' : '';
$name = $org['name'];
- $biz && $name.="{$biz['groupsName']}";
+ $biz && $name="{$biz['groupsName']} {$name}";
$headimg = $org['headimg'];
}
$lists[] = [
@@ -89,7 +89,7 @@ class Sylive2_data_entity{
$lists = [];
if($total){
$rows = $this->ci->groups_user_model->select_groupby($groupby, $where, $order, $page, $page_size, $select);
- $target_rows = [];
+ $biz_rows = $target_rows = [];
if($groupby=='bizId'){
$biz_ids = implode(',',array_column($rows,'tagId'));
$biz_ids && $target_rows = $this->ci->groups_model->map('groupsId','',["groupsId in ($biz_ids)"=>null],'','','','groupsId,groupsName');
@@ -97,8 +97,10 @@ class Sylive2_data_entity{
$biz_ids = implode(',',array_column($rows,'tagId'));
$biz_ids && $target_rows = $this->ci->groups_model->map('groupsId','',["groupsId in ($biz_ids)"=>null],'','','','groupsId,groupsName');
}else{
- $biz_ids = implode(',',array_column($rows,'tagId'));
- $biz_ids && $target_rows = $this->ci->user_model->map('userId','',["userId in ($biz_ids)"=>null],'','','','userId,uname as name,headimg');
+ $taget_ids = implode(',',array_column($rows,'tagId'));
+ $taget_ids && $target_rows = $this->ci->user_model->map('userId','',["userId in ($taget_ids)"=>null],'','','','userId,uname as name,headimg');
+ $biz_ids = implode(',',array_column($rows,'bizId'));
+ $biz_ids && $biz_rows = $this->ci->groups_model->map('groupsId','',["groupsId in ($biz_ids)"=>null],'','','','groupsId,groupsName');
}
$start = $page>1 ? ($page-1)*$page_size : 0;
$num_tip = $kpi == 'order' ? '单' : '人';
@@ -112,8 +114,10 @@ class Sylive2_data_entity{
$biz = $target_rows[$val['tagId']][0];
$name = $biz['groupsName'];
}else{
- $biz = $target_rows[$val['tagId']][0];
- $name = $biz['name'];
+ $target = $target_rows[$val['tagId']][0];
+ $name = $target['name'];
+ $biz = $biz_rows[$val['bizId']] ? $biz_rows[$val['bizId']][0] : [];
+ $biz && $name="{$biz['groupsName']} {$name}";
}
$lists[] = [
'ranking' => $start+$key+1,
diff --git a/home/controllers/h5/market/sylive2/Common.php b/home/controllers/h5/market/sylive2/Common.php
index f4d2f97a..11304a37 100644
--- a/home/controllers/h5/market/sylive2/Common.php
+++ b/home/controllers/h5/market/sylive2/Common.php
@@ -180,6 +180,7 @@ class Admin extends Common{
try{
$this->session = $_SESSION[self::SESSION_KEY];
$this->mobile = $this->session['mobile'];
+ $_SESSION[self::SESSION_KEY]['act_uid'] = '';
if(!in_array($method,$this->white_login_method) && !$_SESSION[self::SESSION_KEY]['mobile'] && !$this->uid){
$ret = $this->set_auth();
$openid = $ret['openid'];
diff --git a/home/controllers/h5/market/sylive2/Login.php b/home/controllers/h5/market/sylive2/Login.php
index f837eb0a..f0522961 100644
--- a/home/controllers/h5/market/sylive2/Login.php
+++ b/home/controllers/h5/market/sylive2/Login.php
@@ -66,6 +66,8 @@ class Login extends CI_Controller{
$wx_info['headimgurl'] && $update['headimg'] = strval($wx_info['headimgurl']);
$wx_info['unionid'] && $update['unionid'] = $wx_info['unionid'];
$this->user_model->update($update,['mobile'=>$mobile,'status'=>0,'organizationId>'=>0]);
+ //普通用户禁用
+ $this->user_model->update(['status'=>-1],['openid'=>$wx_info['openid'],'status'=>0,'organizationId'=>0]);
return ['code' => 1,'msg' => '绑定成功'];
}
//获取验证码
diff --git a/home/controllers/h5/market/sylive2/Stic.php b/home/controllers/h5/market/sylive2/Stic.php
index 50a299dc..86064207 100644
--- a/home/controllers/h5/market/sylive2/Stic.php
+++ b/home/controllers/h5/market/sylive2/Stic.php
@@ -76,11 +76,12 @@ class Stic extends Admin{
$where = [
'activityId' => $this->a_id,
'status' => 0,
- 'bizId>' => 0
];
$gw_total = $this->groups_user_model->count($where);
- $where["userId in (select cfUserId from lc_market_sylive_activity_kpidata where activityId={$this->a_id})"] = null;
- $kgw_total = $this->groups_user_model->count($where);
+ $where = [
+ 'activityId' => $this->a_id,
+ ];
+ $kgw_total = $this->mdSytActivityKpiData->count($where,"cfUserId");
$h_lists[] = ['title'=>'参与门店','num'=>"{$biz_total}个"];
$h_lists[] = ['title'=>'参与顾问','num'=>"{$gw_total}个"];
$h_lists[] = ['title'=>'开工顾问','num'=>"{$kgw_total}个"];
@@ -120,17 +121,20 @@ class Stic extends Admin{
}
if($group_row['groupsId']!=$group_user['bizId']){
if(!$group_row['groupsLevel'] && !$group_row['ifBiz']){//顶级
- $b_sum = $this->groups_model->sum('browse',['groupsLevel'=>1,'activityId'=>$this->a_id]);
- $sub_sum = $this->groups_model->sum('subscribe',['groupsLevel'=>1,'activityId'=>$this->a_id]);
- $browse_count = $b_sum['browse'];//浏览数据
- $subscribe_count = $sub_sum['subscribe'];//订阅数据
+ $browse_count = $this->mdSytActivityKpiData->count(['activityId' => $this->a_id, 'kpi' => 'browse']);
+ $subscribe_count = $this->mdSytActivityKpiData->count(['activityId' => $this->a_id, 'kpi' => 'subscribe']);
}else{
$browse_count = $group_row['browse'];//浏览数据
$subscribe_count = $group_row['subscribe'];//订阅数据
}
+ $b_url = $sub_url = '';
+ if($group_row['ifBiz']){
+ $b_url = "/h5/market/sylive2/stic/users?type=biz&type_id={$group_row['groupsId']}&kpi=browse";
+ $sub_url = "/h5/market/sylive2/stic/users?type=biz&type_id={$group_row['groupsId']}&kpi=subscribe";
+ }
$biz = [
- ['title'=>'访问用户','num'=>"{$browse_count}人"],
- ['title'=>'预约用户','num'=>"{$subscribe_count}人"],
+ ['title'=>'访问用户','num'=>"{$browse_count}人",'url'=>$b_url],
+ ['title'=>'预约用户','num'=>"{$subscribe_count}人",'url'=>$sub_url],
['title'=>'预约率','num'=>$browse_count ? round($subscribe_count/$browse_count*100,2)."%" : 0],
];
$title = $disk[$group_row['groupsLevel']+1]? '所有'.$disk[$group_row['groupsLevel']+1] : '所有门店';
@@ -201,17 +205,20 @@ class Stic extends Admin{
if($group_row['groupsId']!=$group_user['bizId']){
$disk = $this->sylive2_entity->level_disk($this->a_id);
if(!$group_row['groupsLevel'] && !$group_row['ifBiz']){//顶级
- $b_sum = $this->groups_model->sum('watch',['groupsLevel'=>1,'activityId'=>$this->a_id]);
- $sub_sum = $this->groups_model->sum('orderTotal',['groupsLevel'=>1,'activityId'=>$this->a_id]);
- $browse_count = $b_sum['watch'];//观看数据
- $subscribe_count = $sub_sum['orderTotal'];//下单数据
+ $browse_count = $this->mdSytActivityKpiData->count(['activityId' => $this->a_id, 'kpi' => 'watch']); //观看数据
+ $subscribe_count = $this->market_sylive_order_model->count(['activityId' => $this->a_id, 'status' => 1]); //下单数据
}else{
$browse_count = $group_row['watch'];//观看数据
$subscribe_count = $group_row['orderTotal'];//下单数据
}
+ $b_url = $sub_url = '';
+ if($group_row['ifBiz']){
+ $b_url = "/h5/market/sylive2/stic/users?type=biz&type_id={$group_row['groupsId']}&kpi=watch";
+ $sub_url = "/h5/market/sylive2/stic/users?type=biz&type_id={$group_row['groupsId']}&kpi=order";
+ }
$biz = [
- ['title'=>'观看用户','num'=>"{$browse_count}人"],
- ['title'=>'下单数','num'=>"{$subscribe_count}人"],
+ ['title'=>'观看用户','num'=>"{$browse_count}人",'url'=>$b_url],
+ ['title'=>'下单数','num'=>"{$subscribe_count}人",'url'=>$sub_url],
['title'=>'转化率','num'=>$browse_count ? round($subscribe_count/$browse_count*100,2)."%" : 0],
];
$title = $disk[$group_row['groupsLevel']+1]? '所有'.$disk[$group_row['groupsLevel']+1] : '所有门店';
@@ -390,7 +397,7 @@ class Stic extends Admin{
$params['itemId'] && $where['itemId'] = $params['itemId'];
$groupby = 'cfUserId';
$teamId = $this->uid;
- $select = 'bizId,cfUserId as tagId,count(id) as t';
+ $select = 'cfUserId as tagId,count(id) as t';
$order = 't desc,id desc';
$res = $this->sylive2_data_entity->top_kpidata($groupby,$where,$order,$page,$size,$select,$teamId);
$lists = [];
@@ -428,7 +435,7 @@ class Stic extends Admin{
if($rows){
foreach ($rows as $item) {
$count = $this->groups_model->count(['activityId'=>$this->a_id,'status'=>0,'parentId'=>$item['groupsId']]);
- $url = $note = '';
+ $note = '';
$url = "/h5/market/sylive2/stic?groupsId={$item['groupsId']}";
if(!$item['ifBiz']){
$note = $disk[$item['groupsLevel']+1] ? $disk[$item['groupsLevel']+1]:'门店';
@@ -545,7 +552,7 @@ class Stic extends Admin{
$where["$group_by>"] = 0;
}else{
$group_by = 'userId';
- $select = "userId as tagId,sum({$kpi}) as t";
+ $select = "bizId,userId as tagId,sum({$kpi}) as t";
$where["$group_by>"] = 0;
}
$data = $this->sylive2_data_entity->top_groups_user($group_by,$where,'t desc,groupsUserId desc',$page,$size,$select,$params['kpi'],$group_user['bizId']);
diff --git a/home/views/h5/market/sylive2/stic/index.php b/home/views/h5/market/sylive2/stic/index.php
index df8c0180..fc2b7871 100644
--- a/home/views/h5/market/sylive2/stic/index.php
+++ b/home/views/h5/market/sylive2/stic/index.php
@@ -102,7 +102,7 @@