diff --git a/api/controllers/wxapp/licheb/Customers.php b/api/controllers/wxapp/licheb/Customers.php index 1d34280d..96db1957 100644 --- a/api/controllers/wxapp/licheb/Customers.php +++ b/api/controllers/wxapp/licheb/Customers.php @@ -1237,6 +1237,7 @@ class Customers extends Wxapp } } $group_id == 1 && $where['a.admin_id'] = $this->myuid; + $biz_type == Biz_model::BIZ_TYPE_4s && $where['a.un_lock'] = 1; $count = $this->mdCustomerVisitData->count_visit($where); } else {//数据看板 数据列表 if ($tab_id == 2) {//今日 @@ -1250,6 +1251,7 @@ class Customers extends Wxapp $where = ['biz_id' => $this->biz_id, 'status>=' => 0, 'p_time>=' => $s_c_time , 'p_time<=' => $e_c_time]; $group_id == 1 && $where['admin_id'] = $this->myuid; + $biz_type == Biz_model::BIZ_TYPE_4s && $where['un_lock'] = 1; $count = $this->customers_model->count($where); } else if ($visit == 5 || $visit == 7) {//今日/本月到店/战败 $oplogs_type = $visit == 7 ? 7 : 4;//4到店7战败 @@ -1267,6 +1269,7 @@ class Customers extends Wxapp } !$str_uids && $str_uids = '-1'; $where["(of2_id = 10 and c_time>={$s_c_time} and c_time<={$e_c_time}) OR id in(select customer_id from lc_receiver_customer_oplogs where type={$oplogs_type} and uid in({$str_uids}) and c_time>={$s_c_time} and c_time<={$e_c_time})"] = null; + $biz_type == Biz_model::BIZ_TYPE_4s && $where['un_lock'] = 1; $count = $this->customers_model->count($where); } } diff --git a/api/controllers/wxapp/licheb/User.php b/api/controllers/wxapp/licheb/User.php index d66ca176..e00b55f7 100644 --- a/api/controllers/wxapp/licheb/User.php +++ b/api/controllers/wxapp/licheb/User.php @@ -427,8 +427,22 @@ class User extends Wxapp $where_today_order = ['biz_id' => $biz_id, 'status>=' => 0, 'c_time>=' => strtotime($s_today), 'c_time<=' => strtotime($e_today)]; $where_month_order = ['biz_id' => $biz_id, 'status>=' => 0, 'c_time>=' => strtotime($s_month), 'c_time<=' => strtotime($e_month)]; //战败 - $where_today_defeat = ['biz_id' => $biz_id, 'status>=' => 0, 'cs_biz_id<>' => -1, 'def_time >= ' => $s_today, 'def_time<=' => $e_today]; - $where_month_defeat = ['biz_id' => $biz_id, 'status>=' => 0, 'cs_biz_id<>' => -1, 'def_time >= ' => $s_month, 'def_time<=' => $e_month]; + $where_today_defeat = [ + 'biz_id' => $biz_id, 'status>=' => 0 + ]; + $str_uids = ''; + if ($group_id == 1) { + $str_uids = $this->myuid; + } else { + $res_user = $this->app_user_model->select(['biz_id' => $biz_id, 'group_id <' => 4, 'status>=' => 0], 'id asc', 0, 0, 'id,userid'); + foreach ($res_user as $k => $v) { + $str_uids = $str_uids ? $str_uids . ',' . $v['id'] : $v['id']; + } + } + !$str_uids && $str_uids = '-1'; + $where_today_defeat["(of2_id = 10 and c_time>=" . strtotime($s_today) . " and c_time<=" . strtotime($e_today) . ") OR id in(select customer_id from lc_receiver_customer_oplogs where type=7 and uid in({$str_uids}) and c_time>=" . strtotime($s_today) . " and c_time<=" . strtotime($e_today) . ")"] = null; + $where_month_defeat = ['biz_id' => $biz_id, 'status>=' => 0]; + $where_month_defeat["(of2_id = 10 and c_time>=" . strtotime($s_month) . " and c_time<=" . strtotime($e_month) . ") OR id in(select customer_id from lc_receiver_customer_oplogs where type=7 and uid in({$str_uids}) and c_time>=" . strtotime($s_month) . " and c_time<=" . strtotime($e_month) . ")"] = null; if ($group_id == 1) { $where_today_xs['admin_id'] = $uid; $where_month_xs['admin_id'] = $uid;