From 62b6efb3d2bea74dfd113277fffea042510251fb Mon Sep 17 00:00:00 2001 From: qianhy Date: Mon, 13 Mar 2023 14:12:44 +0800 Subject: [PATCH] tag add tag_type=2 about --- admin/controllers/receiver/OwnersTag.php | 3 ++- admin/controllers/receiver/Tag.php | 13 +++++++---- admin/views/receiver/tag/lists.php | 8 +++++-- api/controllers/wxapp/licheb/Customers.php | 26 +++++++++++++++++++++- 4 files changed, 42 insertions(+), 8 deletions(-) diff --git a/admin/controllers/receiver/OwnersTag.php b/admin/controllers/receiver/OwnersTag.php index adcbf72f..6dcfbbeb 100644 --- a/admin/controllers/receiver/OwnersTag.php +++ b/admin/controllers/receiver/OwnersTag.php @@ -7,7 +7,8 @@ class OwnersTag extends HD_Controller private $tabAry = [ 1 => ['title' => '客户标签', 'url' => '/receiver/tag'], 2 => ['title' => '车主标签', 'url' => '/receiver/ownersTag'], - 3 => ['title' => '战败标签', 'url' => '/receiver/tag?tag_type=1'] + 3 => ['title' => '战败标签', 'url' => '/receiver/tag?tag_type=1'], + 4 => ['title' => '意向标签', 'url' => '/receiver/tag?tag_type=2'] ]; public function __construct() diff --git a/admin/controllers/receiver/Tag.php b/admin/controllers/receiver/Tag.php index d11947dc..dd0ce3e1 100644 --- a/admin/controllers/receiver/Tag.php +++ b/admin/controllers/receiver/Tag.php @@ -7,7 +7,8 @@ class Tag extends HD_Controller private $tabAry = [ 1 => ['title' => '客户标签', 'url' => '/receiver/tag'], 2 => ['title' => '车主标签', 'url' => '/receiver/ownersTag'], - 3 => ['title' => '战败标签', 'url' => '/receiver/tag?tag_type=1'] + 3 => ['title' => '战败标签', 'url' => '/receiver/tag?tag_type=1'], + 4 => ['title' => '意向标签', 'url' => '/receiver/tag?tag_type=2'] ]; public function __construct() @@ -28,13 +29,14 @@ class Tag extends HD_Controller $params = $this->input->get(); $params['page'] = $params['page'] ? intval($params['page']) : 1; $params['size'] = $params['size'] ? intval($params['size']) : 20; - $params['tab'] = $params['tag_type'] ? 3 : 1; + #$params['tab'] = $params['tag_type'] ? 3 : 1; + $params['tab'] = $params['tag_type'] ? $params['tag_type'] + 2 : 1; $statusAry = $this->mdCustomerTag->statusAry(); $typeAry = $this->mdCustomerTag->typeAry(); $showAry = $this->mdCustomerTag->showAry(); $lists = array(); $where = ["status<>-1" => null, 'pid' => 0]; - $where['tag_type'] = $params['tag_type'] ? 1 : 0; + $where['tag_type'] = $params['tag_type'] ? $params['tag_type'] : 0; if (strlen($params['status'])) { $where['status'] = $params['status']; } @@ -126,7 +128,7 @@ class Tag extends HD_Controller 'type' => $params['type'], 'show' => $params['show'] ]; - $params['tag_type'] && $add_data['tag_type'] = 1; + $params['tag_type'] && $add_data['tag_type'] = $params['tag_type']; $id = $this->mdCustomerTag->add($add_data); if (!$id) { return $this->show_json(SYS_CODE_FAIL, '保存失败'); @@ -170,6 +172,9 @@ class Tag extends HD_Controller if (!$re) { return $this->show_json(SYS_CODE_FAIL, '标签不存在!'); } + if ($re['tag_type'] == 2) { + return $this->show_json(SYS_CODE_FAIL, '该标签不能删除!'); + } $this->mdCustomerTag->update(['status' => '-1'], ['id' => $id]); if (false !== strpos($_SERVER['HTTP_HOST'], 'admin.liche.cn') && $re['qy_id']) {//正试才能修改企业标签 $this->load->library('wx_qyapi', ['app' => 'lichene']); diff --git a/admin/views/receiver/tag/lists.php b/admin/views/receiver/tag/lists.php index 60757d8e..fa8336aa 100644 --- a/admin/views/receiver/tag/lists.php +++ b/admin/views/receiver/tag/lists.php @@ -55,12 +55,14 @@
+
+ @@ -94,19 +96,21 @@ class="am-btn am-btn-primary am-btn-xs">编辑选项 编辑标签 - + 关闭 - + 开启 + 删除 + 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 = []; //查找已加入标签