From 11209c649cf639c9eba51ceeb0133cce0f670645 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Fri, 8 Aug 2025 09:38:02 +0800 Subject: [PATCH 01/18] =?UTF-8?q?=E5=B7=A5=E5=8D=95=E9=99=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ticket/service/ConversationService.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/ticket/service/ConversationService.php b/app/ticket/service/ConversationService.php index 1716b8f..80e871c 100644 --- a/app/ticket/service/ConversationService.php +++ b/app/ticket/service/ConversationService.php @@ -2,6 +2,7 @@ namespace app\ticket\service; +use app\common\service\OssService; use app\ticket\logic\ConversationLogic; use config\constants\Constants; use support\Db; @@ -19,8 +20,13 @@ class ConversationService $result = (new ConversationLogic())->list($params); $status_fanyi = array_map(fn($v) => "{{{$v}}}", array_flip(Constants::TICKET_STATUS)); + $ossservice = new OssService(); foreach ($result as $key => $value) { $result[$key]['content'] = str_replace($status_fanyi,$ticket_status,$value['content']); + $result[$key]['attachment'] = explode(",", $value['attachment']); + foreach ($result[$key]['attachment'] as $k => $attachment) { + $result[$key]['attachment_full'][$k] = (!empty($attachment))?$ossservice->generatePrivateUrl($attachment):''; + } } return $result; } @@ -28,6 +34,7 @@ class ConversationService public function add(array $data) { try { + $data['attachment'] = implode(",", $data['attachment']); return (new ConversationLogic())->add($data); } catch (\Throwable $e) { throw $e; @@ -38,6 +45,7 @@ class ConversationService { try { Db::beginTransaction(); + $data['attachment'] = implode(",", $data['attachment']); $result = (new ConversationLogic())->edit($data); Db::commit(); return $result; From b3f398111209be591154ecf96a0f62072363a2fa Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Fri, 8 Aug 2025 14:12:31 +0800 Subject: [PATCH 02/18] =?UTF-8?q?=E5=B7=A5=E5=8D=95=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ticket/service/TicketService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/ticket/service/TicketService.php b/app/ticket/service/TicketService.php index e225dec..7f74902 100644 --- a/app/ticket/service/TicketService.php +++ b/app/ticket/service/TicketService.php @@ -45,9 +45,10 @@ class TicketService (new AttachmentLogic())->adds($attachment, $result->id, $data['user_id']); } + $cleanContent = trim(preg_replace('/\s+/', ' ', strip_tags($data['content'] ?? ''))); $conversation = [ 'ticket_id' => $result->id, - 'content' => $data['content'], + 'content' => $cleanContent, 'user_id' => $data['user_id'], ]; (new ConversationService())->add($conversation); From 859fd1cff1476c50869faf670ce3533379a68ccf Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Fri, 8 Aug 2025 15:52:13 +0800 Subject: [PATCH 03/18] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=B8=8B=E5=B1=9E?= =?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/crm/controller/BaseController.php | 6 ++- app/crm/controller/CustomerController.php | 31 ++++++++++++++ app/crm/service/CustomerService.php | 51 +++++++++++++++++++++++ app/crmAdmin/service/CustomerService.php | 1 - config/route.php | 1 + 5 files changed, 88 insertions(+), 2 deletions(-) diff --git a/app/crm/controller/BaseController.php b/app/crm/controller/BaseController.php index 1b824e0..91f0e95 100644 --- a/app/crm/controller/BaseController.php +++ b/app/crm/controller/BaseController.php @@ -2,6 +2,7 @@ namespace app\crm\controller; +use app\common\traits\DataTransformer; use support\Request; use support\Response; use support\exception\BusinessException; @@ -10,7 +11,10 @@ use think\Validate; abstract class BaseController { - use ResponseTrait; + /** + * 响应处理、数据格式化处理 + */ + use ResponseTrait, DataTransformer; protected mixed $validator = null; diff --git a/app/crm/controller/CustomerController.php b/app/crm/controller/CustomerController.php index 2efbceb..4478233 100644 --- a/app/crm/controller/CustomerController.php +++ b/app/crm/controller/CustomerController.php @@ -5,6 +5,7 @@ namespace app\crm\controller; use app\common\model\Corp; use app\common\model\InquiryLog; use app\common\model\User; +use app\common\traits\crud\CrudControllerTrait; use app\crm\model\Channel; use app\crm\model\Country; use app\crm\model\Customer; @@ -18,6 +19,7 @@ use support\Request; class CustomerController extends BaseController { + use CrudControllerTrait; /** * 不需要头信息的方法 @@ -26,6 +28,35 @@ class CustomerController extends BaseController protected $noNeedLogin = ['getChannel', 'getCountry']; + protected $service; + + public function __construct() + { + $this->service = new CustomerService(); + } + + /** + * 获取列表 + * + * @param Request $request 请求对象 + * @return mixed 返回分页数据及总数 + */ + public function index(Request $request) + { + try { + $raw = $this->service->serviceList($request); + $data = $this->transformData($raw, method_exists($this, 'indexFormat') + ? [$this, 'indexFormat'] + : null); + foreach ($data['records'] as &$item) { + $item = $this->service->getCustomer($item); + } + return $this->success($data); + } catch (\Throwable $e) { + return $this->error($e->getMessage().$e->getLine().$e->getFile()); + } + } + /** * 客户分级 * @param Request $request diff --git a/app/crm/service/CustomerService.php b/app/crm/service/CustomerService.php index 608ec04..8621636 100644 --- a/app/crm/service/CustomerService.php +++ b/app/crm/service/CustomerService.php @@ -4,6 +4,7 @@ namespace app\crm\service; use app\common\model\Corp; use app\common\model\User; +use app\common\traits\crud\CrudServiceTrait; use app\crm\logic\CustomerLogic; use app\crm\model\Channel; use app\crm\model\Country; @@ -12,9 +13,18 @@ use app\crm\model\CustomerHis; use app\crm\model\Follow; use app\crm\utils\Util; use config\constants\Constants; +use support\Request; class CustomerService { + + use CrudServiceTrait; + + /** + * 指定当前要操作的模型 + */ + protected string $modelClass = Customer::class; + public function list($params) { // $page = $request->input('page', 1); @@ -112,6 +122,46 @@ class CustomerService return $customer; } + + /** 分页列表 */ + public function serviceList(Request $request) + { + if (method_exists($this, 'complexQuery')) { + $result = $this->complexQuery($request->get()); + } else { + $config = $this->buildQueryConfig($request, 'index'); + $limit = (int)$request->get('size', 15); + $page = (int)$request->get('current', 1); + $result = $this->logicList($config, $limit, $page); + } + return $this->postProcess('List', $result); + } + /** + * 构造 CrudUtil 查询配置 + */ + protected function buildQueryConfig(Request $request, string $scene = 'default'): array + { + $p = $request->all(); + + $config = []; + $config['model'] = $this->modelClass; + switch ($scene) { + case 'index': + $config['where']['status'] = 1; // 关键字 + if (isset($p['keyword']) && $p['keyword']) { + $k = '%' . $p['keyword'] . '%'; + $config['where']['contacts'] = ['like', $k]; + } + $config['order']['id'] = 'desc'; + $config['dataLimit']['type'] = 'relation'; + $config['dataLimit']['userId'] = $request->user->uid; + $config['dataLimit']['userField'] = 'user_id'; + break; + } + + return $config; + } + public function report($params) { $id = $params['id']; @@ -187,6 +237,7 @@ class CustomerService // $customer['last_follow'] = $last_follow; $customer['enter_user_name'] = empty($customer['enter_user_id']) ? '' : User::where('id',$customer['enter_user_id'])->value('name'); + $customer['user_name'] = empty($customer['user_id']) ? '公海' : User::where('id',$customer['user_id'])->value('name'); if ($tag) { foreach ($customer['tags'] as &$tag) { diff --git a/app/crmAdmin/service/CustomerService.php b/app/crmAdmin/service/CustomerService.php index 25fb519..5f08943 100644 --- a/app/crmAdmin/service/CustomerService.php +++ b/app/crmAdmin/service/CustomerService.php @@ -130,7 +130,6 @@ class CustomerService } if ($scene == 'audit') { //审核时查询举报人姓名 $customerHis = CustomerHis::where('customer_id', $item->id)->orderBy('id', 'desc')->first(['user_his']); - var_dump($customerHis['user_his']); $item['user_name'] = empty($customerHis['user_his']) ? '' : User::where('id',$customerHis['user_his'])->value('name'); } } diff --git a/config/route.php b/config/route.php index 7ad0f19..0c928eb 100644 --- a/config/route.php +++ b/config/route.php @@ -158,6 +158,7 @@ Route::group('/crm', function () { //客户 Route::any('/customer/list', [app\crm\controller\CustomerController::class, 'list']); + Route::any('/customer/index', [app\crm\controller\CustomerController::class, 'index']); Route::any('/customer/detail', [app\crm\controller\CustomerController::class, 'detail']); Route::any('/customer/add', [app\crm\controller\CustomerController::class, 'save']); Route::any('/customer/claim', [app\crm\controller\CustomerController::class, 'claim']); From 12490242c41a02ca90e1bc10843f0509098e9325 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Fri, 8 Aug 2025 17:51:08 +0800 Subject: [PATCH 04/18] =?UTF-8?q?=E7=BB=84=E5=91=98=E5=AE=A2=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/service/UserService.php | 3 +++ app/crm/controller/CustomerController.php | 29 +++-------------------- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/app/admin/service/UserService.php b/app/admin/service/UserService.php index 6926bc5..f2e07fd 100644 --- a/app/admin/service/UserService.php +++ b/app/admin/service/UserService.php @@ -54,6 +54,9 @@ class UserService $k = '%' . $p['keyword'] . '%'; $config['where']['name'] = ['like', $k]; } + if (isset($p['user_id']) && $p['user_id']) { + $config['where']['user_id'] = $p['user_id']; + } if (isset($p['id']) && $p['id']) { $config['where']['id'] = $p['id']; } diff --git a/app/crm/controller/CustomerController.php b/app/crm/controller/CustomerController.php index 4478233..d1e7cdb 100644 --- a/app/crm/controller/CustomerController.php +++ b/app/crm/controller/CustomerController.php @@ -536,37 +536,14 @@ class CustomerController extends BaseController public function cede(Request $request) { $customerId = Util::getParam($request, 'customer_id'); - $user_sn = Util::getParam($request, 'user_sn'); - $userId = $request->user->uid; - if (Util::isEmpty($user_sn)) { - return $this->error('ID'.trans('not_null')); - } + $userId = Util::getParam($request, 'user_id'); - $user = User::where(['sn' => $user_sn])->first(); + $user = User::where(['id' => $userId])->first(); if (Util::isEmpty($user)) { return $this->error( trans('user_none')); } - if(Util::isEmpty($customerId)){ - $data = [ - 'user_id' => $userId - ]; - $query= Customer::where($data); - }else{ - $query= Customer::whereIn('id',explode(',',$customerId)); - } -// $customer = $query->get(); -// -// foreach ($customer as $item) { -// //记录客户关系变化 -// $his = CustomerHis::create([ -// 'customer_id' => $item->id, -// 'user_his' => $item->user_id, -// 'user_id' => $user['id'], -// ]); -// } -// $res = $query->update(['user_id' => $user->id]); - + $query= Customer::whereIn('id',explode(',',$customerId)); try { $customer = $query->get(); From f845d1050fc734a3eaee31ac9f8202e4c27f1ede Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Mon, 11 Aug 2025 09:40:21 +0800 Subject: [PATCH 05/18] =?UTF-8?q?=E5=B7=A5=E5=8D=95=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ticket/service/TicketService.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/ticket/service/TicketService.php b/app/ticket/service/TicketService.php index 7f74902..8851914 100644 --- a/app/ticket/service/TicketService.php +++ b/app/ticket/service/TicketService.php @@ -2,6 +2,7 @@ namespace app\ticket\service; +use app\common\model\User; use app\ticket\logic\AttachmentLogic; use app\ticket\logic\ConversationLogic; use app\ticket\logic\TicketLogic; @@ -28,6 +29,8 @@ class TicketService foreach ($v['attachments'] as &$attachments) { $attachments['storage_path_full'] = (new \app\common\service\OssService())->generatePrivateUrl($attachments['storage_path']); } + + $res[$k]['user_name'] = User::where('id', $v['user_id'])->value('name'); } unset($v); unset($attachments); @@ -50,6 +53,7 @@ class TicketService 'ticket_id' => $result->id, 'content' => $cleanContent, 'user_id' => $data['user_id'], + 'attachment' => implode(",", $data['attachment']), ]; (new ConversationService())->add($conversation); From 81ad0d0a97e609d94fbd991cb147e22dff63a6f7 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Mon, 11 Aug 2025 09:51:32 +0800 Subject: [PATCH 06/18] =?UTF-8?q?=E5=B7=A5=E5=8D=95=E6=B2=9F=E9=80=9A?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E9=99=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ticket/service/ConversationService.php | 6 +++--- app/ticket/service/TicketService.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/ticket/service/ConversationService.php b/app/ticket/service/ConversationService.php index 80e871c..7682079 100644 --- a/app/ticket/service/ConversationService.php +++ b/app/ticket/service/ConversationService.php @@ -23,7 +23,7 @@ class ConversationService $ossservice = new OssService(); foreach ($result as $key => $value) { $result[$key]['content'] = str_replace($status_fanyi,$ticket_status,$value['content']); - $result[$key]['attachment'] = explode(",", $value['attachment']); + $result[$key]['attachment'] = unserialize($value['attachment']); foreach ($result[$key]['attachment'] as $k => $attachment) { $result[$key]['attachment_full'][$k] = (!empty($attachment))?$ossservice->generatePrivateUrl($attachment):''; } @@ -34,7 +34,7 @@ class ConversationService public function add(array $data) { try { - $data['attachment'] = implode(",", $data['attachment']); + $data['attachment'] = serialize($data['attachment']); return (new ConversationLogic())->add($data); } catch (\Throwable $e) { throw $e; @@ -45,7 +45,7 @@ class ConversationService { try { Db::beginTransaction(); - $data['attachment'] = implode(",", $data['attachment']); + $data['attachment'] = serialize($data['attachment']); $result = (new ConversationLogic())->edit($data); Db::commit(); return $result; diff --git a/app/ticket/service/TicketService.php b/app/ticket/service/TicketService.php index 8851914..3d7036a 100644 --- a/app/ticket/service/TicketService.php +++ b/app/ticket/service/TicketService.php @@ -53,7 +53,7 @@ class TicketService 'ticket_id' => $result->id, 'content' => $cleanContent, 'user_id' => $data['user_id'], - 'attachment' => implode(",", $data['attachment']), + 'attachment' => serialize($data['attachment']), ]; (new ConversationService())->add($conversation); From ca4e0ed4ed1e3c1276da47e310a697d8061d6eef Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Mon, 11 Aug 2025 10:00:05 +0800 Subject: [PATCH 07/18] =?UTF-8?q?=E5=B7=A5=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ticket/service/ConversationService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ticket/service/ConversationService.php b/app/ticket/service/ConversationService.php index 7682079..8e5e49e 100644 --- a/app/ticket/service/ConversationService.php +++ b/app/ticket/service/ConversationService.php @@ -23,7 +23,7 @@ class ConversationService $ossservice = new OssService(); foreach ($result as $key => $value) { $result[$key]['content'] = str_replace($status_fanyi,$ticket_status,$value['content']); - $result[$key]['attachment'] = unserialize($value['attachment']); + $result[$key]['attachment'] = empty($value['attachment'])?[]:unserialize($value['attachment']); foreach ($result[$key]['attachment'] as $k => $attachment) { $result[$key]['attachment_full'][$k] = (!empty($attachment))?$ossservice->generatePrivateUrl($attachment):''; } From 363d3cf67bc8db90762a5442fdd29cd99faae9fe Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Mon, 11 Aug 2025 10:12:05 +0800 Subject: [PATCH 08/18] =?UTF-8?q?=E5=B7=A5=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ticket/model/Conversation.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/ticket/model/Conversation.php b/app/ticket/model/Conversation.php index 6d63cb5..f275f2b 100644 --- a/app/ticket/model/Conversation.php +++ b/app/ticket/model/Conversation.php @@ -29,5 +29,6 @@ class Conversation extends Model 'ticket_id', 'user_id', 'content', + 'attachment', ]; } \ No newline at end of file From bbad18c09ad7bd4358f7524ada28ced6d172ea96 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Mon, 11 Aug 2025 10:14:53 +0800 Subject: [PATCH 09/18] =?UTF-8?q?=E5=B7=A5=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ticket/service/ConversationService.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/ticket/service/ConversationService.php b/app/ticket/service/ConversationService.php index 8e5e49e..49d141f 100644 --- a/app/ticket/service/ConversationService.php +++ b/app/ticket/service/ConversationService.php @@ -35,6 +35,9 @@ class ConversationService { try { $data['attachment'] = serialize($data['attachment']); + if (empty($data['content'])) { + throw new BusinessException('消息内容不能为空'); + } return (new ConversationLogic())->add($data); } catch (\Throwable $e) { throw $e; From 49436b65d5db99ecb20467a33d827071b05cda10 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Mon, 11 Aug 2025 10:18:40 +0800 Subject: [PATCH 10/18] =?UTF-8?q?=E9=99=84=E4=BB=B6=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ticket/controller/ConversationController.php | 2 +- app/ticket/service/ConversationService.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/ticket/controller/ConversationController.php b/app/ticket/controller/ConversationController.php index 86d4fd7..fcc8ef6 100644 --- a/app/ticket/controller/ConversationController.php +++ b/app/ticket/controller/ConversationController.php @@ -28,7 +28,7 @@ class ConversationController extends BaseController ? $this->success() : $this->error(); } catch (\Throwable $th) { - return $this->error($th->getMessage().' '.$th->getLine().' '.$th->getFile()); + return $this->error($th->getMessage()); } } public function edit(Request $request) diff --git a/app/ticket/service/ConversationService.php b/app/ticket/service/ConversationService.php index 49d141f..5bc977c 100644 --- a/app/ticket/service/ConversationService.php +++ b/app/ticket/service/ConversationService.php @@ -25,7 +25,7 @@ class ConversationService $result[$key]['content'] = str_replace($status_fanyi,$ticket_status,$value['content']); $result[$key]['attachment'] = empty($value['attachment'])?[]:unserialize($value['attachment']); foreach ($result[$key]['attachment'] as $k => $attachment) { - $result[$key]['attachment_full'][$k] = (!empty($attachment))?$ossservice->generatePrivateUrl($attachment):''; + $result[$key]['storage_path_full'][$k] = (!empty($attachment))?$ossservice->generatePrivateUrl($attachment['storage_path']):''; } } return $result; From 584dacb155478d757877efb6b1157ac5c7c81f58 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Mon, 11 Aug 2025 10:22:06 +0800 Subject: [PATCH 11/18] =?UTF-8?q?=E5=B7=A5=E5=8D=95=E9=99=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ticket/service/ConversationService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ticket/service/ConversationService.php b/app/ticket/service/ConversationService.php index 5bc977c..951b9e4 100644 --- a/app/ticket/service/ConversationService.php +++ b/app/ticket/service/ConversationService.php @@ -25,7 +25,7 @@ class ConversationService $result[$key]['content'] = str_replace($status_fanyi,$ticket_status,$value['content']); $result[$key]['attachment'] = empty($value['attachment'])?[]:unserialize($value['attachment']); foreach ($result[$key]['attachment'] as $k => $attachment) { - $result[$key]['storage_path_full'][$k] = (!empty($attachment))?$ossservice->generatePrivateUrl($attachment['storage_path']):''; + $result[$key]['attachment']['storage_path_full'][$k] = (!empty($attachment))?$ossservice->generatePrivateUrl($attachment['storage_path']):''; } } return $result; From 90be69716a078204bf74a599931594de8b535886 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Mon, 11 Aug 2025 10:27:05 +0800 Subject: [PATCH 12/18] =?UTF-8?q?=E5=B7=A5=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ticket/service/ConversationService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/ticket/service/ConversationService.php b/app/ticket/service/ConversationService.php index 951b9e4..2dc0d18 100644 --- a/app/ticket/service/ConversationService.php +++ b/app/ticket/service/ConversationService.php @@ -20,6 +20,7 @@ class ConversationService $result = (new ConversationLogic())->list($params); $status_fanyi = array_map(fn($v) => "{{{$v}}}", array_flip(Constants::TICKET_STATUS)); + $result = $result??$result->toArray(); $ossservice = new OssService(); foreach ($result as $key => $value) { $result[$key]['content'] = str_replace($status_fanyi,$ticket_status,$value['content']); From 1829d013b542254f6c9a5301f090de72afe51c0f Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Mon, 11 Aug 2025 10:44:58 +0800 Subject: [PATCH 13/18] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=9A=84=E9=99=84=E4=BB=B6=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ticket/service/ConversationService.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/ticket/service/ConversationService.php b/app/ticket/service/ConversationService.php index 2dc0d18..ce6104c 100644 --- a/app/ticket/service/ConversationService.php +++ b/app/ticket/service/ConversationService.php @@ -20,14 +20,16 @@ class ConversationService $result = (new ConversationLogic())->list($params); $status_fanyi = array_map(fn($v) => "{{{$v}}}", array_flip(Constants::TICKET_STATUS)); - $result = $result??$result->toArray(); $ossservice = new OssService(); foreach ($result as $key => $value) { - $result[$key]['content'] = str_replace($status_fanyi,$ticket_status,$value['content']); - $result[$key]['attachment'] = empty($value['attachment'])?[]:unserialize($value['attachment']); - foreach ($result[$key]['attachment'] as $k => $attachment) { - $result[$key]['attachment']['storage_path_full'][$k] = (!empty($attachment))?$ossservice->generatePrivateUrl($attachment['storage_path']):''; + $value=$value->toArray(); + $value['content'] = str_replace($status_fanyi,$ticket_status,$value['content']); + $value['attachment'] = empty($value['attachment'])?[]:unserialize($value['attachment']); + foreach ($value['attachment'] as $k => $attachment) { + $value['attachment'][$k]['storage_path_full'] = (!empty($attachment))?$ossservice->generatePrivateUrl($attachment['storage_path']):''; } + + $result[$key] = $value; } return $result; } From f45534da7d8b9cff5bdd73c11ab7284aa6de4b18 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Mon, 11 Aug 2025 10:50:44 +0800 Subject: [PATCH 14/18] =?UTF-8?q?=E5=B7=A5=E5=8D=95=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ticket/service/ConversationService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/ticket/service/ConversationService.php b/app/ticket/service/ConversationService.php index ce6104c..28e5610 100644 --- a/app/ticket/service/ConversationService.php +++ b/app/ticket/service/ConversationService.php @@ -2,6 +2,7 @@ namespace app\ticket\service; +use app\common\model\User; use app\common\service\OssService; use app\ticket\logic\ConversationLogic; use config\constants\Constants; @@ -28,7 +29,7 @@ class ConversationService foreach ($value['attachment'] as $k => $attachment) { $value['attachment'][$k]['storage_path_full'] = (!empty($attachment))?$ossservice->generatePrivateUrl($attachment['storage_path']):''; } - + $value['user_name'] = User::where('id', $value['user_id'])->value('name'); $result[$key] = $value; } return $result; From f704f4e01ad67853fda234254cd8dda56e9cc0cc Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Mon, 11 Aug 2025 10:58:03 +0800 Subject: [PATCH 15/18] =?UTF-8?q?=E5=A4=B4=E5=83=8F=E4=B8=8E=E5=A7=93?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ticket/service/ConversationService.php | 4 +++- app/ticket/service/TicketService.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/ticket/service/ConversationService.php b/app/ticket/service/ConversationService.php index 28e5610..c9cbd17 100644 --- a/app/ticket/service/ConversationService.php +++ b/app/ticket/service/ConversationService.php @@ -29,7 +29,9 @@ class ConversationService foreach ($value['attachment'] as $k => $attachment) { $value['attachment'][$k]['storage_path_full'] = (!empty($attachment))?$ossservice->generatePrivateUrl($attachment['storage_path']):''; } - $value['user_name'] = User::where('id', $value['user_id'])->value('name'); + $user = User::where('id', $value['user_id'])->first(); + $value['user_name'] = $user?->name; + $value['user_avatar'] = $user?->avatar; $result[$key] = $value; } return $result; diff --git a/app/ticket/service/TicketService.php b/app/ticket/service/TicketService.php index 3d7036a..1fd5900 100644 --- a/app/ticket/service/TicketService.php +++ b/app/ticket/service/TicketService.php @@ -30,7 +30,9 @@ class TicketService $attachments['storage_path_full'] = (new \app\common\service\OssService())->generatePrivateUrl($attachments['storage_path']); } - $res[$k]['user_name'] = User::where('id', $v['user_id'])->value('name'); + $user = User::where('id', $v['user_id'])->first(); + $res[$k]['user_name'] = $user?->name; + $res[$k]['user_avatar'] = $user?->avatar; } unset($v); unset($attachments); From 41ef742a67eb187b9c5fb498260818b5533c9483 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Mon, 11 Aug 2025 11:58:27 +0800 Subject: [PATCH 16/18] =?UTF-8?q?=E9=99=84=E4=BB=B6=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8C=96=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ticket/service/TicketService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ticket/service/TicketService.php b/app/ticket/service/TicketService.php index 1fd5900..5d451be 100644 --- a/app/ticket/service/TicketService.php +++ b/app/ticket/service/TicketService.php @@ -55,7 +55,7 @@ class TicketService 'ticket_id' => $result->id, 'content' => $cleanContent, 'user_id' => $data['user_id'], - 'attachment' => serialize($data['attachment']), + 'attachment' => $data['attachment'], ]; (new ConversationService())->add($conversation); From 8fabead3056308faef7d76718b4eeaf3baa1547c Mon Sep 17 00:00:00 2001 From: mzl Date: Tue, 12 Aug 2025 08:45:51 +0800 Subject: [PATCH 17/18] ts --- app/controller/IndexController.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/controller/IndexController.php b/app/controller/IndexController.php index 77c5622..fa0fce1 100644 --- a/app/controller/IndexController.php +++ b/app/controller/IndexController.php @@ -106,8 +106,13 @@ class IndexController public function test() { - $data = DataPermission::getRoleTreeUserIds(1); - var_dump($data); - return 22; + $uidRotator = new \app\common\utils\RedisUidRotator('email_parsed_result_20250804'); + $uidRotator->setUids([64, 63, 83, 93, 108, 118, 131, 132, 145, 150, 143, 156, 157, 158]); + + $assignedUid = $uidRotator->next(); + + flg($assignedUid, false); + + return $assignedUid; } } \ No newline at end of file From f72a5def3e8a18d671fe25cd409ad7fba00cb865 Mon Sep 17 00:00:00 2001 From: mzl Date: Tue, 12 Aug 2025 10:44:51 +0800 Subject: [PATCH 18/18] ts --- app/common/utils/email/Emails.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/common/utils/email/Emails.php b/app/common/utils/email/Emails.php index 0bb8376..51e09f9 100644 --- a/app/common/utils/email/Emails.php +++ b/app/common/utils/email/Emails.php @@ -435,7 +435,7 @@ class Emails $channelInfo = InquiryChannel::where('id', $channel)->first(); // 初始化 UID 轮询器 - $uidRotator = new \app\common\utils\RedisUidRotator('email_parsed_result_20250804'); + $uidRotator = new \app\common\utils\RedisUidRotator('email_parsed_result_20250804', false); $uidRotator->setUids([64, 63, 83, 93, 108, 118, 131, 132, 145, 150, 143, 156, 157, 158]); EmailParsedResult::where('status', 0)