tag add tag_type=2 about

This commit is contained in:
qianhy
2023-03-13 14:12:44 +08:00
committed by lccsw
parent 12314498ce
commit a879ff4d4f
4 changed files with 42 additions and 8 deletions
+25 -1
View File
@@ -110,12 +110,28 @@ class Customers extends Wxapp
return $data;
}
# tag_type=2意向标签的类型:1到店意向 2 购买意向
private function get_tag_type2_pid($tag_type2=null){
$arr = array(1=>120, 2=>121);
if (!$tag_type2){
return $arr;
}
if(!in_array($tag_type2, array_keys($arr))){
$tag_type2 = 1;
}
return $arr[$tag_type2];
}
protected function get_tag()
{
$id = intval($this->input_param('id'));
$type = $this->input_param('type');
$tag_type = $this->input_param('tag_type');
!strlen($tag_type) && $tag_type = 0;
$tag_type2 = $this->input_param('tag_type2');
#$tag_type == 1 && $tag_type = 2; # 手工测试tag_type=2用
$tag_type == 2 && !$tag_type2 && $tag_type2 = 1;
$tag_type2_pid = $tag_type == 2 ? $this->get_tag_type2_pid($tag_type2) : 0;
$tag_id = 0; # 230312, $tag_type=1时首个select中tag的id
$tags = $res_td = $re_cus = [];
$re_biz = $this->get_biz();
@@ -143,7 +159,9 @@ class Customers extends Wxapp
}
}
} else {
$res = $this->mdCustomerTag->select(['status' => 1, 'pid' => 0, 'show<>' => 1, 'tag_type' => $tag_type], 'sort desc,id desc', 0, 0, 'id,name,type');
$where = ['status' => 1, 'pid' => 0, 'show<>' => 1, 'tag_type' => $tag_type];
$tag_type2_pid && $where['id'] = $tag_type2_pid;
$res = $this->mdCustomerTag->select($where, 'sort desc,id desc', 0, 0, 'id,name,type');
if ($res) {
if ($id) {
$res_td = $this->mdCustomerTagdata->select(['c_id' => $id], 'id desc', 0, 0, 't_id');
@@ -388,6 +406,8 @@ class Customers extends Wxapp
$follow_channel = $this->input_param('follow_channel');//跟进渠道
$visit_time = $this->input_param('visit_time');//计划回访时间
$invalid_tag = $this->input_param('invalid_tag'); //战败标签
$daodian_tag = $this->input_param('daodian_tag'); //意向标签-到店
$goumai_tag = $this->input_param('goumai_tag'); //意向标签-购买
$row = $this->customers_model->get(['id' => $id]);
if (!$row) {
throw new Exception('数据不存在!', ERR_PARAMS_ERROR);
@@ -521,6 +541,10 @@ class Customers extends Wxapp
}
if ($result) {
//战败标签
//意向标签 合并到 战败标签 统一处理
!$invalid_tag && $invalid_tag = array();
$daodian_tag && $invalid_tag = array_merge($invalid_tag, $daodian_tag);
$goumai_tag && $invalid_tag = array_merge($invalid_tag, $goumai_tag);
if ($invalid_tag) {
$add_tag = [];
//查找已加入标签