From 80a02857059749444a0a57420be3beb8cd3d7102 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Fri, 26 Apr 2024 14:24:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Common/Common.php | 23 +++++++++++++++++++++++ app/Controller/CallBackController.php | 11 +++-------- app/Services/MessagePush.php | 21 ++++++++++----------- 3 files changed, 36 insertions(+), 19 deletions(-) diff --git a/app/Common/Common.php b/app/Common/Common.php index 6034e40..49b476a 100644 --- a/app/Common/Common.php +++ b/app/Common/Common.php @@ -381,4 +381,27 @@ function inquiryModeToString(int|string $inquiry_mode): string $result = "未知"; } return $result; +} + +/** + * 转换订单类型为汉字 + * @param int|string $order_type + * @return string + */ +function orderTypeToString(int|string $order_type): string +{ + if ($order_type == 1) { + $result = "问诊订单"; + } elseif ($order_type == 2) { + $result = "药品订单"; + } elseif ($order_type == 3) { + $result = "检测订单"; + } elseif ($order_type == 4) { + $result = "随访包"; + } elseif ($order_type == 5) { + $result = "健康包"; + } else { + $result = "未知"; + } + return $result; } \ No newline at end of file diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index 3522ee1..c6c0541 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -2403,14 +2403,9 @@ class CallBackController extends AbstractController // 发送推送消息 if ($message['refund_status'] == "SUCCESS") { try { - $params = array(); - $params['order_service_id'] = $order_service_package['order_service_id']; - $order_service_package_inquiry = OrderServicePackageInquiry::getOne($params); - if (!empty($order_service_package_inquiry)){ - // 患者-服务包服务退款成功 - $MessagePush = new MessagePush($order_service_package['user_id'], $order_service_package_inquiry['inquiry_no']); - $MessagePush->refundServicePackageSuccess(); - } + // 患者-服务包服务退款成功 + $MessagePush = new MessagePush($order_service_package['user_id'], $order_service_package['order_service_no']); + $MessagePush->refundServicePackageSuccess(); } catch (\Exception $e) { // 验证失败 Log::getInstance("CallBack-wxPayInquiryRefund")->error("微信退款回调处理成功,推送消息失败:" . $e->getMessage()); diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index 33ed3b9..a70acca 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -3580,7 +3580,7 @@ class MessagePush extends BaseService $link_params = array(); $link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; - $link_params['order_no'] = $this->order['order_no']; + $link_params['order_no'] = $this->order_service_package['order_no']; $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']; @@ -3631,7 +3631,7 @@ class MessagePush extends BaseService try { // 获取医生数据 $params = array(); - $params['doctor_id'] = $this->order_inquiry['doctor_id']; + $params['doctor_id'] = $this->order['doctor_id']; $user_doctor = UserDoctor::getOne($params); if (empty($user_doctor)) { Log::getInstance("MessagePush")->error("医生数据为空"); @@ -3639,7 +3639,7 @@ class MessagePush extends BaseService } // 转换问诊订单订单接诊方式-字符串 - $inquiry_mode = orderServiceTypeToString($this->order_inquiry['inquiry_mode']); + $order_type = orderTypeToString($this->order['order_type']); // 站内 $data = array(); @@ -3647,17 +3647,16 @@ class MessagePush extends BaseService $data['notice_type'] = 3; $data['notice_system_type'] = 1; $data['from_name'] = "肝胆小秘书"; - $data['notice_brief_title'] = "您购买的{$inquiry_mode}服务,订单取消成功,点击查看详情。"; - $data['notice_title'] = "您购买的{$inquiry_mode}服务,订单取消成功,点击查看详情。"; - $data['notice_content'] = "您购买的{$inquiry_mode}服务,订单取消成功,平台已自动发起退款,请注意查看账户信息。"; + $data['notice_brief_title'] = "您购买的{$order_type}服务,订单取消成功,点击查看详情。"; + $data['notice_title'] = "您购买的{$order_type}服务,订单取消成功,点击查看详情。"; + $data['notice_content'] = "您购买的{$order_type}服务,订单取消成功,平台已自动发起退款,请注意查看账户信息。"; $data['link_type'] = 15; $link_params = array(); - $link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id']; $link_params['order_no'] = $this->order['order_no']; - $link_params['inquiry_type'] = $this->order_inquiry['inquiry_type']; + $link_params['inquiry_type'] = 1; $link_params['doctor_user_id'] = $user_doctor['user_id']; - $link_params['patient_user_id'] = $this->order_inquiry['user_id']; + $link_params['patient_user_id'] = $this->order['user_id']; $data['link_params'] = json_encode($link_params, JSON_UNESCAPED_UNICODE);// 跳转参数 $data['button_type'] = 4; @@ -3674,7 +3673,7 @@ class MessagePush extends BaseService $sub_data['wx_template_id'] = "9v6dZhjg09CttLd3W9nEUV_-eshNc4BYYNy59jglvZE";// 问诊提醒 $sub_data['params']['page'] = "healthyService/pages/healthyOrderDetail/healthyOrderDetail?order_service_id={$this->order['order_no']}"; $sub_data['params']['data'] = [ - "thing1" => "{$inquiry_mode}服务",// 问诊内容 + "thing1" => "{$order_type}服务",// 问诊内容 "thing2" => "取消订单成功",// 提醒内容 "name3" => (string)$user_doctor['user_name'],// 问诊医生 "thing4" => "平台已自动发起退款,请注意查看账户信息",// 提示说明 @@ -3688,7 +3687,7 @@ class MessagePush extends BaseService $sms_data['user_id'] = $this->user['user_id']; $template_param = array(); - $template_param['type'] = $inquiry_mode; + $template_param['type'] = $order_type; $template_param['name'] = (string)$user_doctor['user_name']; $sms_data['template_param'] = $template_param;