diff --git a/home/controllers/h5/Lichene.php b/home/controllers/h5/Lichene.php index 3e034a30..b951b191 100644 --- a/home/controllers/h5/Lichene.php +++ b/home/controllers/h5/Lichene.php @@ -260,6 +260,37 @@ class Lichene extends CI_Controller $this->mdCustomerTagdata->add_batch($add_tag); } } + if (!$re_cus) {//新增客户 更新企微信息 + $this->load->library('wx_qyapi', ['app' => 'lichene']); + $remark_mobiles = $userInfo['mobile'] ? [$userInfo['mobile']] : ''; + $description = $params['of_title'] ? $params['of_title'] : ''; + if ($description && $params['of2_title']) { + $description .= '-' . $params['of2_title']; + } + //企微备注操作 + $this->wx_qyapi->get_external_contact(['url' => 'remark', 'userid' => $userInfo['userid'] + , 'external_userid' => $userInfo['external_userid'], 'remark_mobiles' => $remark_mobiles, 'description' => $description]); + $tags_name = $userInfo['tags_name']; + $add_tag = $remove_tag = ''; + if ($params['taglList']) { + foreach ($params['taglList'] as $key => $val) { + foreach ($val['list'] as $key2 => $val2) { + if ($val2['checked'] == 'true') { + if (!$tags_name || !in_array($val2['name'], $tags_name)) {//未加标签,新增 + $add_tag[] = $val2['qy_id']; + } + } else { + if ($tags_name && in_array($val2['name'], $tags_name)) {//删除标签 + $remove_tag[] = $val2['qy_id']; + } + } + } + } + } + //企微标签操作 + $this->wx_qyapi->get_external_contact(['url' => 'mark_tag', 'userid' => $userInfo['userid'], + 'external_userid' => $userInfo['external_userid'], 'add_tag' => $add_tag, 'remove_tag' => $remove_tag]); + } $this->show_json(200, '操作成功'); } diff --git a/home/views/h5/lichene/index.php b/home/views/h5/lichene/index.php index bb0e3c7f..629b139f 100644 --- a/home/views/h5/lichene/index.php +++ b/home/views/h5/lichene/index.php @@ -165,6 +165,8 @@ mDialog.msg({content: "请输入手机号"}); return } + var of_title = that.of_id ? $("#id-of_id").find("option:selected").text() : ''; + var of2_title = that.of2_id ? $("#id-of2_id").find("option:selected").text() : ''; $.ajax({ url: '/h5/lichene/post_to_biz', type: 'post', @@ -174,6 +176,8 @@ taglList: that.taglList, of_id: that.of_id, of2_id: that.of2_id, + of_title: of_title, + of2_title: of2_title, }, beforeSend: function () { loading = mDialog.load({shade: false, text: "",});