From 825e03a128544829267cb8cdfb88d07382edd3c6 Mon Sep 17 00:00:00 2001 From: wanqi <1985087876@qq.com> Date: Sat, 29 Jan 2022 18:21:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=9D=9E=E4=BC=81=E5=BE=AE?= =?UTF-8?q?=E5=AE=A2=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/v1/EnterCustomer.php | 43 +++++++++++++++++++++++ app/admin/model/EnterCustomer.php | 25 +++++++++++++ app/admin/model/WxkCustomer.php | 4 +-- composer.json | 3 +- 4 files changed, 72 insertions(+), 3 deletions(-) diff --git a/app/admin/controller/v1/EnterCustomer.php b/app/admin/controller/v1/EnterCustomer.php index 9bc3db7..3d20cba 100644 --- a/app/admin/controller/v1/EnterCustomer.php +++ b/app/admin/controller/v1/EnterCustomer.php @@ -17,6 +17,49 @@ class EnterCustomer extends BasicController parent::__construct($app); } + /** + * 非企微客户跟进记录列表 + * User: 万奇 + * Date: 2021/3/25 0025 + * @throws \think\db\exception\DbException + */ + public function enter_customer_follow_list(){ + param_receive(['external_user_id', 'follow_userid', 'page', 'limit']); + + $result = (new \app\admin\model\WxkCustomerFollow())->get_customer_follow_list($this->param); + + response(200, '', $result['data'], $result['total']); + } + + /** + * 添加非企微客户跟进 + * User: 万奇 + * Date: 2021/3/23 0023 + * @throws \think\db\exception\DbException + */ + public function add_enter_customer_follow(){ + param_receive(['external_user_id', 'follow_userid', 'add_follow_user', 'follow_type', 'content']); + + $this->param['not_qw'] = 1; + (new \app\admin\model\WxkCustomerFollow())->add_customer_follow($this->param, 1); + + response(200, '操作成功'); + } + + /** + * 修改非企微客户详情 + * User: 万奇 + * Date: 2021/7/13 16:56 + * @throws \think\db\exception\DbException + */ + public function edit_enter_customer_info(){ + param_receive(['external_user_id']); + + (new \app\admin\model\EnterCustomer())->edit_enter_customer_info($this->param, $this->user_info['user_id']); + + response(200, '操作成功'); + } + /** * 非企微客户详情 * User: 万奇 diff --git a/app/admin/model/EnterCustomer.php b/app/admin/model/EnterCustomer.php index 0861edb..6d9c0fd 100644 --- a/app/admin/model/EnterCustomer.php +++ b/app/admin/model/EnterCustomer.php @@ -17,6 +17,31 @@ class EnterCustomer extends BasicModel parent::__construct($data); } + /** + * 修改客户详情 + * User: 万奇 + * Date: 2021/7/13 16:56 + * @param $param + * @param $add_user - 操作人 user_id + * @param $user_type 1-系统人员 2-企业成员 + * @throws \think\db\exception\DbException + */ + public function edit_enter_customer_info($param, $add_user, $user_type = 1){ + if (isset($param['follow_remark_mobiles'])){ + $reg_phone = reg_phone($param['follow_remark_mobiles']); + if (!$reg_phone){ + response(500, '手机号码格式不正确'); + } + } + + // 客户互动轨迹 + $param['not_qw'] = 1; + (new \app\admin\model\WxkCustomer())->edit_customer_action_log($param, $add_user, $user_type); + + $this->where(['id' => $param['external_user_id']])->update($param); + Db::name('wxk_customer_portrait')->where(['external_user_id' => $param['external_user_id'], 'corp_id' => $param['corp_id']])->update($param); + } + /** * 非企微客户详情 * User: 万奇 diff --git a/app/admin/model/WxkCustomer.php b/app/admin/model/WxkCustomer.php index da96d1d..e0426f5 100644 --- a/app/admin/model/WxkCustomer.php +++ b/app/admin/model/WxkCustomer.php @@ -167,8 +167,8 @@ class WxkCustomer extends BasicModel $result = $this->repeat_list_customer(['id' => $param['id'],'limit' => 1])['data'][0]; $portrait = Db::name('wxk_customer_portrait')->field('intention,area')->where(['id' => $result['external_user_id']])->find(); - $result['intention']= $portrait['intention']; - $result['area'] = $portrait['area']; + $result['intention']= isset($portrait['intention']) ? $portrait['intention'] : ''; + $result['area'] = isset($portrait['area']) ? $portrait['area'] : ''; // $result['group'] = Db::name('wxk_customer_group_member')->alias('a') // ->join('wxk_customer_group b', 'a.group_id=b.id','left') // ->where(['a.user_id' => $result['external_user_id']]) diff --git a/composer.json b/composer.json index 7bd8215..6f55654 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,8 @@ "topthink/framework": "^6.0.0", "topthink/think-orm": "^2.0", "topthink/think-multi-app": "^1.0", - "alibabacloud/client": "^1.5" + "alibabacloud/client": "^1.5", + "ext-json": "*" }, "require-dev": { "symfony/var-dumper": "^4.2", -- Gitee