取消检测订单,取消订单订阅消息推送

This commit is contained in:
2023-08-04 13:52:03 +08:00
parent 20faf6f59e
commit a2821171ef
5 changed files with 280 additions and 2 deletions
+60
View File
@@ -7,7 +7,9 @@ use App\Amqp\Producer\SendStationMessageProducer;
use App\Amqp\Producer\SendSubMessageProducer;
use App\Constants\HttpEnumCode;
use App\Exception\BusinessException;
use App\Model\DetectionProject;
use App\Model\DoctorWithdrawal;
use App\Model\OrderDetection;
use App\Model\OrderInquiry;
use App\Model\OrderInquiryCase;
use App\Model\OrderInquiryCoupon;
@@ -2074,6 +2076,7 @@ class MessagePush extends BaseService
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)) {
Log::getInstance("MessagePush")->error("错误:医生数据为空");
return;
}
// 获取问诊订单关联病例
@@ -2108,6 +2111,7 @@ class MessagePush extends BaseService
$result = $producer->produce($message);
if (!$result) {
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE));
return;
}
// 问诊内容-病情主诉
@@ -2226,4 +2230,60 @@ class MessagePush extends BaseService
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage());
}
}
/**
* 患者-订单取消成功通知
* 订阅
* @param string $order_detection_id
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function patientCancelOrderSuccess(string $order_detection_id): void
{
try {
// 获取检测订单
$params = array();
$params['order_detection_id'] = $order_detection_id;
$order_detection = OrderDetection::getOne($params);
if (empty($order_detection)) {
Log::getInstance("MessagePush")->error("错误:加入推送队列失败,无检测订单数据");
return;
}
// 获取检测项目
$params = array();
$params['detection_project_id'] = $order_detection['detection_project_id'];
$detection_project = DetectionProject::getOne($params);
if (empty($detection_project)){
Log::getInstance("MessagePush")->error("错误:加入推送队列失败,检测项目错误");
return;
}
$sub_data = array();
$sub_data['push_user_id'] = $this->user['user_id'];
$sub_data['wx_template_id'] = "5aJSrO8SU5rxqdB99zzl4rMVgcOTjt5mQh56cpZI1Hg";//咨询提醒
$sub_data['params']['page'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id=";
$sub_data['params']['data'] = [
"thing1" => $order_detection['patient_name'],// 就诊人
"thing7" => (string)$detection_project['detection_project_name'],// 服务项目
"time6" => date('Y年m月d日 H:i'),// 取消时间
"amount8" => $order_detection['payment_amount_total'],// 退款金额
"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());
}
}
}