diff --git a/app/Amqp/Consumer/SendSmsMessageConsumer.php b/app/Amqp/Consumer/SendSmsMessageConsumer.php index 99bb2b2..1219cda 100644 --- a/app/Amqp/Consumer/SendSmsMessageConsumer.php +++ b/app/Amqp/Consumer/SendSmsMessageConsumer.php @@ -199,6 +199,12 @@ class SendSmsMessageConsumer extends ConsumerMessage return false; } break; + case 'SMS_463525093': + // 客服-通知客服 + if (!isset($template_param['code'])) { + return false; + } + break; default: // 非法模版 return false; diff --git a/app/Command/ReportPreProductOrderCommand.php b/app/Command/ReportPreProductOrderCommand.php index 9c3e277..6c23d29 100644 --- a/app/Command/ReportPreProductOrderCommand.php +++ b/app/Command/ReportPreProductOrderCommand.php @@ -7,6 +7,8 @@ namespace App\Command; use App\Exception\BusinessException; use App\Model\OrderPrescription; use App\Model\OrderProduct; +use App\Model\OrderSystem; +use App\Model\UserDoctor; use App\Model\UserPatient; use App\Services\MessagePush; use App\Services\OrderPrescriptionService; @@ -92,6 +94,19 @@ class ReportPreProductOrderCommand extends HyperfCommand // $OrderProductService->OrderProductRefund($item['order_product_id'],"药品订单退款"); Db::commit(); + + // 获取系统配置 + $params = array(); + $params['system_permission'] = "reportPreNotice"; + $order_system = OrderSystem::getOne($params); + if (!empty($order_system)){ + if ($order_system['is_sms'] == 1 && !empty($order_system['sms_mobile'])){ + // 客服-通知客服药品订单上报处方平台失败 + $MessagePush = new MessagePush(); + $MessagePush->noticeReport($order_product['order_product_no'],$order_system['sms_mobile']); + } + } + continue; } }catch(\Exception $e){ diff --git a/app/Model/OrderSystem.php b/app/Model/OrderSystem.php new file mode 100644 index 0000000..d5d7e3c --- /dev/null +++ b/app/Model/OrderSystem.php @@ -0,0 +1,82 @@ +first($fields); + } + + /** + * 获取数据-多 + * @param array $params + * @param array $fields + * @return Collection|array + */ + public static function getList(array $params = [], array $fields = ['*']): Collection|array + { + return self::where($params)->get($fields); + } + + /** + * 新增数据 + * @param array $data + * @return \Hyperf\Database\Model\Model|OrderSystem + */ + public static function addOrderSystem(array $data = []): \Hyperf\Database\Model\Model|OrderSystem + { + return self::create($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/MessagePush.php b/app/Services/MessagePush.php index 3982160..48066c9 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -2270,8 +2270,6 @@ class MessagePush extends BaseService * 订阅发送失败发送短信 * @param string $order_detection_id * @return void - * @throws ContainerExceptionInterface - * @throws NotFoundExceptionInterface */ public function patientDetectionResultNotice(string $order_detection_id): void { @@ -2389,4 +2387,33 @@ class MessagePush extends BaseService throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); } } + + /** + * 客服-通知客服 + * 短信 + * @param string $order_no + * @param string $mobile + * @return void + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function noticeReport(string $order_no,string $mobile): void + { + // 获取系统接诊配置 + $data = array(); + $data['template_code'] = "SMS_463525093"; + $data['scene_desc'] = "通知客服"; + $data['phone'] = $mobile; + + $template_param = array(); + $template_param['code'] = $order_no; + $data['template_param'] = $template_param; + + $message = new SendSmsMessageProducer($data); + $producer = ApplicationContext::getContainer()->get(Producer::class); + $result = $producer->produce($message); + if (!$result) { + throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE)); + } + } } \ No newline at end of file