修改消息推送

This commit is contained in:
wucongxing 2023-04-24 18:28:23 +08:00
parent 74b7746d88
commit 8215609eed
3 changed files with 159 additions and 188 deletions

View File

@ -45,7 +45,6 @@ class ReportPreProductOrderCommand extends HyperfCommand
{
$this->line("开始");
try {
// 获取可上报商品订单
$order_product_ids = $this->getExecProductOrder();
if (empty($order_product_ids)){
@ -53,13 +52,6 @@ class ReportPreProductOrderCommand extends HyperfCommand
return;
}
// 获取缓存
$redis = $this->container->get(Redis::class);
} catch (\Exception $e) {
$this->line("错误:" . $e->getMessage());
return;
}
foreach ($order_product_ids as $item){
$this->line("本次请求订单号:" . $item['order_product_id']);

View File

@ -559,13 +559,11 @@ class CallBackController extends AbstractController
$params = array();
$params['patient_id'] = $order_product['patient_id'];
$user_patient = UserPatient::getOne($params);
if (empty($user_patient)) {
Log::getInstance()->error("微信退款回调处理成功,推送消息失败:推送用户数据错误");
}
if (!empty($user_patient)) {
// 发送站内、订阅、短信消息-药品订单退款成功
$MessagePush = new MessagePush($user_patient['user_id']);
$MessagePush->refundProductSuccess($order_product['order_product_id']);
}
} catch (\Exception $e) {
// 验证失败
Log::getInstance()->error("微信退款回调处理成功,推送消息失败:" . $e->getMessage());

View File

@ -64,11 +64,11 @@ class MessagePush extends BaseService
* 快速/购药的服务5分钟未接诊
* 公益/专家24小时未接诊
* 站内、订阅
* @return bool
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function patientNoInquiry(): bool
public function patientNoInquiry(): void
{
try {
// 站内
@ -103,7 +103,7 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
// 订阅
@ -112,7 +112,8 @@ class MessagePush extends BaseService
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
throw new BusinessException("加入推送队列失败:医生数据为空");
Log::getInstance("MessagePush")->error("错误:医生数据为空");
return;
}
$sub_data = array();
@ -135,13 +136,11 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
Log::getInstance("MessagePush")->error("错误:" . $e->getMessage());
}
return true;
}
/**
@ -186,11 +185,11 @@ class MessagePush extends BaseService
/**
* 患者-通知患者医生已接诊
* 站内、订阅、短信
* @return bool
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function patientAcceptedInquiry(): bool
public function patientAcceptedInquiry(): void
{
try {
// 获取医生数据
@ -198,7 +197,8 @@ class MessagePush extends BaseService
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
throw new BusinessException("加入推送队列失败:医生数据为空");
Log::getInstance("MessagePush")->error("错误:医生数据为空" );
return;
}
// 站内
@ -225,7 +225,7 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
// 订阅
@ -248,7 +248,7 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
// 短信
@ -258,7 +258,7 @@ class MessagePush extends BaseService
$params['inquiry_mode'] = $this->order_inquiry['inquiry_mode'];
$system_inquiry_config = SystemInquiryConfig::getOne($params);
if (empty($system_inquiry_config)) {
throw new BusinessException("加入推送队列失败:获取系统接诊配置失败");
Log::getInstance("MessagePush")->error("错误:获取系统接诊配置失败");
}
$duration = $system_inquiry_config['duration'];
@ -285,23 +285,21 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
* 患者的问诊服务结束
* 站内、订阅
* @return bool
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function patientInquiryFinish(): bool
public function patientInquiryFinish(): void
{
try {
// 获取医生数据
@ -309,7 +307,8 @@ class MessagePush extends BaseService
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
throw new BusinessException("加入推送队列失败:医生数据为空");
Log::getInstance("MessagePush")->error("错误:医生数据为空");
return;
}
// 站内
@ -339,7 +338,7 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
// 订阅
@ -362,23 +361,21 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
* 患者-处方被药师审核通过
* 站内、短信
* @return bool
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function patientPrescriptionVerifyPass(): bool
public function patientPrescriptionVerifyPass(): void
{
try {
// 获取医生数据
@ -386,7 +383,8 @@ class MessagePush extends BaseService
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
throw new BusinessException("加入推送队列失败:医生数据为空");
Log::getInstance("MessagePush")->error("错误:医生数据为空");
return ;
}
// 站内
@ -398,7 +396,8 @@ class MessagePush extends BaseService
$params['pharmacist_audit_status'] = 1;
$order_prescription = OrderPrescription::getOne($params);
if (empty($order_prescription)) {
throw new BusinessException("加入推送队列失败:处方数据为空");
Log::getInstance("MessagePush")->error("错误:处方数据为空");
return ;
}
$data = array();
@ -421,7 +420,7 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
// 短信
@ -435,28 +434,25 @@ class MessagePush extends BaseService
$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) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
* 患者-处方审核未通过
* 站内
* @return bool
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function patientPrescriptionVerifyFail(): bool
public function patientPrescriptionVerifyFail(): void
{
try {
// 获取医生数据
@ -464,7 +460,8 @@ class MessagePush extends BaseService
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
throw new BusinessException("加入推送队列失败:医生数据为空");
Log::getInstance("MessagePush")->error("错误:医生数据为空");
return ;
}
// 站内
@ -482,24 +479,22 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
* 患者-优惠劵发放
* 站内
* @param string $coupon_name
* @return bool
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function patientDistributeCoupon(string $coupon_name): bool
public function patientDistributeCoupon(string $coupon_name): void
{
try {
$data = array();
@ -516,23 +511,21 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
* 优惠劵退还
* 站内
* @return bool
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function patientRefundCoupon(): bool
public function patientRefundCoupon(): void
{
try {
$data = array();
@ -549,23 +542,21 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
* 优惠劵过期
* 站内
* @return bool
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function patientExpireCoupon(): bool
public function patientExpireCoupon(): void
{
try {
$data = array();
@ -582,24 +573,22 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
* 患者-问诊服务退款成功
* 站内、订阅、短信
* @param int $type 类型 1:已支付未接诊 2:已支付未成功分配医生 3:已支付未接诊患者取消订单
* @return bool
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function refundInquirySuccess(int $type): bool
public function refundInquirySuccess(int $type): void
{
try {
if (!empty($this->order_inquiry['doctor_id'])){
@ -608,7 +597,8 @@ class MessagePush extends BaseService
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
throw new BusinessException("加入推送队列失败:医生数据为空");
Log::getInstance("MessagePush")->error("错误:医生数据为空");
return ;
}
}
@ -636,7 +626,8 @@ class MessagePush extends BaseService
$data['notice_title'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功";
$data['notice_content'] = "您已取消成功当前服务平台会在24小时内给您退还至原账户中带来的不便敬请谅解。";
}else{
throw new BusinessException("加入推送队列失败:类型错误");
Log::getInstance("MessagePush")->error("错误:类型错误");
return ;
}
$data['link_type'] = 10;// 问诊订单详情
@ -649,7 +640,7 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
// 订阅
@ -663,7 +654,8 @@ class MessagePush extends BaseService
// 已支付未接诊患者取消订单
$thing4 = "用户主动取消";
}else{
throw new BusinessException("加入推送队列失败:类型错误");
Log::getInstance("MessagePush")->error("错误:类型错误");
return ;
}
$sub_data = array();
@ -686,7 +678,7 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
// 短信
@ -706,24 +698,22 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
* 患者-药品订单退款成功
* 站内、订阅、短信
* @param string $order_product_id
* @return bool
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function refundProductSuccess(string $order_product_id): bool
public function refundProductSuccess(string $order_product_id): void
{
try {
// 获取药品订单数据
@ -731,7 +721,8 @@ class MessagePush extends BaseService
$params['order_product_id'] = $order_product_id;
$order_product = OrderProduct::getOne($params);
if (empty($order_product)){
throw new BusinessException("加入推送队列失败:药品订单数据为空");
Log::getInstance("MessagePush")->error("错误:药品订单数据为空");
return ;
}
// 获取药品订单商品数据
@ -739,7 +730,8 @@ class MessagePush extends BaseService
$params['order_product_id'] = $order_product_id;
$order_product_item = OrderProductItem::getList($params);
if (empty($order_product_item)){
throw new BusinessException("加入推送队列失败:商品订单列表数据为空");
Log::getInstance("MessagePush")->error("错误:商品订单列表数据为空");
return ;
}
// 获取商品数据
@ -749,7 +741,8 @@ class MessagePush extends BaseService
$params['product_id'] = $item['product_id'];
$product = Product::getOne($params);
if (empty($product)){
throw new BusinessException("加入推送队列失败:商品数据为空");
Log::getInstance("MessagePush")->error("错误:商品数据为空");
return ;
}
$product_name_array[] = $product['common_name'];
@ -777,7 +770,7 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
// 订阅
@ -806,7 +799,7 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
// 短信
@ -822,18 +815,15 @@ class MessagePush extends BaseService
$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) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
@ -858,11 +848,11 @@ class MessagePush extends BaseService
* 药品已发货
* 订阅失败发送短信
* @param string $order_product_id
* @return bool
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function ProductDelivery(string $order_product_id): bool
public function ProductDelivery(string $order_product_id): void
{
try {
// 获取药品订单数据
@ -870,7 +860,8 @@ class MessagePush extends BaseService
$params['order_product_id'] = $order_product_id;
$order_product = OrderProduct::getOne($params);
if (empty($order_product)){
throw new BusinessException("加入推送队列失败:药品订单数据为空");
Log::getInstance("MessagePush")->error("错误:药品订单数据为空");
return ;
}
// 获取药品订单商品数据
@ -878,7 +869,8 @@ class MessagePush extends BaseService
$params['order_product_id'] = $order_product_id;
$order_product_item = OrderProductItem::getList($params);
if (empty($order_product_item)){
throw new BusinessException("加入推送队列失败:商品订单列表数据为空");
Log::getInstance("MessagePush")->error("错误:商品订单列表数据为空");
return ;
}
// 获取商品数据
@ -888,7 +880,8 @@ class MessagePush extends BaseService
$params['product_id'] = $item['product_id'];
$product = Product::getOne($params);
if (empty($product)){
throw new BusinessException("加入推送队列失败:商品数据为空");
Log::getInstance("MessagePush")->error("错误:商品数据为空");
return ;
}
$product_name_array[] = $product['common_name'];
@ -896,7 +889,6 @@ class MessagePush extends BaseService
$product_name = implode('、',$product_name_array);
if ($this->push_type == 2) {
// 订阅
$sub_data = array();
$sub_data['push_user_id'] = $this->user['user_id'];
@ -926,8 +918,6 @@ class MessagePush extends BaseService
$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;
@ -936,14 +926,11 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
@ -968,11 +955,11 @@ class MessagePush extends BaseService
/**
* 医生-医生有新问诊
* 站内、订阅失败发送短信
* @return bool
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function doctorHaveNewInquiry(): bool
public function doctorHaveNewInquiry(): void
{
try {
// 获取医生数据
@ -980,7 +967,8 @@ class MessagePush extends BaseService
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
throw new BusinessException("加入推送队列失败:医生数据为空");
Log::getInstance("MessagePush")->error("错误:医生数据为空");
return;
}
// 站内
@ -1005,7 +993,7 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
// 订阅
@ -1046,13 +1034,11 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入订阅推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
@ -1154,11 +1140,11 @@ class MessagePush extends BaseService
* 医生-问诊结束
* 站内
* 发送给医生
* @return bool
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function finishInquiryToDoctor(): bool
public function finishInquiryToDoctor(): void
{
try {
// 获取问诊订单关联病例
@ -1166,7 +1152,8 @@ class MessagePush extends BaseService
$params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
$order_inquiry_case = OrderInquiryCase::getOne($params);
if (empty($order_inquiry_case)){
throw new BusinessException("加入推送队列失败:问诊病例为空");
Log::getInstance("MessagePush")->error("错误:问诊病例为空" );
return ;
}
// 站内
@ -1191,23 +1178,21 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
* 医生-开具的处方审核通过
* 站内、订阅失败发送短信
* @return bool
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function prescriptionVerifySuccess(): bool
public function prescriptionVerifySuccess(): void
{
try {
// 获取问诊订单处方数据
@ -1217,7 +1202,8 @@ class MessagePush extends BaseService
$params['pharmacist_audit_status'] = 1;
$order_prescription = OrderPrescription::getOne($params);
if (empty($order_prescription)) {
throw new BusinessException("加入推送队列失败:处方数据为空");
Log::getInstance("MessagePush")->error("错误:处方数据为空" );
return ;
}
// 站内
@ -1242,7 +1228,7 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
// 订阅
@ -1276,24 +1262,22 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
return true;
}
/**
* 医生-开具的处方审核未通过
* 订阅失败发送短信
* @param string $order_prescription_id
* @return bool
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function prescriptionVerifyFail(string $order_prescription_id): bool
public function prescriptionVerifyFail(string $order_prescription_id): void
{
try {
// 获取问诊订单处方数据
@ -1301,7 +1285,8 @@ class MessagePush extends BaseService
$params['order_prescription_id'] = $order_prescription_id;
$order_prescription = OrderPrescription::getOne($params);
if (empty($order_prescription)) {
return false;
Log::getInstance("MessagePush")->error("错误:处方数据为空" );
return ;
}
// 订阅
@ -1335,14 +1320,11 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
Log::getInstance("MessagePush")->error("错误:" . $e->getMessage());
return false;
Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . $e->getMessage());
}
return true;
}
/**
@ -1733,7 +1715,7 @@ class MessagePush extends BaseService
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function doctorSettlementSuccess(string $withdrawal_id): bool
public function doctorSettlementSuccess(string $withdrawal_id)
{
try {
// 获取医生提现表数据
@ -1741,7 +1723,8 @@ class MessagePush extends BaseService
$params['withdrawal_id'] = $withdrawal_id;
$doctor_withdrawal = DoctorWithdrawal::getOne($params);
if (empty($doctor_withdrawal)){
throw new BusinessException("加入推送队列失败:提现数据为空");
Log::getInstance("MessagePush")->error("错误:提现数据为空" );
return ;
}
if ($this->push_type == 1) {
@ -1774,7 +1757,7 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} elseif ($this->push_type == 3) {
// 短信
@ -1794,11 +1777,11 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage());
}
return true;
@ -1963,11 +1946,11 @@ class MessagePush extends BaseService
/**
* 医生-患者取消问诊
* 站内-订阅
* @return bool
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function patientCancelInquiryToDoctor(): bool
public function patientCancelInquiryToDoctor(): void
{
try {
// 获取医生数据
@ -1975,7 +1958,7 @@ class MessagePush extends BaseService
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
throw new BusinessException("加入推送队列失败:医生数据为空");
Log::getInstance("MessagePush")->error("错误:医生数据为空" );
}
// 站内
@ -2000,7 +1983,7 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
$sub_data = array();
@ -2028,13 +2011,11 @@ class MessagePush extends BaseService
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage());
}
return true;
}
}