diff --git a/app/Controller/MessageNoticeController.php b/app/Controller/MessageNoticeController.php index 056b573..e9c31b8 100644 --- a/app/Controller/MessageNoticeController.php +++ b/app/Controller/MessageNoticeController.php @@ -43,4 +43,15 @@ class MessageNoticeController extends AbstractController $data = $MessageNoticeService->getDoctorMessageSystemInfo(); return $this->response->json($data); } + + /** + * 消息已读 + * @return ResponseInterface + */ + public function putMessageReadId(): ResponseInterface + { + $MessageNoticeService = new MessageNoticeService(); + $data = $MessageNoticeService->putMessageReadId(); + return $this->response->json($data); + } } \ No newline at end of file diff --git a/app/Model/MessageNotice.php b/app/Model/MessageNotice.php index 6b85a35..da04068 100644 --- a/app/Model/MessageNotice.php +++ b/app/Model/MessageNotice.php @@ -110,4 +110,15 @@ class MessageNotice extends Model return $data; } + + /** + * 修改 + * @param array $params + * @param array $data + * @return int + */ + public static function edit(array $params = [], array $data = []): int + { + return self::where($params)->update($data); + } } diff --git a/app/Services/DoctorInquiryService.php b/app/Services/DoctorInquiryService.php index 163f54d..e3d6493 100644 --- a/app/Services/DoctorInquiryService.php +++ b/app/Services/DoctorInquiryService.php @@ -185,6 +185,7 @@ class DoctorInquiryService extends BaseService if ($inquiry_type == 1) { // 专家 $data['is_img_expert_reception'] = $is_open; + $data['is_online'] = $is_open; } elseif ($inquiry_type == 2) { // 快速 $data['is_img_quick_reception'] = $is_open; diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index ac48c4d..2cb2c43 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -647,7 +647,7 @@ class InquiryService extends BaseService $result['duration'] = $duration; $result['follow'] = $follow; $result['is_evaluation'] = $is_evaluation; - $result['reception_time'] = $order_inquiry['reception_time'] ?? ""; // 接诊时间 + $result['reception_time'] = $order_inquiry['reception_time'] ?: null; // 接诊时间 return success($result); } diff --git a/app/Services/MessageNoticeService.php b/app/Services/MessageNoticeService.php index 1415ed5..67535b1 100644 --- a/app/Services/MessageNoticeService.php +++ b/app/Services/MessageNoticeService.php @@ -132,4 +132,32 @@ class MessageNoticeService extends BaseService return success($message_notice->toArray()); } + + /** + * 消息已读 + * @return array + */ + public function putMessageReadId(): 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']; + $message_notice = MessageNotice::getExists($params); + if (empty($message_notice)){ + return success(); + } + + $data = array(); + $data['read_status'] = 1; + + $params = array(); + $params['notice_id'] = $notice_id; + MessageNotice::edit($params,$data); + + return success(); + } } \ No newline at end of file diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index 8563f3b..f2d96b7 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -413,10 +413,6 @@ class PatientDoctorService extends BaseService return fail(); } - if ($user_doctor['is_img_expert_reception'] != 1) { - return fail(HttpEnumCode::HTTP_ERROR, "医生未开通在线问诊服务"); - } - // 检测当前医生是否和患者存在未完成问诊订单 $InquiryService = new InquiryService(); $order_inquiry = $InquiryService->checkPatientDoctorProgressInquiry($user_info['client_user_id'],$doctor_id); diff --git a/config/routes.php b/config/routes.php index cb81001..ff66b35 100644 --- a/config/routes.php +++ b/config/routes.php @@ -590,10 +590,10 @@ Router::addGroup('/address', function () { // 消息通知 Router::addGroup('/message', function () { // 消息已读 - Router::post('/read/{notice_id:\d+}', [UserDoctorController::class, 'getDoctorCenter']); + Router::put('/read/{notice_id:\d+}', [MessageNoticeController::class, 'putMessageReadId']); // 一键消息已读 - Router::get('/read', [UserDoctorController::class, 'getDoctorCenterInfo']); + Router::get('/read', [MessageNoticeController::class, 'putMessageRead']); }); // 问诊订单