diff --git a/app/Amqp/Consumer/SendVideoNoticeDelayDirectConsumer.php b/app/Amqp/Consumer/SendVideoNoticeDelayDirectConsumer.php index 66222bc..9b31c8a 100644 --- a/app/Amqp/Consumer/SendVideoNoticeDelayDirectConsumer.php +++ b/app/Amqp/Consumer/SendVideoNoticeDelayDirectConsumer.php @@ -176,6 +176,8 @@ class SendVideoNoticeDelayDirectConsumer extends ConsumerMessage Log::getInstance("queue-SendVideoNotice")->error("修改失败"); return Result::ACK; } + + Db::commit(); }catch (\Throwable $e){ Db::rollBack(); Log::getInstance("queue-SendVideoNotice")->error($e->getMessage()); diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 153ed01..e3be4d2 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -49,6 +49,7 @@ use Hyperf\Redis\Redis; use Hyperf\Snowflake\IdGeneratorInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; +use SebastianBergmann\CodeCoverage\TestIdMissingException; /** * 问诊 @@ -1325,7 +1326,7 @@ class InquiryService extends BaseService $order_inquiry_id = $this->request->input('order_inquiry_id'); $reservation_time = $this->request->input('reservation_time'); - // 检测问诊时间 + // 检测预约时间 if (time() >= strtotime($reservation_time)){ return fail(HttpEnumCode::HTTP_ERROR, "预约时间须大于当前时间"); } @@ -1364,9 +1365,9 @@ class InquiryService extends BaseService // 问诊结束时间 $complete_time = strtotime($order_inquiry['reception_time']) + $system_inquiry_config['duration'] * 60 - 10 * 60; - // 检测问诊结束时间 - if (time() >= $complete_time){ - return fail(HttpEnumCode::HTTP_ERROR, "已无法设置/修改视频时间,可立即发起视频"); + // 检测问诊结束时间 预约时间不可超出视频问诊结束时间 + if (strtotime($reservation_time) >= $complete_time){ + return fail(HttpEnumCode::HTTP_ERROR, "预约时间不可超出视频问诊结束时间"); } // 获取是否已经预约 @@ -1389,7 +1390,6 @@ class InquiryService extends BaseService $is_reservation = true; } - // 创建订单 Db::beginTransaction(); try { @@ -1466,14 +1466,18 @@ class InquiryService extends BaseService $sendSmsService = new SendSmsService($user['mobile']); $sendSmsService->noticePatientVideoTime($user_doctor['user_name'],$reservation_time); - // 增加延迟队列通知-视频问诊即将开始 - $time = strtotime($reservation_time) - 4*60; - $message = new SendVideoNoticeDelayDirectProducer($data); - $message->setDelayMs(1000 * $time); - $producer = $this->container->get(Producer::class); - $res = $producer->produce($message); - if (!$res) { - return fail(HttpEnumCode::SERVER_ERROR, "设置失败"); + // 增加延迟队列通知-视频问诊即将开始-时间大于5分钟 + $time = strtotime($reservation_time) - 5*60; + if ($time > time()){ + $data = array(); + $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; + $message = new SendVideoNoticeDelayDirectProducer($data); + $message->setDelayMs(1000 * (strtotime($reservation_time) - time())); + $producer = $this->container->get(Producer::class); + $res = $producer->produce($message); + if (!$res) { + return fail(HttpEnumCode::SERVER_ERROR, "设置失败"); + } } }catch (\Throwable $e){ Log::getInstance("InquiryService-addDoctorGiveInquiryOrder")->error($e->getMessage());