From 806a9e02c53f35dc033b307735809dfa8d454af1 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 27 Mar 2023 09:28:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A5=E8=AF=8A=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/InquiryService.php | 2 +- app/Services/MessageNoticeService.php | 61 +++++++++++++++++++++++++-- config/routes.php | 2 +- 3 files changed, 60 insertions(+), 5 deletions(-) diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 32eeec3..ac48c4d 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -601,7 +601,6 @@ class InquiryService extends BaseService return fail(); } - $times_number = 0; // 沟通次数 $duration = 0; // 沟通时长 $follow = false; // 关注状态 @@ -648,6 +647,7 @@ class InquiryService extends BaseService $result['duration'] = $duration; $result['follow'] = $follow; $result['is_evaluation'] = $is_evaluation; + $result['reception_time'] = $order_inquiry['reception_time'] ?? ""; // 接诊时间 return success($result); } diff --git a/app/Services/MessageNoticeService.php b/app/Services/MessageNoticeService.php index 864c07a..1415ed5 100644 --- a/app/Services/MessageNoticeService.php +++ b/app/Services/MessageNoticeService.php @@ -27,7 +27,21 @@ class MessageNoticeService extends BaseService $params['notice_type'] = 1; // 消息类型(1:医生服务通知 2:医生系统公告 3:患者系统消息 $params['send_status'] = 1; - $result = MessageNotice::getMessageNoticePage($params, ["*"], $page, $per_page); + $fields = [ + 'notice_id', + 'read_status', + 'from_name', + 'notice_title', + 'notice_send_time', + 'notice_content', + 'button_type', + 'link_type', + 'link_params', + 'show_type', + 'show_params', + ]; + + $result = MessageNotice::getMessageNoticePage($params, $fields, $page, $per_page); if (!empty($result['data'])) { foreach ($result['data'] as &$item) { if (!empty($item['link_params'])) { @@ -59,7 +73,21 @@ class MessageNoticeService extends BaseService $params['notice_type'] = 2; // 消息类型(1:医生服务通知 2:医生系统公告 3:患者系统消息 $params['send_status'] = 1; - $result = MessageNotice::getMessageNoticePage($params, ["*"], $page, $per_page); + $fields = [ + 'notice_id', + 'read_status', + 'from_name', + 'notice_title', + 'notice_send_time', + 'notice_content', + 'button_type', + 'link_type', + 'link_params', + 'show_type', + 'show_params', + ]; + + $result = MessageNotice::getMessageNoticePage($params, $fields, $page, $per_page); if (!empty($result['data'])) { foreach ($result['data'] as &$item) { if (!empty($item['link_params'])) { @@ -74,7 +102,34 @@ class MessageNoticeService extends BaseService return success($result); } - public function getDoctorMessageSystemInfo(){ + /** + * 获取医生系统公告详情 + * @return array + */ + public function getDoctorMessageSystemInfo(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + $notice_id = $this->request->route('notice_id'); + + $params = array(); + $params['notice_id'] = $notice_id; + $params['user_id'] = $user_info['user_id']; + $params['notice_type'] = 2; // 消息类型(1:医生服务通知 2:医生系统公告 3:患者系统消息) + $params['send_status'] = 1; + $message_notice = MessageNotice::getOne($params); + if (empty($message_notice)){ + return fail(); + } + + if (!empty($message_notice['link_params'])) { + $message_notice['link_params'] = json_decode($message_notice['link_params'], true); + } + + if (!empty($message_notice['show_params'])) { + $message_notice['show_params'] = json_decode($message_notice['show_params'], true); + } + + return success($message_notice->toArray()); } } \ No newline at end of file diff --git a/config/routes.php b/config/routes.php index e850dc3..cb81001 100644 --- a/config/routes.php +++ b/config/routes.php @@ -195,7 +195,7 @@ Router::addGroup('/doctor', function () { // 获取医生系统公告列表-分页 Router::get('/system', [MessageNoticeController::class, 'getDoctorMessageSystem']); - // 获取医生系统公告列表-分页 + // 获取医生系统公告详情 Router::get('/system/{notice_id:\d+}', [MessageNoticeController::class, 'getDoctorMessageSystemInfo']); }); });