api_customer_210
This commit is contained in:
@@ -535,11 +535,23 @@ class Customers extends Wxapp
|
||||
$cfrom = $this->customers_model->get_sdata();
|
||||
$follow_channel = $this->customers_model->get_sdata('follow_channel');
|
||||
$buy_time = $this->customers_model->get_sdata('btime');
|
||||
$show_btime = [];
|
||||
$show_btime = $tags = [];
|
||||
foreach ($buy_time as $key => $val) {
|
||||
$show_btime[] = ['id' => $key, 'name' => $val];
|
||||
}
|
||||
$res_tag = $this->mdCustomerTag->select(['status' => 1, 'pid' => 0, 'show<>' => 1, 'tag_type' => 0], 'sort desc,id desc', 0, 0, 'id,name,type');
|
||||
if ($res_tag) {
|
||||
foreach ($res_tag as $key => $val) {
|
||||
$list = [];
|
||||
$res2 = $this->mdCustomerTag->select(['status' => 1, 'pid' => $val['id']], 'sort desc,id desc', 0, 0, 'id,name');
|
||||
foreach ($res2 as $key2 => $val2) {
|
||||
$list[] = ['id' => $val2['id'], 'name' => $val2['name'], 'checked' => false];
|
||||
}
|
||||
$tags[] = ['id' => $val['id'], 'name' => $val['name'], 'type' => $val['type'], 'list' => $list];
|
||||
}
|
||||
}
|
||||
$data = [
|
||||
'tags' => $tags,
|
||||
'level' => $level,
|
||||
'cfrom' => $cfrom,
|
||||
'buy_time' => $show_btime,
|
||||
@@ -610,6 +622,7 @@ class Customers extends Wxapp
|
||||
$e_visit_time = $this->input_param('e_visit_time');//回访结束时间
|
||||
$status_tp = intval($this->input_param('status_tp')); //状态类型
|
||||
$admin_ids = $this->input_param('admin_ids');//多选销售人员
|
||||
$tag_ids = $this->input_param('tag_ids');//多选客户画像
|
||||
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 10;
|
||||
@@ -679,6 +692,37 @@ class Customers extends Wxapp
|
||||
$cfrom && $where['cf_title'] = $cfrom;
|
||||
$name && $where["name like '%{$name}%'"] = null;
|
||||
$mobile && $where["mobile like '%$mobile%'"] = null;
|
||||
if ($tag_ids) {
|
||||
$pidAry = [];
|
||||
$res_tag = $this->mdCustomerTag->select(["id in ({$tag_ids})" => null], 'id desc', 0, 0, 'pid,id');
|
||||
foreach ($res_tag as $v) {
|
||||
$v['pid'] && $pidAry[$v['pid']][] = $v['id'];
|
||||
}
|
||||
$str_c_ids = $res_tag_data = '';
|
||||
foreach ($pidAry as $v) {
|
||||
if ($v) {
|
||||
$where_tag = [];
|
||||
$str_ids = implode(',', $v);
|
||||
$where_tag["t_id in({$str_ids})"] = null;
|
||||
if ($str_c_ids) {
|
||||
$where_tag["c_id in({$str_c_ids})"] = null;
|
||||
}
|
||||
$res_tag_data = $this->mdCustomerTagdata->select_groupby('c_id', $where_tag, "id desc", 0, 0, "c_id");
|
||||
if (!$res_tag_data) {
|
||||
break;
|
||||
}
|
||||
if ($res_tag_data) {
|
||||
$str_c_ids = implode(',', array_column($res_tag_data, 'c_id'));
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($res_tag_data) {
|
||||
$str_cids = implode(',', array_column($res_tag_data, 'c_id'));
|
||||
$where["id in({$str_cids})"] = null;
|
||||
} else {
|
||||
$where["id"] = -1;
|
||||
}
|
||||
}
|
||||
$count = $this->customers_model->count($where);
|
||||
$lists = [];
|
||||
if ($count) {
|
||||
|
||||
Reference in New Issue
Block a user