user = $user->toArray(); } } if (!empty($order_inquiry_id)) { $params = array(); $params['order_inquiry_id'] = $order_inquiry_id; $order_inquiry = OrderInquiry::getOne($params); if (!empty($order_inquiry)) { $this->order_inquiry = $order_inquiry->toArray(); } } } /** * 患者-医生未接诊 * 快速/购药的服务5分钟未接诊 * 公益/专家24小时未接诊 * 站内、订阅 * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function patientNoInquiry(): void { try { // 站内 // 服务消息 $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 3; $data['notice_system_type'] = 1; $data['from_name'] = "肝胆小秘书"; if ($this->order_inquiry['inquiry_type'] == 1 || $this->order_inquiry['inquiry_type'] == 3) { // 专家-公益 $data['notice_brief_title'] = "您咨询的医生因工作繁忙没有时间接诊,点击查看详情。"; $data['notice_title'] = "您咨询的医生因工作繁忙没有时间接诊,点击查看详情。"; $data['notice_content'] = "您咨询的医生因工作繁忙,暂无空闲时间接诊。给您带来不便敬请谅解,平台会在24小时内进行退款,您可以点击订单详情查看退款详情。"; } elseif ($this->order_inquiry['inquiry_type'] == 2 || $this->order_inquiry['inquiry_type'] == 4) { // 快速-购药 $data['notice_brief_title'] = "您的咨询暂无医生接诊,点击查看详情。"; $data['notice_title'] = "您的咨询暂无医生接诊,点击查看详情。"; $data['notice_content'] = "当前咨询排队人员较多,暂无空闲医生接诊。给您带来不便敬请谅解,平台会在24小时内进行退款,您可以点击订单详情查看退款详情。"; } $data['link_type'] = 10;// 问诊订单详情 $link_params = array(); $link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; $data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数 $data['button_type'] = 4; // 订单详情 $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:" . json_encode($data,JSON_UNESCAPED_UNICODE)); } // 订阅 // 获取医生数据 $params = array(); $params['doctor_id'] = $this->order_inquiry['doctor_id']; $user_doctor = UserDoctor::getOne($params); if (empty($user_doctor)){ Log::getInstance("MessagePush")->error("错误:医生数据为空"); return; } $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "UOMww1S30Oq7rErJrqO8wN6lNEVKRo2fgcXnb0tBwHI";//问诊异常通知 $sub_data['params']['page'] = "pages/orderDetail/orderDetail?order_inquiry_id={$this->order_inquiry['order_inquiry_id']}"; $sub_data['params']['data'] = [ "character_string1" => (string)$this->order_inquiry['inquiry_no'],// 订单ID "name2" => (string)$user_doctor['user_name'],// 问诊医生 "date3" => $this->order_inquiry['created_at'],// 问诊时间 "thing4" => inquiryCancelReasonToPushString($this->order_inquiry['cancel_reason']),// 取消原因 "thing5" => "已进行退款处理,请注意查看账户信息",// 提示说明 ]; $data = array(); $data['sub_data'] = $sub_data; $data['sms_data'] = array(); $message = new SendSubMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } catch (\Exception $e) { Log::getInstance("MessagePush")->error("错误:" . $e->getMessage()); } } /** * 医生-通知患者回复 * 订阅 * @param string $content 回复内容 * @return bool * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function patientReplyNotice(string $content): bool { try { // 只有订阅消息 if ($this->push_type == 2){ $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "jhYUf91ULCTX_f69hazqAYwImdFf8ELasRAwB6X-MTM"; // 患者回复通知 $sub_data['params']['page'] = "Pages/yishi/wenzhen_v2/wenzhen"; $sub_data['params']['data'] = [ "thing1" => $this->user['user_name'],// 患者姓名 "thing2" => $content,// 回复内容 ]; $data = array(); $data['sub_data'] = $sub_data; $data['sms_data'] = array(); $message = new SendSubMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } } catch (\Exception $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } return true; } /** * 患者-通知患者医生已接诊 * 站内、订阅、短信 * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function patientAcceptedInquiry(): void { try { // 获取医生数据 $params = array(); $params['doctor_id'] = $this->order_inquiry['doctor_id']; $user_doctor = UserDoctor::getOne($params); if (empty($user_doctor)){ Log::getInstance("MessagePush")->error("错误:医生数据为空" ); return; } // 获取问诊订单关联病例 $params = array(); $params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; $order_inquiry_case = OrderInquiryCase::getOne($params); if (empty($order_inquiry_case)){ Log::getInstance("MessagePush")->error("错误:病例数据为空" ); return; } // 获取系统接诊配置 $params = array(); $params['inquiry_type'] = $this->order_inquiry['inquiry_type']; $params['inquiry_mode'] = $this->order_inquiry['inquiry_mode']; $system_inquiry_config = SystemInquiryConfig::getOne($params); if (empty($system_inquiry_config)) { Log::getInstance("MessagePush")->error("错误:获取系统接诊配置失败"); return; } // 站内 $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 3; $data['notice_system_type'] = 1; $data['from_name'] = "肝胆小秘书"; $data['notice_brief_title'] = "{$user_doctor['user_name']}医生已接诊,请尽快和医生进行沟通交流病情,点击查看详情"; $data['notice_title'] = "{$user_doctor['user_name']}医生已接诊,请尽快和医生进行沟通交流病情,点击查看详情"; $data['notice_content'] = "{$user_doctor['user_name']}医生已接诊,请您尽快和医生进行沟通交流病情,您可以点击问诊详情进行交流。"; $data['link_type'] = 1;// 聊天详情页 $link_params = array(); $link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; $link_params['inquiry_type'] = $this->order_inquiry['inquiry_type']; $link_params['doctor_user_id'] = $user_doctor['user_id']; $link_params['patient_user_id'] = $this->order_inquiry['user_id']; $data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数 $data['button_type'] = 6; // 问诊详情 $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } // 问诊内容-病情主诉 $disease_desc = $order_inquiry_case['disease_desc']; if (!empty($disease_desc)){ if (strlen($disease_desc) > 15){ $disease_desc = mb_substr($disease_desc,0,15); if ($disease_desc){ $disease_desc = $disease_desc . "..."; } } } // 订阅 $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "9v6dZhjg09CttLd3W9nEUV_-eshNc4BYYNy59jglvZE";// 问诊提醒 $sub_data['params']['page'] = "pages/orderDetail/orderDetail?order_inquiry_id={$this->order_inquiry['order_inquiry_id']}"; $sub_data['params']['data'] = [ "thing1" => (string)$disease_desc,// 问诊内容-病情主诉 "thing2" => "{$user_doctor['user_name']}医生已接诊,请您尽快和医生沟通交流病情",// 提醒内容 "name3" => (string)$user_doctor['user_name'],// 问诊医生 "thing4" => "点击查看问诊订单详情",// 提示说明 ]; $data = array(); $data['sub_data'] = $sub_data; $data['sms_data'] = array(); $message = new SendSubMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } // 短信 $duration = $system_inquiry_config['duration']; if ($duration <= 0){ $duration = "不限制"; }else{ $duration = $duration . "分钟"; } $data = array(); $data['template_code'] = "SMS_271955088"; $data['scene_desc'] = "通知患者医生已接诊"; $data['phone'] = $this->user['mobile']; $data['user_id'] = $this->user['user_id']; $template_param = array(); $template_param['type'] = inquiryTypeToString($this->order_inquiry['inquiry_type']); $template_param['name'] = $user_doctor['user_name']; $template_param['duration'] = $duration; // 服务时长 $data['template_param'] = $template_param; $message = new SendSmsMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } catch (\Exception $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } /** * 患者的问诊服务结束 * 站内、订阅 * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function patientInquiryFinish(): void { try { // 获取医生数据 $params = array(); $params['doctor_id'] = $this->order_inquiry['doctor_id']; $user_doctor = UserDoctor::getOne($params); if (empty($user_doctor)){ Log::getInstance("MessagePush")->error("错误:医生数据为空"); return; } // 获取问诊订单关联病例 $params = array(); $params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; $order_inquiry_case = OrderInquiryCase::getOne($params); if (empty($order_inquiry_case)){ Log::getInstance("MessagePush")->error("错误:病例数据为空" ); return; } // 站内 // 服务消息 $inquiry_type_string = inquiryTypeToString($this->order_inquiry['inquiry_type']); $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 3; $data['notice_system_type'] = 1; $data['from_name'] = "肝胆小秘书"; $data['notice_brief_title'] = "您的【{$inquiry_type_string}】服务已结束,点击查看详情。"; $data['notice_title'] = "您的【{$inquiry_type_string}】服务已结束,点击查看详情。"; $data['notice_content'] = "您咨询{$user_doctor['user_name']}医生的服务已结束,请对本次问诊服务做出评价。您的评价对医生和其他患者也有很重要的参考价值。您也可以点击医生头像,进入医生主页关注医生。"; $data['link_type'] = 10;// 聊天详情页 $link_params = array(); $link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; $link_params['inquiry_type'] = $this->order_inquiry['inquiry_type']; $link_params['doctor_user_id'] = $user_doctor['user_id']; $link_params['patient_user_id'] = $this->order_inquiry['user_id']; $data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数 $data['button_type'] = 4; // 订单详情 $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } // 问诊内容 $disease_desc = $order_inquiry_case['disease_desc']; if (!empty($disease_desc)){ $disease_desc = substr($disease_desc,0,15); if ($disease_desc){ $disease_desc = $disease_desc . "..."; } } // 订阅 $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "9v6dZhjg09CttLd3W9nEUV_-eshNc4BYYNy59jglvZE"; // 问诊提醒 $sub_data['params']['page'] = "pages/orderDetail/orderDetail?order_inquiry_id={$this->order_inquiry['order_inquiry_id']}"; $sub_data['params']['data'] = [ "thing1" => (string)$disease_desc,// 问诊内容 "thing2" => "您咨询{$user_doctor['user_name']}医生的服务已结束,请对本次问诊服务做出评价",// 提醒内容 "name3" => (string)$user_doctor['user_name'],// 问诊医生 "thing4" => "点击查看问诊订单详情",// 提示说明 ]; $data = array(); $data['sub_data'] = $sub_data; $data['sms_data'] = array(); $message = new SendSubMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } catch (\Exception $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } /** * 患者-处方被药师审核通过 * 站内、短信 * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function patientPrescriptionVerifyPass(): void { try { // 获取医生数据 $params = array(); $params['doctor_id'] = $this->order_inquiry['doctor_id']; $user_doctor = UserDoctor::getOne($params); if (empty($user_doctor)){ Log::getInstance("MessagePush")->error("错误:医生数据为空"); return ; } // 站内 // 服务消息 // 获取问诊订单处方数据 $params = array(); $params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; $params['doctor_id'] = $this->order_inquiry['doctor_id']; $params['pharmacist_audit_status'] = 1; $order_prescription = OrderPrescription::getOne($params); if (empty($order_prescription)) { Log::getInstance("MessagePush")->error("错误:处方数据为空"); return ; } $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 3; $data['notice_system_type'] = 1; $data['from_name'] = "肝胆小秘书"; $data['notice_brief_title'] = "{$user_doctor['user_name']}医生为您开具的电子处方已审核通过,点击查看详情。"; $data['notice_title'] = "{$user_doctor['user_name']}医生为您开具的电子处方已审核通过,点击查看详情。"; $data['notice_content'] = "{$user_doctor['user_name']}医生为您开具的电子处方已审核通过,您可以点击查看处方进行购买药品。"; $data['link_type'] = 13; $link_params = array(); $link_params['order_prescription_id'] = $order_prescription['order_prescription_id']; $data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数 $data['button_type'] = 5; // 查看处方 $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } // 短信 $data = array(); $data['template_code'] = "SMS_271540920"; $data['scene_desc'] = "处方审核通过"; $data['phone'] = $this->user['mobile']; $data['user_id'] = $this->user['user_id']; $template_param = array(); $template_param['name'] = $user_doctor['user_name']; $data['template_param'] = $template_param; $message = new SendSmsMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } catch (\Exception $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } /** * 患者-处方审核未通过 * 站内 * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function patientPrescriptionVerifyFail(): void { try { // 获取医生数据 $params = array(); $params['doctor_id'] = $this->order_inquiry['doctor_id']; $user_doctor = UserDoctor::getOne($params); if (empty($user_doctor)){ Log::getInstance("MessagePush")->error("错误:医生数据为空"); return ; } // 站内 // 服务消息 $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 3; $data['notice_system_type'] = 1; $data['from_name'] = "肝胆小秘书"; $data['notice_brief_title'] = "{$user_doctor['user_name']}医生为您开具的电子处方未通过审核,点击查看详情。"; $data['notice_title'] = "{$user_doctor['user_name']}医生为您开具的电子处方未通过审核,点击查看详情。"; $data['notice_content'] = "{$user_doctor['user_name']}医生为您开具的电子处方未通过审核,您可以稍后重新发起问诊申请开具处方。"; $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } catch (\Exception $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } /** * 患者-优惠劵发放 * 站内 * @param string $coupon_name * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function patientDistributeCoupon(string $coupon_name): void { try { $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 3; $data['notice_system_type'] = 2; // 系统消息类型(患者端系统消息存在 1:服务消息 2:福利消息 3:退款消息 4:物流消息) $data['from_name'] = "肝胆小秘书"; $data['notice_brief_title'] = "有新的优惠券已下发至您的账户,点击查看详情。"; $data['notice_title'] = "【{$coupon_name}】已到账"; $data['notice_content'] = "有新的优惠劵已下发至您的账户中,点击查看详情!"; $data['link_type'] = 7; $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } catch (\Exception $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } /** * 优惠劵退还 * 站内 * @param string $coupon_name * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function patientRefundCoupon(string $coupon_name): void { try { $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 3; $data['notice_system_type'] = 2; // 系统消息类型(患者端系统消息存在 1:服务消息 2:福利消息 3:退款消息 4:物流消息) $data['from_name'] = "肝胆小秘书"; $data['notice_brief_title'] = "优惠劵已退还至您的账户,点击查看详情。"; $data['notice_title'] = "【{$coupon_name}】已退还"; $data['notice_content'] = "您有优惠劵已退还至您的账户,请点击查看详情!"; $data['link_type'] = 7; $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } catch (\Exception $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } /** * 优惠劵过期 * 站内 * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function patientExpireCoupon(): void { try { $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 3; $data['notice_system_type'] = 2; // 系统消息类型(患者端系统消息存在 1:服务消息 2:福利消息 3:退款消息 4:物流消息) $data['from_name'] = "肝胆小秘书"; $data['notice_brief_title'] = "您有一张优惠劵即将过期,点击查看详情。"; $data['notice_title'] = "【优惠劵名称】即将过期"; $data['notice_content'] = "您有一张优惠劵即将过期,点击查看详情!"; $data['link_type'] = 7; $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } catch (\Exception $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } /** * 患者-问诊服务退款成功 * 站内、订阅、短信 * @param int $cancel_reason 取消订单原因(1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时) * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function refundInquirySuccess(int $cancel_reason): void { try { if (!empty($this->order_inquiry['doctor_id'])){ // 获取医生数据 $params = array(); $params['doctor_id'] = $this->order_inquiry['doctor_id']; $user_doctor = UserDoctor::getOne($params); if (empty($user_doctor)){ Log::getInstance("MessagePush")->error("错误:医生数据为空"); return ; } } // 站内 $inquiry_type_string = inquiryTypeToString($this->order_inquiry['inquiry_type']); $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 3; $data['notice_system_type'] = 3; $data['from_name'] = "肝胆小秘书"; if ($cancel_reason == 1){ // 已支付未接诊 $data['notice_brief_title'] = "您的【{$inquiry_type_string}】服务,平台已退款成功,点击查看详情"; if ($this->order_inquiry['inquiry_type'] == 1 || $this->order_inquiry['inquiry_type'] == 3){ $data['notice_title'] = "您的【{$inquiry_type_string}】服务,平台已退款成功"; $data['notice_content'] = "因医生繁忙未及时接诊,平台会在24小时内退款至原账户,给您带来的不便敬请谅解。"; }else{ $data['notice_title'] = "您的【{$inquiry_type_string}】服务,平台已退款成功"; $data['notice_content'] = "因当前候诊人较多,您的咨询暂无医生接诊。平台会在24小时内退款至原账户,给您带来的不便敬请谅解。"; } }elseif ($cancel_reason == 2){ // 已支付未成功分配医生 $data['notice_brief_title'] = "您的【{$inquiry_type_string}】服务已取消"; $data['notice_title'] = "您的【{$inquiry_type_string}】服务,平台已退款成功"; $data['notice_content'] = "因当前候诊人较多,您的咨询暂无医生接诊。平台会在24小时内退款至原账户,给您带来的不便敬请谅解。"; }elseif ($cancel_reason == 3){ // 已支付未接诊患者取消订单 $data['notice_brief_title'] = "您的【{$inquiry_type_string}】服务,平台 已退款成功,点击查看详情。"; $data['notice_title'] = "您的【{$inquiry_type_string}】服务已取消"; $data['notice_content'] = "您已成功取消当前服务,平台会在24小时内退款至原账户,感谢您的支持。"; }else{ Log::getInstance("MessagePush")->error("错误:类型错误"); return ; } $data['link_type'] = 10;// 问诊订单详情 $link_params = array(); $link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; $data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数 $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } // 订阅 $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "UOMww1S30Oq7rErJrqO8wN6lNEVKRo2fgcXnb0tBwHI"; //问诊异常通知 $sub_data['params']['page'] = "pages/orderDetail/orderDetail?order_inquiry_id={$this->order_inquiry['order_inquiry_id']}"; $sub_data['params']['data'] = [ "character_string1" => $this->order_inquiry['inquiry_no'],// 订单ID "name2" => (string)$user_doctor['user_name'] ?? "无",// 问诊医生 "date3" => $this->order_inquiry['created_at'],// 问诊时间 "thing4" => inquiryCancelReasonToPushString($cancel_reason),// 取消原因 "thing5" => "已进行退款处理,请注意查看账户信息。",// 提示说明 ]; $data = array(); $data['sub_data'] = $sub_data; $data['sms_data'] = array(); $message = new SendSubMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } // 短信 // 获取系统接诊配置 $data = array(); $data['template_code'] = "SMS_272180110"; $data['scene_desc'] = "患者问诊退款"; $data['phone'] = $this->user['mobile']; $data['user_id'] = $this->user['user_id']; $template_param = array(); $template_param['type'] = inquiryTypeToString($this->order_inquiry['inquiry_type']); $data['template_param'] = $template_param; $message = new SendSmsMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } catch (\Exception $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } /** * 患者-药品订单退款成功 * 站内、订阅、短信 * @param string $order_product_id * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function refundProductSuccess(string $order_product_id): void { try { // 获取药品订单数据 $params = array(); $params['order_product_id'] = $order_product_id; $order_product = OrderProduct::getOne($params); if (empty($order_product)){ Log::getInstance("MessagePush")->error("错误:药品订单数据为空"); return ; } $order_product = $order_product->toArray(); // 获取药品订单商品数据 $params = array(); $params['order_product_id'] = $order_product_id; $order_product_item = OrderProductItem::getList($params); if (empty($order_product_item)){ Log::getInstance("MessagePush")->error("错误:商品订单列表数据为空"); return ; } // 获取商品数据 $product_name_array = array(); foreach ($order_product_item as $item){ $params = array(); $params['product_id'] = $item['product_id']; $product = Product::getOne($params); if (empty($product)){ Log::getInstance("MessagePush")->error("错误:商品数据为空"); return ; } $product_name_array[] = $product['common_name']; } $product_name = ""; if (!empty($product_name_array)){ if (count($product_name_array) > 1){ $product_name = implode('、',$product_name_array); }else{ $product_name = $product_name_array[0]; } } // 站内 $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 3; $data['notice_system_type'] = 3; $data['from_name'] = "肝胆小秘书"; $data['notice_brief_title'] = "您购买的【{$product_name}】药品,平台已退款成功,点击查看详情"; $data['notice_title'] = "您购买的【{$product_name}】药品,平台已退款成功"; $data['notice_content'] = "受特别因素影响,您的药品无法正常配送。平台已退款至原账户,给您带来的不便敬请谅解。"; $data['link_type'] = 8;// 药品订单详情页 $link_params = array(); $link_params['order_product_id'] = $order_product_id; $data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数 $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } // 订阅 $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "gQO5vhPQfdnvXtK0XnGns1XqNhQpOrXTjdl-5HWWMUw";//药品订单取消通知 $sub_data['params']['page'] = "pages/medinceOrderDetail/medinceOrderDetail?order_product_id={$order_product_id}"; $sub_data['params']['data'] = [ "character_string3" => (string)$order_product['order_product_no'],// 订单号 "time5" => $order_product['cancel_time'],// 取消时间 "amount4" => $order_product['payment_amount_total'],// 退款金额 "thing1" => "受特别因素影响,您的药品无法正常配送",// 取消原因 "thing6" => "点击详情查看",// 温馨提示 ]; $data = array(); $data['sub_data'] = $sub_data; $data['sms_data'] = array(); $message = new SendSubMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } // 短信 // 获取系统接诊配置 $data = array(); $data['template_code'] = "SMS_271955204"; $data['scene_desc'] = "患者药品费用退款"; $data['phone'] = $this->user['mobile']; $data['user_id'] = $this->user['user_id']; $template_param = array(); $template_param['name'] = $product_name; $template_param['status'] = productCancelReasonToString($order_product['cancel_reason']); $data['template_param'] = $template_param; $message = new SendSmsMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } catch (\Exception $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } /** * 物流信息-暂时无法开发,无物流信息表 * 已揽收、已发货、自动收货 * 站内 * @param string $order_product_id * @return bool */ public function logistics(string $order_product_id): bool { try { } catch (\Exception $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } return true; } /** * 药品已发货 * 订阅失败发送短信 * @param string $order_product_id * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function ProductDelivery(string $order_product_id): void { try { // 获取药品订单数据 $params = array(); $params['order_product_id'] = $order_product_id; $order_product = OrderProduct::getOne($params); if (empty($order_product)){ Log::getInstance("MessagePush")->error("错误:药品订单数据为空"); return ; } $order_product = $order_product->toArray(); // 获取药品订单商品数据 $params = array(); $params['order_product_id'] = $order_product_id; $order_product_item = OrderProductItem::getList($params); if (empty($order_product_item)){ Log::getInstance("MessagePush")->error("错误:商品订单列表数据为空"); return ; } // 获取商品数据 $product_name_array = array(); foreach ($order_product_item as $item){ $params = array(); $params['product_id'] = $item['product_id']; $product = Product::getOne($params); if (empty($product)){ Log::getInstance("MessagePush")->error("错误:商品数据为空"); return ; } $product_name_array[] = $product['common_name']; } $product_name = ""; if (!empty($product_name_array)){ if (count($product_name_array) > 1){ $product_name = implode('、',$product_name_array); }else{ $product_name = $product_name_array[0]; } } // 订阅 $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "YFdVxDclV1ZjhS7E4Cs0zFdshTRizERpwYdZizj_UWo"; // 药品发货通知 $sub_data['params']['page'] = "pages/orderDetail/orderDetail?order_inquiry_id={$this->order_inquiry['order_inquiry_id']}"; $sub_data['params']['data'] = [ "character_string9" => (string)$order_product['order_product_no'],// 快递单号 "time7" => $order_product['delivery_time'],// 发货时间 "thing3" => $order_product['province'] . $order_product['city'] . $order_product['county'],// 收货地址 "thing6" => $order_product['consignee_name'],// 收货人 "thing5" => "您的药品已发货,点击可以查看订单详情。",// 备注 ]; // 短信 $sms_data = array(); $sms_data['template_code'] = "SMS_271980127"; $sms_data['scene_desc'] = "药品发货通知"; $sms_data['phone'] = $this->user['mobile']; $sms_data['user_id'] = $this->user['user_id']; $template_param = array(); $template_param['name'] = $product_name; $template_param['code'] = $order_product['logistics_no'] ?: ""; $sms_data['template_param'] = $template_param; $data = array(); $data['sub_data'] = $sub_data; $data['sms_data'] = $sms_data; $message = new SendSubMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } catch (\Exception $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } /** * 药品收货-用药提醒-无法开发, * 订阅失败发送短信 * @param string $order_product_id * @return bool * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function medicationReminder(string $order_product_id): bool { try { } catch (\Exception $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } return true; } /** * 医生-医生有新问诊 * 站内、订阅失败发送短信 * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function doctorHaveNewInquiry(): void { try { // 获取医生数据 $params = array(); $params['doctor_id'] = $this->order_inquiry['doctor_id']; $user_doctor = UserDoctor::getOne($params); if (empty($user_doctor)){ Log::getInstance("MessagePush")->error("错误:医生数据为空"); return; } // 获取问诊订单关联病例 $params = array(); $params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; $order_inquiry_case = OrderInquiryCase::getOne($params); if (empty($order_inquiry_case)){ Log::getInstance("MessagePush")->error("错误:病例数据为空" ); return; } // 站内 $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 1; $data['inquiry_type'] = $this->order_inquiry['inquiry_type']; // 问诊类型(医生端服务通知存在 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药) $data['from_name'] = "肝胆小秘书"; $data['notice_brief_title'] = "您有新的问诊咨询,请及时处理。"; $data['notice_title'] = "您有新的问诊咨询,请及时处理。"; $data['notice_content'] = "您有新的问诊咨询,请及时处理。"; $data['link_type'] = 1; // 聊天详情页 $link_params = array(); $link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; $link_params['inquiry_type'] = $this->order_inquiry['inquiry_type']; $link_params['doctor_user_id'] = $user_doctor['user_id']; $link_params['patient_user_id'] = $this->order_inquiry['user_id']; $data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数 $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } // 订阅 $inquiry_type = inquiryTypeToString($this->order_inquiry['inquiry_type']); // 问诊内容-病情主诉 $disease_desc = $order_inquiry_case['disease_desc']; if (!empty($disease_desc)){ if (strlen($disease_desc) > 15){ $disease_desc = mb_substr($disease_desc,0,15); if ($disease_desc){ $disease_desc = $disease_desc . "..."; } } } $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "G1RIs0RYqsTQ2CuPQWalIMyb6_deuEEbJfajfhGvNzc";//咨询提醒 $sub_data['params']['page'] = "Pages/yishi/wenzhen_v2/wenzhen"; $sub_data['params']['data'] = [ "thing1" => "您有一个新的待接诊({$inquiry_type})服务",// 提醒内容 "name2" => (string)$this->order_inquiry['patient_name'],// 患者姓名 "thing4" => (string)$disease_desc,// 病情描述 "thing6" => "24小时内未接诊,平台将自动取消问诊",// 提示说明 "thing5" => "",// 咨询内容 ]; // 短信 $sms_data = array(); $sms_data['template_code'] = "SMS_272015117"; $sms_data['scene_desc'] = "医生接到新问诊"; $sms_data['phone'] = $this->user['mobile']; $sms_data['user_id'] = $this->user['user_id']; $template_param = array(); $template_param['type'] = inquiryTypeToString($this->order_inquiry['inquiry_type']); $sms_data['template_param'] = $template_param; $data = array(); $data['sub_data'] = $sub_data; $data['sms_data'] = $sms_data; $message = new SendSubMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入订阅推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } catch (\Exception $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } /** * 医生xx时间后还未接诊 * 站内、订阅失败发送短信 * @return bool * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function doctorNotYetInquiry(): bool { try { // 获取问诊订单关联病例 $params = array(); $params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; $order_inquiry_case = OrderInquiryCase::getOne($params); if (empty($order_inquiry_case)){ throw new BusinessException("加入推送队列失败:问诊病例为空"); } if ($this->push_type == 1) { // 站内 $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 1; $data['inquiry_type'] = $this->order_inquiry['inquiry_type']; // 问诊类型(医生端服务通知存在 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药) $data['from_name'] = "肝胆小秘书"; $data['notice_brief_title'] = "{$this->order_inquiry['patient_name']}患者的问诊您还未接诊,请注意查看。"; $data['notice_title'] = "{$this->order_inquiry['patient_name']}患者的问诊您还未接诊,请注意查看。"; $data['notice_content'] = "{$this->order_inquiry['patient_name']}患者的问诊您还未接诊,请注意查看。"; $data['link_type'] = 1; // 聊天详情页 $link_params = array(); $link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; $link_params['inquiry_type'] = $this->order_inquiry['inquiry_type']; $link_params['doctor_user_id'] = $this->user['user_id']; $link_params['patient_user_id'] = $this->order_inquiry['user_id']; $data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数 $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } elseif ($this->push_type == 2) { // 订阅 $inquiry_type = inquiryTypeToString($this->order_inquiry['inquiry_type']); $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "G1RIs0RYqsTQ2CuPQWalIMyb6_deuEEbJfajfhGvNzc"; // 咨询提醒 $sub_data['params']['page'] = "Pages/yishi/wenzhen_v2/wenzhen"; $sub_data['params']['data'] = [ "thing1" => "您好医生,{$this->order_inquiry['patient_name']}患者的({$inquiry_type})服务您还未接诊;",// 提醒内容 "name2" => $this->order_inquiry['patient_name'],// 患者姓名 "thing4" => mb_substr($order_inquiry_case['disease_desc'],0,18),// 病情描述 "thing6" => "24小时内未接诊,平台将自动取消问诊。",// 提示说明 "thing5" => "",// 咨询内容 ]; // 短信 $sms_data = array(); $sms_data['template_code'] = "SMS_271905266"; $sms_data['scene_desc'] = "医生xx时间后还未接诊"; $sms_data['phone'] = $this->user['mobile']; $sms_data['user_id'] = $this->user['user_id']; $template_param = array(); $template_param['type'] = inquiryTypeToString($this->order_inquiry['inquiry_type']); $template_param['name'] = $this->order_inquiry['patient_name']; $sms_data['template_param'] = $template_param; $data = array(); $data['sub_data'] = $sub_data; $data['sms_data'] = $sms_data; $message = new SendSubMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } } catch (\Exception $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } return true; } /** * 医生-问诊结束 * 站内 * 发送给医生 * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function finishInquiryToDoctor(): void { try { // 获取问诊订单关联病例 $params = array(); $params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; $order_inquiry_case = OrderInquiryCase::getOne($params); if (empty($order_inquiry_case)){ Log::getInstance("MessagePush")->error("错误:问诊病例为空" ); return ; } // 站内 $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 1; $data['inquiry_type'] = $this->order_inquiry['inquiry_type']; // 问诊类型(医生端服务通知存在 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药) $data['from_name'] = "肝胆小秘书"; $data['notice_brief_title'] = "{$this->order_inquiry['patient_name']}患者的问诊已结束,请注意查看。"; $data['notice_title'] = "{$this->order_inquiry['patient_name']}患者的问诊已结束,请注意查看。"; $data['notice_content'] = "{$this->order_inquiry['patient_name']}患者的问诊已结束,请注意查看。"; $data['link_type'] = 3; // 问诊消息列表页 $link_params = array(); $link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; $link_params['inquiry_type'] = $this->order_inquiry['inquiry_type']; $link_params['patient_user_id'] = $this->order_inquiry['user_id']; $data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数 $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } catch (\Exception $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } /** * 医生-开具的处方审核通过 * 站内、订阅失败发送短信 * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function prescriptionVerifySuccess(): void { try { // 获取问诊订单处方数据 $params = array(); $params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; $params['doctor_id'] = $this->order_inquiry['doctor_id']; $params['pharmacist_audit_status'] = 1; $order_prescription = OrderPrescription::getOne($params); if (empty($order_prescription)) { Log::getInstance("MessagePush")->error("错误:处方数据为空" ); return ; } // 站内 $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 1; $data['inquiry_type'] = $this->order_inquiry['inquiry_type']; // 问诊类型(医生端服务通知存在 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药) $data['from_name'] = "肝胆小秘书"; $data['notice_brief_title'] = "处方审核通过"; $data['notice_title'] = "处方审核通过"; $data['notice_content'] = "{$this->order_inquiry['patient_name']}患者的电子处方已审核通过,请注意查看。"; $data['link_type'] = 1; // 聊天详情页 $link_params = array(); $link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; $link_params['inquiry_type'] = $this->order_inquiry['inquiry_type']; $link_params['doctor_user_id'] = $this->user['user_id']; $link_params['patient_user_id'] = $this->order_inquiry['user_id']; $data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数 $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } // 订阅 $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "kUy70xHlr7ADo4aIHiictM4Te7MSec3E5kHsYvFQu40"; // 处方审核结果通知 $sub_data['params']['page'] = "Pages/yishi/chufangsetup/index"; $sub_data['params']['data'] = [ "phrase1" => "药师审方通过",// 审核结果 "thing2" => "审核通过",// 原因 "date3" => $order_prescription['pharmacist_verify_time'],// 审核时间 "thing4" => "建议您向患者补充说明如何用药",// 提示说明 ]; // 短信 $sms_data = array(); $sms_data['template_code'] = "SMS_272120097"; $sms_data['scene_desc'] = "您为{$this->order_inquiry['patient_name']}患者开具的电子处方药师已审核通过,尽快和患者完成交流并提醒患者购药。请前往微信小程序“问诊消息”进行操作。"; $sms_data['phone'] = $this->user['mobile']; $sms_data['user_id'] = $this->user['user_id']; $template_param = array(); $template_param['name'] = $this->order_inquiry['patient_name']; $sms_data['template_param'] = $template_param; $data = array(); $data['sub_data'] = $sub_data; $data['sms_data'] = $sms_data; $message = new SendSubMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } catch (\Exception $e) { Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } /** * 医生-开具的处方审核未通过 * 订阅失败发送短信 * @param string $order_prescription_id * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function prescriptionVerifyFail(string $order_prescription_id): void { try { // 获取问诊订单处方数据 $params = array(); $params['order_prescription_id'] = $order_prescription_id; $order_prescription = OrderPrescription::getOne($params); if (empty($order_prescription)) { Log::getInstance("MessagePush")->error("错误:处方数据为空" ); return ; } // 订阅 $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "kUy70xHlr7ADo4aIHiictM4Te7MSec3E5kHsYvFQu40"; // 处方审核结果通知 $sub_data['params']['page'] = "Pages/yishi/chufangsetup/index"; $sub_data['params']['data'] = [ "phrase1" => "药师审方不通过",// 审核结果 "thing2" => (string)$order_prescription['pharmacist_fail_reason'],// 原因 "date3" => date('Y-m-d',time()),// 审核时间 "thing4" => "建议您提醒患者,稍后重新发起问诊申请开方",// 提示说明 ]; // 短信 $sms_data = array(); $sms_data['template_code'] = "SMS_271905264"; $sms_data['scene_desc'] = "您为{$this->order_inquiry['patient_name']}患者开具的电子处方药师审核不通过,请尽快前往微信小程序“处方管理”中查看原因,并重开处方。模版code:SMS_271905264"; $sms_data['phone'] = $this->user['mobile']; $sms_data['user_id'] = $this->user['user_id']; $template_param = array(); $template_param['name'] = $this->order_inquiry['patient_name']; $sms_data['template_param'] = $template_param; $data = array(); $data['sub_data'] = $sub_data; $data['sms_data'] = $sms_data; $message = new SendSubMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } catch (\Exception $e) { Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . $e->getMessage()); } } /** * 医师身份通过 * 短信 * @return bool * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function DoctorIdenAuthSuccess(): bool { try { if ($this->push_type == 3) { // 短信 // 获取系统接诊配置 $data = array(); $data['template_code'] = "SMS_271925089"; $data['scene_desc'] = "医师身份通过"; $data['phone'] = $this->user['mobile']; $data['user_id'] = $this->user['user_id']; $template_param = array(); $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)); } } } catch (\Exception $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } return true; } /** * 医师身份未通过 * 短信 * @return bool * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function DoctorIdenAuthFail(): bool { try { if ($this->push_type == 3) { // 短信 // 获取系统接诊配置 $data = array(); $data['template_code'] = "SMS_271905155"; $data['scene_desc'] = "医师身份未通过"; $data['phone'] = $this->user['mobile']; $data['user_id'] = $this->user['user_id']; $template_param = array(); $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)); } } } catch (\Exception $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } return true; } /** * 多点执业认证审核通过 * 站内、订阅发送失败发送短信 * @return bool * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function doctorMultiPointSuccess(): bool { try { if ($this->push_type == 1) { // 站内 $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 1; $data['from_name'] = "肝胆小秘书"; $data['notice_title'] = "多点执业认证审核结果"; $data['notice_brief_title'] = "您提交的多点执业认证审核通过,查看详情;"; $data['notice_content'] = "{$this->user['user_name']}医生,您提交的多点执业认证审核通过,现在可以为患者开具电子处方了;"; $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } elseif ($this->push_type == 2) { // 订阅 // 获取医生数据 $params = array(); $params['doctor_id'] = $this->order_inquiry['doctor_id']; $user_doctor = UserDoctor::getOne($params); if (empty($user_doctor)){ throw new BusinessException("加入推送队列失败:医生数据为空"); } $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "XWfEQYtb8_ubz8pCs3GoCG6TFxpDz9jn52895yvDm3s";// 审核结果通知 $sub_data['params']['page'] = "Pages/index/index"; $sub_data['params']['data'] = [ "thing1" => "多点执业认证审核通过",// 审核结果 "thing2" => "多点执业认证",// 审核内容 "time3" => $user_doctor['multi_point_time'],// 审核时间 "thing4" => "您提交的多点执业认证审核通过,点击查看详情。",// 备注 ]; // 短信 $sms_data = array(); $sms_data['template_code'] = "SMS_271575911"; $sms_data['scene_desc'] = "多点执业认证审核通过"; $sms_data['phone'] = $this->user['mobile']; $sms_data['user_id'] = $this->user['user_id']; $template_param = array(); $sms_data['template_param'] = $template_param; $data = array(); $data['sub_data'] = $sub_data; $data['sms_data'] = $sms_data; $message = new SendSubMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } } catch (\Exception $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } return true; } /** * 多点执业认证审核未通过 * 站内、订阅发送失败发送短信 * @return bool * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function doctorMultiPointFail(): bool { try { if ($this->push_type == 1) { // 站内 $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 1; $data['from_name'] = "肝胆小秘书"; $data['notice_title'] = "多点执业认证审核结果"; $data['notice_brief_title'] = "您提交的多点执业认证审核拒绝,查看详情;"; $data['notice_content'] = "{$this->user['user_name']}医生,您提交的多点执业认证审核未通过,请查看原因重新提交;"; $data['link_type'] = 4;// 我的名片 $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } elseif ($this->push_type == 2) { // 订阅 // 获取医生数据 $params = array(); $params['doctor_id'] = $this->order_inquiry['doctor_id']; $user_doctor = UserDoctor::getOne($params); if (empty($user_doctor)){ throw new BusinessException("加入推送队列失败:医生数据为空"); } $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "bGGoKtDZC23GZtrrxuy6i5V7OhHgRgwXWx4yoDO1tlA";//资格审核未通过通知 $sub_data['params']['page'] = "Pages/index/index"; $sub_data['params']['data'] = [ "thing1" => "{$this->user['user_name']}医生您好,多点执业认证审核没有通过,请重新提交",// 温馨提示 "thing2" => $user_doctor['multi_point_fail_reason'],// 驳回理由 "time3" => $user_doctor['multi_point_time'],// 审核时间 ]; // 短信 $sms_data = array(); $sms_data['template_code'] = "SMS_272030021"; $sms_data['scene_desc'] = "多点执业认证审核未通过"; $sms_data['phone'] = $this->user['mobile']; $sms_data['user_id'] = $this->user['user_id']; $template_param = array(); $sms_data['template_param'] = $template_param; $data = array(); $data['sub_data'] = $sub_data; $data['sms_data'] = $sms_data; $message = new SendSubMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } } catch (\Exception $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } return true; } /** * 医生简介审核通过-因缺少简介表,审核时间使用的是当前时间 * 站内、订阅发送失败发送短信 * @return bool * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function doctorBriefSuccess(): bool { try { // 获取医生数据 $params = array(); $params['doctor_id'] = $this->order_inquiry['doctor_id']; $user_doctor = UserDoctor::getOne($params); if (empty($user_doctor)){ throw new BusinessException("加入推送队列失败:医生数据为空"); } if ($this->push_type == 1) { // 站内 $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 1; $data['from_name'] = "肝胆小秘书"; $data['notice_title'] = "简介信息审核结果"; $data['notice_brief_title'] = "{$this->user['user_name']}医生,您修改的简介信息审核通过,快去通知患者吧;"; $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } elseif ($this->push_type == 2) { // 订阅 $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "XWfEQYtb8_ubz8pCs3GoCG6TFxpDz9jn52895yvDm3s"; // 审核结果通知 $sub_data['params']['page'] = "Pages/index/index"; $sub_data['params']['data'] = [ "thing1" => "医师简介审核通过;",// 审核结果 "thing2" => "医师简介",// 审核内容 "time3" => date('Y-m-d H:i:s',time()),// 审核时间 "thing4" => "{$user_doctor['user_name']}医生,您修改的简介信息审核通过,快去通知患者吧。",// 备注 ]; // 短信 $sms_data = array(); $sms_data['template_code'] = "SMS_271990126"; $sms_data['scene_desc'] = "医生简介审核通过"; $sms_data['phone'] = $this->user['mobile']; $sms_data['user_id'] = $this->user['user_id']; $template_param = array(); $sms_data['template_param'] = $template_param; $data = array(); $data['sub_data'] = $sub_data; $data['sms_data'] = $sms_data; $message = new SendSubMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } } catch (\Exception $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } return true; } /** * 医生简介审核未通过-因缺少简介表,审核时间使用的是当前时间,驳回理由未填写 * 站内、订阅发送失败发送短信 * @return bool * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function doctorBriefFail(): bool { try { if ($this->push_type == 1) { // 站内 $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 1; $data['from_name'] = "肝胆小秘书"; $data['notice_title'] = "简介信息审核结果"; $data['notice_brief_title'] = "{$this->user['user_name']}医生,您修改的简介信息审核未通过,请查看原因重新提交;"; $data['link_type'] = 5;// 我的简介 $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } elseif ($this->push_type == 2) { // 订阅 // 获取医生数据 $params = array(); $params['doctor_id'] = $this->order_inquiry['doctor_id']; $user_doctor = UserDoctor::getOne($params); if (empty($user_doctor)){ throw new BusinessException("加入推送队列失败:医生数据为空"); } $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "bGGoKtDZC23GZtrrxuy6i5V7OhHgRgwXWx4yoDO1tlA"; // 资格审核未通过通知 $sub_data['params']['page'] = "Pages/index/index"; $sub_data['params']['data'] = [ "thing1" => "{$this->user['user_name']}医生您好,简介信息审核没有通过,请重新提交",// 温馨提示 "thing2" => "未知",// 驳回理由 "time3" => date('Y-m-d H:i:s',time()),// 审核时间 ]; // 短信 $sms_data = array(); $sms_data['template_code'] = "SMS_272165092"; $sms_data['scene_desc'] = "简介信息认证审核未通过"; $sms_data['phone'] = $this->user['mobile']; $sms_data['user_id'] = $this->user['user_id']; $template_param = array(); $sms_data['template_param'] = $template_param; $data = array(); $data['sub_data'] = $sub_data; $data['sms_data'] = $sms_data; $message = new SendSubMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } } catch (\Exception $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } return true; } /** * 医师服务费结算成功 * 站内、短信 * @param string $withdrawal_id * @return bool * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function doctorSettlementSuccess(string $withdrawal_id) { try { // 获取医生提现表数据 $params = array(); $params['withdrawal_id'] = $withdrawal_id; $doctor_withdrawal = DoctorWithdrawal::getOne($params); if (empty($doctor_withdrawal)){ Log::getInstance("MessagePush")->error("错误:提现数据为空" ); return ; } if ($this->push_type == 1) { // 站内 // 计算时间 $created_at = date('Y',strtotime($doctor_withdrawal['created_at'])); $now_year = date('Y',time()); if ($created_at != $now_year){ $created_at = date('Y',strtotime($doctor_withdrawal['created_at'])) . '年' . date('m',strtotime($doctor_withdrawal['created_at'])) . "月"; }else{ $created_at = date('m',strtotime($doctor_withdrawal['created_at'])) . '月' . date('m',strtotime($doctor_withdrawal['created_at'])) . "日"; } $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 2; $data['from_name'] = "肝胆小秘书"; $data['notice_brief_title'] = "{$created_at}提取的服务费已结算;"; $data['notice_title'] = "{$created_at}提取的服务费已结算"; $data['notice_content'] = "{$this->user['user_name']}医生您好,您{$created_at}提取的服务费已结算至您的银行卡,请注意查收。"; $data['link_type'] = 6;// 我的账户 $data['button_type'] = 1;// 我的账户 $link_params = array(); $data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数 $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } elseif ($this->push_type == 3) { // 短信 // 获取系统接诊配置 $data = array(); $data['template_code'] = "SMS_271915200"; $data['scene_desc'] = "医师服务费结算成功"; $data['phone'] = $this->user['mobile']; $data['user_id'] = $this->user['user_id']; $template_param = array(); $template_param['name'] = $this->user['user_name']; $template_param['time'] = date('Y-m-d H:i',strtotime($doctor_withdrawal['created_at'])); $data['template_param'] = $template_param; $message = new SendSmsMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } } catch (\Exception $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } return true; } /** * 医师服务费结算失败 * 站内、短信 * @param string $withdrawal_id * @return bool * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function doctorSettlementFail(string $withdrawal_id): bool { try { // 获取医生提现表数据 $params = array(); $params['withdrawal_id'] = $withdrawal_id; $doctor_withdrawal = DoctorWithdrawal::getOne($params); if (empty($doctor_withdrawal)){ throw new BusinessException("加入推送队列失败:提现数据为空"); } if ($this->push_type == 1) { // 站内 // 计算时间 $created_at = date('Y',strtotime($doctor_withdrawal['created_at'])); $now_year = date('Y',time()); if ($created_at != $now_year){ $created_at = date('Y',strtotime($doctor_withdrawal['created_at'])) . '年' . date('m',strtotime($doctor_withdrawal['created_at'])) . "月"; }else{ $created_at = date('m',strtotime($doctor_withdrawal['created_at'])) . '月' . date('m',strtotime($doctor_withdrawal['created_at'])) . "日"; } $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 2; $data['from_name'] = "肝胆小秘书"; $data['notice_brief_title'] = "{$created_at}提取的服务费结算失败"; $data['notice_title'] = "{$created_at}服务费结算失败"; $data['notice_content'] = "{$this->user['user_name']}医生您好,您{$created_at}提取的服务费结算失败,肝胆小秘书会尽快和您取得联系,您也可以选择联系客服主动联系。"; $data['link_type'] = 11;// 联系客服 $data['button_type'] = 2;// 联系客服 $link_params = array(); $data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数 $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } elseif ($this->push_type == 3) { // 短信 // 获取系统接诊配置 $data = array(); $data['template_code'] = "SMS_271915200"; $data['scene_desc'] = "医师服务费结算失败"; $data['phone'] = $this->user['mobile']; $data['user_id'] = $this->user['user_id']; $template_param = array(); $template_param['name'] = $this->user['user_name']; $template_param['time'] = date('Y-m-d H:i',strtotime($doctor_withdrawal['created_at'])); $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)); } } } catch (\Exception $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } return true; } /** * 小程序升级通知 * 站内 * @param string $date 日期 * @param string $function 功能 * @return bool * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function doctorSystemUpgrade(string $date,string $function): bool { try { if ($this->push_type == 1) { // 站内 $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 2; $data['from_name'] = "肝胆小秘书"; $data['notice_brief_title'] = $date . "会更新新的功能,敬请期待"; $data['notice_title'] = "系统升级"; $data['notice_content'] = "{$this->user['user_name']}医生,{$date}会更新{$function}功能,敬请期待;"; $link_params = array(); $data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数 $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } } catch (\Exception $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } return true; } /** * 小程序升级通知 * 站内 * @param string $title 协议名称 * @return bool * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function doctorAgreementUpdate(string $title): bool { try { if ($this->push_type == 1) { // 站内 $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 2; $data['from_name'] = "肝胆小秘书"; $data['notice_brief_title'] = "平台对【{$title}】协议进行了更新,请注意查收"; $data['notice_title'] = "协议更新"; $data['notice_content'] = "{$this->user['user_name']}医生,平台对【{$title}】协议进行了更新,请注意查收"; $link_params = array(); $data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数 $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } } catch (\Exception $e) { throw new BusinessException("加入推送队列失败" . $e->getMessage()); } return true; } /** * 医生-患者取消问诊 * 站内-订阅 * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function patientCancelInquiryToDoctor(): void { try { // 获取医生数据 $params = array(); $params['doctor_id'] = $this->order_inquiry['doctor_id']; $user_doctor = UserDoctor::getOne($params); if (empty($user_doctor)){ Log::getInstance("MessagePush")->error("错误:医生数据为空" ); } // 获取问诊订单关联病例 $params = array(); $params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; $order_inquiry_case = OrderInquiryCase::getOne($params); if (empty($order_inquiry_case)){ Log::getInstance("MessagePush")->error("错误:病例数据为空" ); return; } // 站内 $data = array(); $data['user_id'] = $this->user['user_id']; $data['notice_type'] = 1; $data['inquiry_type'] = $this->order_inquiry['inquiry_type']; // 问诊类型(医生端服务通知存在 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药) $data['from_name'] = "肝胆小秘书"; $data['notice_brief_title'] = "患者已取消问诊咨询。。"; $data['notice_title'] = inquiryTypeToString($this->order_inquiry['inquiry_type']); $data['notice_content'] = "患者已取消问诊咨询,您可选择其他患者的问诊咨询进行接诊。"; $data['link_type'] = 3; // 问诊消息列表页 $link_params = array(); $link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; $link_params['inquiry_type'] = $this->order_inquiry['inquiry_type']; $link_params['doctor_user_id'] = $user_doctor['user_id']; $link_params['patient_user_id'] = $this->order_inquiry['user_id']; $data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数 $message = new SendStationMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } // 问诊内容-病情主诉 $disease_desc = $order_inquiry_case['disease_desc']; if (!empty($disease_desc)){ if (strlen($disease_desc) > 15){ $disease_desc = mb_substr($disease_desc,0,15); if ($disease_desc){ $disease_desc = $disease_desc . "..."; } } } $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "G1RIs0RYqsTQ2CuPQWalIMyb6_deuEEbJfajfhGvNzc";//咨询提醒 $sub_data['params']['page'] = "Pages/yishi/wenzhen_v2/wenzhen"; $sub_data['params']['data'] = [ "thing1" => "问诊咨询已取消",// 提醒内容 "name2" => (string)$this->order_inquiry['patient_name'],// 患者姓名 "thing4" => (string)$disease_desc,// 病情描述 "thing6" => "您可以选择其他患者的问诊咨询进行接诊",// 提示说明 "thing5" => "",// 咨询内容 ]; $data = array(); $data['sub_data'] = $sub_data; $data['sms_data'] = []; $message = new SendSubMessageProducer($data); $producer = ApplicationContext::getContainer()->get(Producer::class); $result = $producer->produce($message); if (!$result) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } catch (\Exception $e) { Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage()); } } }