customer defeat only support one tag
This commit is contained in:
@@ -116,6 +116,7 @@ class Customers extends Wxapp
|
||||
$type = $this->input_param('type');
|
||||
$tag_type = $this->input_param('tag_type');
|
||||
!strlen($tag_type) && $tag_type = 0;
|
||||
$tag_id = 0; # 230312, $tag_type=1时首个select中tag的id
|
||||
$tags = $res_td = $re_cus = [];
|
||||
$re_biz = $this->get_biz();
|
||||
$city_id = intval($re_biz['city_id']);
|
||||
@@ -148,6 +149,8 @@ class Customers extends Wxapp
|
||||
$res_td = $this->mdCustomerTagdata->select(['c_id' => $id], 'id desc', 0, 0, 't_id');
|
||||
}
|
||||
$tag_data = $res_td ? array_unique(array_column($res_td, 't_id')) : '';
|
||||
$tag_checked = array();
|
||||
$tag_checked_id = 0;
|
||||
foreach ($res as $key => $val) {
|
||||
$list = [];
|
||||
$res2 = $this->mdCustomerTag->select(['status' => 1, 'pid' => $val['id']], 'sort desc,id desc', 0, 0, 'id,name');
|
||||
@@ -155,12 +158,17 @@ class Customers extends Wxapp
|
||||
//检查是否选中标签
|
||||
$checked = $tag_data && in_array($val2['id'], $tag_data) ? true : false;
|
||||
$list[] = ['id' => $val2['id'], 'name' => $val2['name'], 'checked' => $checked];
|
||||
$tag_type == 1 && $checked && $tag_checked[] = $val2['id'];
|
||||
$tag_type == 1 && $checked && !$tag_checked_id && $tag_checked_id = $val['id'];
|
||||
}
|
||||
$tags[] = ['id' => $val['id'], 'name' => $val['name'], 'type' => $val['type'], 'list' => $list];
|
||||
}
|
||||
$tag_type == 1 && count($tag_checked) == 1 && $tag_id = $tag_checked_id;
|
||||
}
|
||||
}
|
||||
return ['tags' => $tags, 'city_id' => $city_id, 'county_id' => $county_id];
|
||||
$res = ['tags' => $tags, 'city_id' => $city_id, 'county_id' => $county_id];
|
||||
$tag_type == 1 && $res['tag_id'] = $tag_id;
|
||||
return $res;
|
||||
}
|
||||
|
||||
//修改基本信息
|
||||
|
||||
Reference in New Issue
Block a user