新增医生设置视频预约时间

This commit is contained in:
wucongxing 2024-01-16 16:42:46 +08:00
parent ccc4934700
commit 0b994330d5
2 changed files with 19 additions and 13 deletions

View File

@ -176,6 +176,8 @@ class SendVideoNoticeDelayDirectConsumer extends ConsumerMessage
Log::getInstance("queue-SendVideoNotice")->error("修改失败"); Log::getInstance("queue-SendVideoNotice")->error("修改失败");
return Result::ACK; return Result::ACK;
} }
Db::commit();
}catch (\Throwable $e){ }catch (\Throwable $e){
Db::rollBack(); Db::rollBack();
Log::getInstance("queue-SendVideoNotice")->error($e->getMessage()); Log::getInstance("queue-SendVideoNotice")->error($e->getMessage());

View File

@ -49,6 +49,7 @@ use Hyperf\Redis\Redis;
use Hyperf\Snowflake\IdGeneratorInterface; use Hyperf\Snowflake\IdGeneratorInterface;
use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface; 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'); $order_inquiry_id = $this->request->input('order_inquiry_id');
$reservation_time = $this->request->input('reservation_time'); $reservation_time = $this->request->input('reservation_time');
// 检测问诊时间 // 检测预约时间
if (time() >= strtotime($reservation_time)){ if (time() >= strtotime($reservation_time)){
return fail(HttpEnumCode::HTTP_ERROR, "预约时间须大于当前时间"); 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; $complete_time = strtotime($order_inquiry['reception_time']) + $system_inquiry_config['duration'] * 60 - 10 * 60;
// 检测问诊结束时间 // 检测问诊结束时间 预约时间不可超出视频问诊结束时间
if (time() >= $complete_time){ if (strtotime($reservation_time) >= $complete_time){
return fail(HttpEnumCode::HTTP_ERROR, "已无法设置/修改视频时间,可立即发起视频"); return fail(HttpEnumCode::HTTP_ERROR, "预约时间不可超出视频问诊结束时间");
} }
// 获取是否已经预约 // 获取是否已经预约
@ -1389,7 +1390,6 @@ class InquiryService extends BaseService
$is_reservation = true; $is_reservation = true;
} }
// 创建订单
Db::beginTransaction(); Db::beginTransaction();
try { try {
@ -1466,14 +1466,18 @@ class InquiryService extends BaseService
$sendSmsService = new SendSmsService($user['mobile']); $sendSmsService = new SendSmsService($user['mobile']);
$sendSmsService->noticePatientVideoTime($user_doctor['user_name'],$reservation_time); $sendSmsService->noticePatientVideoTime($user_doctor['user_name'],$reservation_time);
// 增加延迟队列通知-视频问诊即将开始 // 增加延迟队列通知-视频问诊即将开始-时间大于5分钟
$time = strtotime($reservation_time) - 4*60; $time = strtotime($reservation_time) - 5*60;
$message = new SendVideoNoticeDelayDirectProducer($data); if ($time > time()){
$message->setDelayMs(1000 * $time); $data = array();
$producer = $this->container->get(Producer::class); $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
$res = $producer->produce($message); $message = new SendVideoNoticeDelayDirectProducer($data);
if (!$res) { $message->setDelayMs(1000 * (strtotime($reservation_time) - time()));
return fail(HttpEnumCode::SERVER_ERROR, "设置失败"); $producer = $this->container->get(Producer::class);
$res = $producer->produce($message);
if (!$res) {
return fail(HttpEnumCode::SERVER_ERROR, "设置失败");
}
} }
}catch (\Throwable $e){ }catch (\Throwable $e){
Log::getInstance("InquiryService-addDoctorGiveInquiryOrder")->error($e->getMessage()); Log::getInstance("InquiryService-addDoctorGiveInquiryOrder")->error($e->getMessage());