user_10118

This commit is contained in:
dengbw
2022-10-18 11:52:15 +08:00
committed by lccsw
parent ef9a145c99
commit ba4ff119ed
2 changed files with 30 additions and 33 deletions
+8 -3
View File
@@ -945,12 +945,17 @@ class Customers extends Wxapp
$s_c_time = strtotime($s_c_time);
$e_c_time = strtotime($e_c_time);
$where = ['biz_id' => $this->biz_id, 'status>=' => 0, 'cs_biz_id<>' => -1];
$str_uids = '';
if ($group_id == 1) {
$where['admin_id'] = $this->myuid;
$where["id in(select customer_id from lc_receiver_customer_oplogs where type={$oplogs_type} and c_time>={$s_c_time} and c_time<={$e_c_time} and uid={$this->myuid})"] = null;
$str_uids = $this->myuid;
} else {
$where["id in(select customer_id from lc_receiver_customer_oplogs where type={$oplogs_type} and c_time>={$s_c_time} and c_time<={$e_c_time})"] = null;
$res_user = $this->app_user_model->select(['biz_id' => $this->biz_id, 'group_id <' => 4, 'status' => 1], '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["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;
$count = $this->customers_model->count($where);
}
}
+22 -30
View File
@@ -321,6 +321,19 @@ class User extends Wxapp
];
$wl_num = $this->mdCustomerVisitData->count_visit(array_merge($where_v, ['b.status<>' => 2]));
//数据统计
$str_uids = $str_userids = '';
if ($group_id == 1) {
$str_uids = $uid;
$str_userids = $this->session['userid'];
} else {
$res_user = $this->app_user_model->select(['biz_id' => $biz_id, 'group_id <' => 4, 'status' => 1], 'id asc', 0, 0, 'id,userid');
foreach ($res_user as $k => $v) {
$str_uids = $str_uids ? $str_uids . ',' . $v['id'] : $v['id'];
$v['userid'] && $str_userids = $str_userids ? $str_userids . "','" . $v['userid'] : $v['userid'];
}
}
!$str_uids && $str_uids = '-1';
!$str_userids && $str_userids = '-1';
$this->load->model('receiver/receiver_customer_oplogs_model', 'mdCustomerOpLogs');
$s_today = date('Y-m-d') . ' 00:00:00';
$e_today = date('Y-m-d') . ' 23:59:59';
@@ -334,41 +347,27 @@ class User extends Wxapp
$where_month_qy = ['change_type' => 'add_external_contact', 'c_time>=' => strtotime($s_month), 'c_time<=' => strtotime($e_month)];
//到店
$where_today_dd = ['biz_id' => $biz_id, 'status>=' => 0, 'cs_biz_id<>' => -1,
"id in(select customer_id from lc_receiver_customer_oplogs where type=4 and c_time>=" . strtotime($s_today) . " and c_time<=" . strtotime($e_today) . ")" => null];
"id in(select customer_id from lc_receiver_customer_oplogs where type=4 and uid in({$str_uids}) and c_time>=" . strtotime($s_today) . " and c_time<=" . strtotime($e_today) . ")" => null];
$where_month_dd = ['biz_id' => $biz_id, 'status>=' => 0, 'cs_biz_id<>' => -1,
"id in(select customer_id from lc_receiver_customer_oplogs where type=4 and c_time>=" . strtotime($s_month) . " and c_time<=" . strtotime($e_month) . ")" => null];
"id in(select customer_id from lc_receiver_customer_oplogs where type=4 and uid in({$str_uids}) and c_time>=" . strtotime($s_month) . " and c_time<=" . strtotime($e_month) . ")" => null];
//订单
$where_today_order = ['status>=' => 0, 'order_time>=' => $s_today, 'order_time<=' => $e_today];
$where_month_order = ['status>=' => 0, 'order_time>=' => $s_month, 'order_time<=' => $e_month];
//战败
$where_today_defeat = ['biz_id' => $biz_id, 'status>=' => 0, 'cs_biz_id<>' => -1,
"id in(select customer_id from lc_receiver_customer_oplogs where type=7 and c_time>=" . strtotime($s_today) . " and c_time<=" . strtotime($e_today) . ")" => null];
"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, 'cs_biz_id<>' => -1,
"id in(select customer_id from lc_receiver_customer_oplogs where type=7 and c_time>=" . strtotime($s_month) . " and c_time<=" . strtotime($e_month) . ")" => null];
"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];
//退订
$where_today_refund = ['status' => 2, 'refund_time>=' => $s_today, 'refund_time<=' => $e_today];
$where_month_refund = ['status' => 2, 'refund_time>=' => $s_month, 'refund_time<=' => $e_month];
if ($group_id == 1) {
$where_today_xs['admin_id'] = $uid;
$where_month_xs['admin_id'] = $uid;
$where_today_dd = ['biz_id' => $biz_id, 'status>=' => 0, 'cs_biz_id<>' => -1,
"id in(select customer_id from lc_receiver_customer_oplogs where type=4 and uid={$uid} and c_time>=" . strtotime($s_today) . " and c_time<=" . strtotime($e_today) . ")" => null];
$where_month_dd = ['biz_id' => $biz_id, 'status>=' => 0, 'cs_biz_id<>' => -1,
"id in(select customer_id from lc_receiver_customer_oplogs where type=4 and uid={$uid} and c_time>=" . strtotime($s_month) . " and c_time<=" . strtotime($e_month) . ")" => null];
$where_today_order['admin_id'] = $uid;
$where_month_order['admin_id'] = $uid;
$where_today_defeat = ['biz_id' => $biz_id, 'status>=' => 0, 'cs_biz_id<>' => -1,
"id in(select customer_id from lc_receiver_customer_oplogs where type=7 and uid={$uid} and c_time>=" . strtotime($s_today) . " and c_time<=" . strtotime($e_today) . ")" => null];
$where_month_defeat = ['biz_id' => $biz_id, 'status>=' => 0, 'cs_biz_id<>' => -1,
"id in(select customer_id from lc_receiver_customer_oplogs where type=7 and uid={$uid} and c_time>=" . strtotime($s_month) . " and c_time<=" . strtotime($e_month) . ")" => null];
$where_today_refund['admin_id'] = $uid;
$where_month_refund['admin_id'] = $uid;
if ($this->session['userid']) {
$where_today_qy['userid'] = $this->session['userid'];
$where_month_qy['userid'] = $this->session['userid'];
} else {
$where_today_qy = '';
}
} else if ($group_id == 2 || $group_id == 3) {//店长/老板
$where_today_order["(biz_id = {$biz_id} OR admin_id = {$uid})"] = null;
$where_month_order["(biz_id = {$biz_id} OR admin_id = {$uid})"] = null;
@@ -386,18 +385,10 @@ class User extends Wxapp
$where_month_refund['brand_id<>'] = 3;
}
}
if ($group_id != 1) {
$res_user = $this->app_user_model->select(['biz_id' => $biz_id, 'group_id <' => 4, 'status' => 1, 'userid<>' => ''], 'id asc', 0, 0, 'userid');
if ($res_user) {
$str_userids = implode("','", array_column($res_user, 'userid'));
$where_today_qy["userid in('{$str_userids}')"] = null;
$where_month_qy["userid in('{$str_userids}')"] = null;
} else {
$where_today_qy = '';
}
}
$today_qy = $month_qy = 0;
if ($where_today_qy) {
if ($str_userids) {
$where_today_qy["userid in('{$str_userids}')"] = null;
$where_month_qy["userid in('{$str_userids}')"] = null;
$re_biz = $this->biz_model->get(['id' => $biz_id]);
if ($re_biz['type'] == 5) {//异业店
$this->load->model('app/app_different_qy_log_model', 'mdDifferentQyLog');
@@ -432,7 +423,8 @@ class User extends Wxapp
'customer_op_list' => $customer_op_list,
'levelSt' => $levelSt,
'where_today_qy' => $where_today_qy,
'statistics' => $statistics
'statistics' => $statistics,
'str_uids' => $str_uids
];
return $data;
}