From 79cd5336c5f3de23875b4e0c2326e11f96fe0eb5 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Mon, 18 Aug 2025 10:27:24 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=97=A0=E6=95=88=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E4=B8=BE=E6=8A=A5=E5=9B=BE=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/model/CustomerAudit.php | 49 +++++++++++++++++++ app/crm/controller/CustomerController.php | 3 ++ app/crm/service/CustomerService.php | 9 ++++ .../controller/CustomerController.php | 2 +- app/crmAdmin/logic/CustomerLogic.php | 1 + app/crmAdmin/service/CustomerService.php | 10 ++++ 6 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 app/common/model/CustomerAudit.php diff --git a/app/common/model/CustomerAudit.php b/app/common/model/CustomerAudit.php new file mode 100644 index 0000000..4e52267 --- /dev/null +++ b/app/common/model/CustomerAudit.php @@ -0,0 +1,49 @@ +error(trans('id_empty')); } + if (empty($param['remark']) && empty($param['img'])) { + return $this->error('举报理由不能为空'); + } $param['user_id'] = $request->user->uid; $param['corp_abbr'] = $request->basic_data['corp_abbr']; diff --git a/app/crm/service/CustomerService.php b/app/crm/service/CustomerService.php index 0573972..b7654f0 100644 --- a/app/crm/service/CustomerService.php +++ b/app/crm/service/CustomerService.php @@ -3,6 +3,7 @@ namespace app\crm\service; use app\common\model\Corp; +use app\common\model\CustomerAudit; use app\common\model\User; use app\common\traits\crud\CrudServiceTrait; use app\crm\logic\CustomerLogic; @@ -195,6 +196,14 @@ class CustomerService return false; } + CustomerAudit::create([ + 'customer_id' => $id, + 'report_user_id' => $userId, + 'remark' => $params['remark'], + 'status' => 1, + 'img' => implode(',', $params['img']), + ]); + CustomerHis::create([ 'customer_id' => $id, 'user_his' => $userId, diff --git a/app/crmAdmin/controller/CustomerController.php b/app/crmAdmin/controller/CustomerController.php index a3dc0e2..a214a2c 100644 --- a/app/crmAdmin/controller/CustomerController.php +++ b/app/crmAdmin/controller/CustomerController.php @@ -85,7 +85,7 @@ class CustomerController extends BaseController } /** - * 客户列表 + * 审核客户 * @param Request $request * @return \support\Response */ diff --git a/app/crmAdmin/logic/CustomerLogic.php b/app/crmAdmin/logic/CustomerLogic.php index 83ba426..13efe9c 100644 --- a/app/crmAdmin/logic/CustomerLogic.php +++ b/app/crmAdmin/logic/CustomerLogic.php @@ -17,6 +17,7 @@ class CustomerLogic $customer->restore(); } + return $res; } diff --git a/app/crmAdmin/service/CustomerService.php b/app/crmAdmin/service/CustomerService.php index 074f341..a79481a 100644 --- a/app/crmAdmin/service/CustomerService.php +++ b/app/crmAdmin/service/CustomerService.php @@ -2,6 +2,7 @@ namespace app\crmAdmin\service; +use app\common\model\CustomerAudit; use app\common\model\InquiryLog; use app\common\model\User; use app\common\service\OssService; @@ -139,6 +140,10 @@ class CustomerService if ($scene == 'audit') { //审核时查询举报人姓名 $customerHis = CustomerHis::where('customer_id', $item->id)->orderBy('id', 'desc')->first(['user_his']); $item['user_name'] = empty($customerHis['user_his']) ? '' : User::where('id',$customerHis['user_his'])->value('name'); + $item['audit'] = CustomerAudit::where('customer_id', $item->id)->orderBy('id', 'desc')->first(); + if (!empty($item['audit'])&&!empty($item['audit']['img'])) { + $item['audit']['img'] = explode(',', $item['audit']['img']); + } } } } @@ -287,9 +292,14 @@ class CustomerService $id = $params['id']; $logic = new CustomerLogic(); + $audit = CustomerAudit::where('customer_id', $id)->orderBy('id', 'desc')->first(); if ($params['scene'] == 'delete') { + $audit->status = 3; + $audit->save(); return $logic->forceDelete($params['id']); } else { + $audit->status = 2; + $audit->save(); return $logic->status($params['id'], 1); } } From a4fd38ac2391f0c2ab00011019d9c4fb27f3371f Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Mon, 18 Aug 2025 18:06:36 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=B8=BE=E6=8A=A5=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E8=A1=A5=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/crmAdmin/service/CustomerService.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/crmAdmin/service/CustomerService.php b/app/crmAdmin/service/CustomerService.php index a79481a..5d3a816 100644 --- a/app/crmAdmin/service/CustomerService.php +++ b/app/crmAdmin/service/CustomerService.php @@ -144,6 +144,11 @@ class CustomerService if (!empty($item['audit'])&&!empty($item['audit']['img'])) { $item['audit']['img'] = explode(',', $item['audit']['img']); } + + $ossservice = new OssService(); + foreach ($item['audit']['img'] as $k => $img) { + $item['audit']['img'][$k] = $ossservice->generatePrivateUrl($img); + } } } } From 1152c1a7f95d2005f29d24bf27e2ba99bd5b6efd Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Tue, 19 Aug 2025 14:17:34 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/crmAdmin/service/CustomerService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/crmAdmin/service/CustomerService.php b/app/crmAdmin/service/CustomerService.php index 5d3a816..4d3f6b1 100644 --- a/app/crmAdmin/service/CustomerService.php +++ b/app/crmAdmin/service/CustomerService.php @@ -140,7 +140,8 @@ class CustomerService if ($scene == 'audit') { //审核时查询举报人姓名 $customerHis = CustomerHis::where('customer_id', $item->id)->orderBy('id', 'desc')->first(['user_his']); $item['user_name'] = empty($customerHis['user_his']) ? '' : User::where('id',$customerHis['user_his'])->value('name'); - $item['audit'] = CustomerAudit::where('customer_id', $item->id)->orderBy('id', 'desc')->first(); + $audit = CustomerAudit::where('customer_id', $item->id)->orderBy('id', 'desc')->first(); + $item['audit'] = $audit?$audit->toArray():''; if (!empty($item['audit'])&&!empty($item['audit']['img'])) { $item['audit']['img'] = explode(',', $item['audit']['img']); } From e1796100d6664c76a7a89866929e0ee2568a854f Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Tue, 19 Aug 2025 14:24:01 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/crmAdmin/service/CustomerService.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/crmAdmin/service/CustomerService.php b/app/crmAdmin/service/CustomerService.php index 4d3f6b1..21d543a 100644 --- a/app/crmAdmin/service/CustomerService.php +++ b/app/crmAdmin/service/CustomerService.php @@ -140,15 +140,14 @@ class CustomerService if ($scene == 'audit') { //审核时查询举报人姓名 $customerHis = CustomerHis::where('customer_id', $item->id)->orderBy('id', 'desc')->first(['user_his']); $item['user_name'] = empty($customerHis['user_his']) ? '' : User::where('id',$customerHis['user_his'])->value('name'); - $audit = CustomerAudit::where('customer_id', $item->id)->orderBy('id', 'desc')->first(); - $item['audit'] = $audit?$audit->toArray():''; + $item['audit'] = CustomerAudit::where('customer_id', $item->id)->orderBy('id', 'desc')->first(); if (!empty($item['audit'])&&!empty($item['audit']['img'])) { $item['audit']['img'] = explode(',', $item['audit']['img']); - } - $ossservice = new OssService(); - foreach ($item['audit']['img'] as $k => $img) { - $item['audit']['img'][$k] = $ossservice->generatePrivateUrl($img); + $ossservice = new OssService(); + foreach ($item['audit']['img'] as $k => $img) { + $item['audit']['img'][$k] = $ossservice->generatePrivateUrl($img); + } } } } From db1ac82412a7e0ebc3eed9114e6d37f619b5d47c Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Tue, 19 Aug 2025 14:26:26 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/crmAdmin/service/CustomerService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/crmAdmin/service/CustomerService.php b/app/crmAdmin/service/CustomerService.php index 21d543a..8dbd794 100644 --- a/app/crmAdmin/service/CustomerService.php +++ b/app/crmAdmin/service/CustomerService.php @@ -142,6 +142,7 @@ class CustomerService $item['user_name'] = empty($customerHis['user_his']) ? '' : User::where('id',$customerHis['user_his'])->value('name'); $item['audit'] = CustomerAudit::where('customer_id', $item->id)->orderBy('id', 'desc')->first(); if (!empty($item['audit'])&&!empty($item['audit']['img'])) { + $item['audit'] = $item['audit']?$item['audit']->toArray():''; $item['audit']['img'] = explode(',', $item['audit']['img']); $ossservice = new OssService(); From 960ba9346c493579b694f6645036e1ad18098657 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Tue, 19 Aug 2025 14:36:52 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/crmAdmin/service/CustomerService.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/crmAdmin/service/CustomerService.php b/app/crmAdmin/service/CustomerService.php index 8dbd794..ba74841 100644 --- a/app/crmAdmin/service/CustomerService.php +++ b/app/crmAdmin/service/CustomerService.php @@ -140,16 +140,17 @@ class CustomerService if ($scene == 'audit') { //审核时查询举报人姓名 $customerHis = CustomerHis::where('customer_id', $item->id)->orderBy('id', 'desc')->first(['user_his']); $item['user_name'] = empty($customerHis['user_his']) ? '' : User::where('id',$customerHis['user_his'])->value('name'); - $item['audit'] = CustomerAudit::where('customer_id', $item->id)->orderBy('id', 'desc')->first(); - if (!empty($item['audit'])&&!empty($item['audit']['img'])) { - $item['audit'] = $item['audit']?$item['audit']->toArray():''; - $item['audit']['img'] = explode(',', $item['audit']['img']); + $audit = CustomerAudit::where('customer_id', $item->id)->orderBy('id', 'desc')->first(); + if (!empty($audit)&&!empty($audit['img'])) { + $audit = $audit?$audit->toArray():''; + $audit['img'] = explode(',', $audit['img']); $ossservice = new OssService(); - foreach ($item['audit']['img'] as $k => $img) { - $item['audit']['img'][$k] = $ossservice->generatePrivateUrl($img); + foreach ($audit['img'] as $k => $img) { + $audit['img'][$k] = $ossservice->generatePrivateUrl($img); } } + $item['audit'] = $audit; } } }