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 1/3] =?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 2/3] =?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 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 3/3] =?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);