From 0c5c6e68c2c22333ac44df3371f9adaa5f8c26b0 Mon Sep 17 00:00:00 2001 From: haomingming Date: Fri, 31 Jul 2026 13:34:04 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E6=B5=8B=E8=AF=95=20log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/TestController.php | 5 +++++ config/routes.php | 1 + 2 files changed, 6 insertions(+) diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php index 762ad0a..7413f6f 100644 --- a/app/Controller/TestController.php +++ b/app/Controller/TestController.php @@ -89,6 +89,11 @@ class TestController extends AbstractController // 疾病名称 protected string $icd_name; + public function testError() + { + throw new BusinessException("测试Docker日志报错:这是一个测试异常!"); + } + public function test(){ // $this->test_8(); // $this->test_3(); diff --git a/config/routes.php b/config/routes.php index 6b23d14..1ffdbde 100644 --- a/config/routes.php +++ b/config/routes.php @@ -912,6 +912,7 @@ Router::addGroup('/case', function () { // 测试使用 Router::addGroup('/test', function () { Router::get('', [TestController::class, 'test']); + Router::get('/error', [TestController::class, 'testError']); // 获取未接诊的医生 Router::get('/uninquiry', [TestController::class, 'uninquiry']); From ed3dcdd15076e1be3c19d34dfdf8f07bf88b60be Mon Sep 17 00:00:00 2001 From: haomingming Date: Fri, 31 Jul 2026 13:39:01 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E6=B5=8B=E8=AF=95logs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Utils/Auth.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Utils/Auth.php b/app/Utils/Auth.php index 0ddcb95..8ff1243 100644 --- a/app/Utils/Auth.php +++ b/app/Utils/Auth.php @@ -39,6 +39,7 @@ class Auth "/basic/keyword/search" => "get", // 获取热门搜索关键词 "/test/uninquiry" => "get", // 获取未接诊的医生 "/test/refund" => "post", // 测试退款 + "/test/error" => "get", // 测试报错 "/test" => "get", // 测试 "/callback/detection" => "post", // 检测所结果回调 "/callback/video/trtc" => "post", // 音视频回调 From c8216b4e2a2897a22387126bb00779566c2c4e7f Mon Sep 17 00:00:00 2001 From: haomingming Date: Fri, 31 Jul 2026 13:42:49 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E6=B5=8B=E8=AF=95log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/TestController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php index 7413f6f..4dde2ad 100644 --- a/app/Controller/TestController.php +++ b/app/Controller/TestController.php @@ -91,7 +91,8 @@ class TestController extends AbstractController public function testError() { - throw new BusinessException("测试Docker日志报错:这是一个测试异常!"); + // 模拟触发 SQLSTATE[42S22]: Column not found 数据库报错 + Db::select("SELECT nonexistent_column_test FROM user_ca_cert LIMIT 1"); } public function test(){ From e836e844216fb2e097f3286a5eeee88e0e756e92 Mon Sep 17 00:00:00 2001 From: haomingming Date: Fri, 31 Jul 2026 13:46:07 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=B5=8B=E8=AF=95log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/TestController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php index 4dde2ad..cd31530 100644 --- a/app/Controller/TestController.php +++ b/app/Controller/TestController.php @@ -92,7 +92,7 @@ class TestController extends AbstractController public function testError() { // 模拟触发 SQLSTATE[42S22]: Column not found 数据库报错 - Db::select("SELECT nonexistent_column_test FROM user_ca_cert LIMIT 1"); + Db::select("SELECT nonexistent_column_test FROM gdxz_user_ca_cert LIMIT 1"); } public function test(){ From 4ad8d5fa6f3542a3ecf818c99340b650a1a89c6c Mon Sep 17 00:00:00 2001 From: haomingming Date: Thu, 20 Aug 2026 11:38:23 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E9=85=8D=E7=BD=AE=20IM=20=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0=E5=88=B0=E9=98=BF?= =?UTF-8?q?=E9=87=8C=E4=BA=91OSS=EF=BC=9B=E6=9B=B4=E6=96=B0=20=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E7=99=BD=E5=90=8D=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Amqp/Consumer/UploadImMediaConsumer.php | 88 +++++++++++++++++++++ app/Amqp/Producer/UploadImMediaProducer.php | 27 +++++++ app/Services/UserService.php | 17 ++++ app/Utils/Auth.php | 4 + 4 files changed, 136 insertions(+) create mode 100644 app/Amqp/Consumer/UploadImMediaConsumer.php create mode 100644 app/Amqp/Producer/UploadImMediaProducer.php diff --git a/app/Amqp/Consumer/UploadImMediaConsumer.php b/app/Amqp/Consumer/UploadImMediaConsumer.php new file mode 100644 index 0000000..e878efa --- /dev/null +++ b/app/Amqp/Consumer/UploadImMediaConsumer.php @@ -0,0 +1,88 @@ + false, 'timeout' => 30]); // 设置合适的超时时间 + $oss = new Oss(); + $needUpdate = false; + $customDomain = config('alibaba.oss.custom_domain_name'); // 取 OSS 自定义域名 + + // 1. 根据不同类型提取 URL 并转存 OSS + if ($msgType === 'TIMImageElem' && isset($msgContent['ImageInfoArray'])) { + // 图片通常包含原图、大图、缩略图,根据需求替换 + foreach ($msgContent['ImageInfoArray'] as &$imageInfo) { + if (!empty($imageInfo['URL'])) { + $content = $client->get($imageInfo['URL'])->getBody()->getContents(); + $filename = "im/image/" . date('Ymd') . "/" . $messageKey . "_" . $imageInfo['Type'] . ".jpg"; + $ossFilename = $oss->putObject($filename, $content); + + $imageInfo['URL'] = rtrim($customDomain, '/') . '/' . $ossFilename; + $needUpdate = true; + } + } + } elseif ($msgType === 'TIMSoundElem' && !empty($msgContent['Url'])) { + // 语音消息 + $content = $client->get($msgContent['Url'])->getBody()->getContents(); + $filename = "im/sound/" . date('Ymd') . "/" . $messageKey . ".amr"; + $ossFilename = $oss->putObject($filename, $content); + + $msgContent['Url'] = rtrim($customDomain, '/') . '/' . $ossFilename; + $needUpdate = true; + } elseif ($msgType === 'TIMVideoFileElem') { + // 视频文件 + if (!empty($msgContent['VideoUrl'])) { + $content = $client->get($msgContent['VideoUrl'])->getBody()->getContents(); + $filename = "im/video/" . date('Ymd') . "/" . $messageKey . ".mp4"; + $ossFilename = $oss->putObject($filename, $content); + $msgContent['VideoUrl'] = rtrim($customDomain, '/') . '/' . $ossFilename; + $needUpdate = true; + } + // 视频封面图 + if (!empty($msgContent['ThumbUrl'])) { + $content = $client->get($msgContent['ThumbUrl'])->getBody()->getContents(); + $filename = "im/video_thumb/" . date('Ymd') . "/" . $messageKey . ".jpg"; + $ossFilename = $oss->putObject($filename, $content); + $msgContent['ThumbUrl'] = rtrim($customDomain, '/') . '/' . $ossFilename; + $needUpdate = true; + } + } + + // 2. 更新对应记录的 JSON 数据 + if ($needUpdate) { + MessageIm::where(['message_key' => $messageKey])->update([ + 'message_content' => json_encode($msgContent, JSON_UNESCAPED_UNICODE) + ]); + } + + return Result::ACK; // 任务成功完成 + } catch (\Throwable $e) { + Log::getInstance("UploadImMediaConsumer")->error("IM多媒体上传OSS失败: " . $e->getMessage() . ' Line: ' . $e->getLine()); + // 如果抛错可以 DROP 掉或者返回 REQUEUE 进入死信重试队列 + return Result::DROP; + } + } +} diff --git a/app/Amqp/Producer/UploadImMediaProducer.php b/app/Amqp/Producer/UploadImMediaProducer.php new file mode 100644 index 0000000..3f15e64 --- /dev/null +++ b/app/Amqp/Producer/UploadImMediaProducer.php @@ -0,0 +1,27 @@ + "消息唯一ID", + * "msg_type" => "消息类型", + * "msg_content" => "消息具体内容(数组)" + * ] + */ + public function __construct(array $data) + { + $this->payload = $data; + } +} diff --git a/app/Services/UserService.php b/app/Services/UserService.php index 4eb7d52..f7880fe 100644 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -1232,6 +1232,23 @@ class UserService extends BaseService return $result; } + // === 新增:投递上传OSS队列 === + $mediaTypes = ['TIMImageElem', 'TIMSoundElem', 'TIMVideoFileElem', 'TIMFileElem']; + if (in_array($msg_data['MsgBody'][0]['MsgType'], $mediaTypes)) { + try { + $producer = \Hyperf\Context\ApplicationContext::getContainer()->get(\Hyperf\Amqp\Producer::class); + $producerMsg = new \App\Amqp\Producer\UploadImMediaProducer([ + 'message_key' => $msg_data['MsgKey'], + 'msg_type' => $msg_data['MsgBody'][0]['MsgType'], + 'msg_content' => $message_content, + ]); + $producer->produce($producerMsg); + } catch (\Throwable $e) { + Log::getInstance("UserService-userImAfterSendMsg")->error("投递上传OSS队列失败: " . $e->getMessage()); + } + } + // === 新增结束 === + // im消息通知 if ($is_system == 0 && isset($message_send_result) && isset($order_inquiry_id)){ try { diff --git a/app/Utils/Auth.php b/app/Utils/Auth.php index 8ff1243..ba410da 100644 --- a/app/Utils/Auth.php +++ b/app/Utils/Auth.php @@ -19,6 +19,10 @@ class Auth "/login/wechat_mobile_login" => "post", // 微信登陆 "/login/mobile_login" => "post", // 手机号登陆 "/code/phone" => "post",// 获取手机号验证码 + "/patient/doctor/inquiry" => "get", // 获取问诊医生列表 + "/doctor/info/inquiry/" => "get", // 获取医生详情-问诊 + "/doctor/inquiry/service/" => "get", // 获取医生开启的服务列表 + "/patient/doctor/evaluation/" => "get", // 获取医生评价 "/disease/expertise" => "get",// 疾病专长列表-搜索使用 "/area/province" => "get",// 获取省份信息 "/area/city" => "get", // 获取城市信息 From a66370bf9113215f264a104c2db2b26b704906c2 Mon Sep 17 00:00:00 2001 From: haomingming Date: Mon, 7 Sep 2026 11:28:40 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E7=99=BD=E5=90=8D?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/UserDoctorService.php | 11 ++--------- app/Utils/Auth.php | 5 ++++- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index da8b96b..040468a 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -2492,15 +2492,12 @@ class UserDoctorService extends BaseService $user_info = $this->request->getAttribute("userInfo") ?? []; - if (empty($user_info)){ - return fail(HttpEnumCode::HTTP_SUCCESS, "请登录"); - } - $result = array(); $result['hospital'] = []; $result['days'] = 0; $result['doctor_inquiry_config'] = []; $result['is_online'] = 0; + $result['follow'] = false; $fields = [ "doctor_id", @@ -2549,7 +2546,7 @@ class UserDoctorService extends BaseService } // 患者 - if ($user_info['user_type'] == 1){ + if (!empty($user_info) && $user_info['user_type'] == 1){ // 获取服务天数 $params = array(); $params['patient_id'] = $user_info['client_user_id']; @@ -2626,10 +2623,6 @@ class UserDoctorService extends BaseService $user_info = $this->request->getAttribute("userInfo") ?? []; - if (empty($user_info)){ - return fail(HttpEnumCode::HTTP_SUCCESS, "请登录"); - } - $fields = [ "doctor_id", "user_id", diff --git a/app/Utils/Auth.php b/app/Utils/Auth.php index ba410da..6d55da1 100644 --- a/app/Utils/Auth.php +++ b/app/Utils/Auth.php @@ -23,7 +23,10 @@ class Auth "/doctor/info/inquiry/" => "get", // 获取医生详情-问诊 "/doctor/inquiry/service/" => "get", // 获取医生开启的服务列表 "/patient/doctor/evaluation/" => "get", // 获取医生评价 - "/disease/expertise" => "get",// 疾病专长列表-搜索使用 + "/basic/disease/expertise" => "get",// 疾病专长列表-搜索使用 + "/patient/article/science" => "get", // 科普文章分页 + "/patient/article/science/list" => "get", // 科普文章列表 + "/evaluation" => "get", // 获取医生评价列表 "/area/province" => "get",// 获取省份信息 "/area/city" => "get", // 获取城市信息 "/area/county" => "get", // 获取区县信息 From 4dfcdacb12c76fb9a53e11a00d90c158eba81b12 Mon Sep 17 00:00:00 2001 From: haomingming Date: Mon, 7 Sep 2026 11:38:00 +0800 Subject: [PATCH 7/7] 2 --- app/Services/UserDoctorService.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index 040468a..b321dee 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -880,10 +880,6 @@ class UserDoctorService extends BaseService $page = $this->request->input('page', 1); $per_page = $this->request->input('per_page', 10); - if (empty($user_info)) { - return fail(); - } - // 4-5分为好评、3分为中评、2-1分为差评 if ($evaluation_type == 1) { // 全部