修改问诊退款回调,只有退款成功,才会推送消息

This commit is contained in:
wucongxing 2023-04-13 10:54:14 +08:00
parent e613684842
commit 45fc94bcee
3 changed files with 41 additions and 26 deletions

View File

@ -284,9 +284,11 @@ class CallBackController extends AbstractController
OrderInquiryRefund::edit($params,$data);
// 恢复优惠卷
if (!empty($order_inquiry['coupon_amount_total']) && $order_inquiry['coupon_amount_total'] > 0) {
$InquiryService = new InquiryService();
$InquiryService->returnInquiryCoupon($order_inquiry['order_inquiry_id'],$order_inquiry['user_id']);
if ($inquiry_refund_status == 3){
if (!empty($order_inquiry['coupon_amount_total']) && $order_inquiry['coupon_amount_total'] > 0) {
$InquiryService = new InquiryService();
$InquiryService->returnInquiryCoupon($order_inquiry['order_inquiry_id'],$order_inquiry['user_id']);
}
}
Db::commit();
@ -300,23 +302,31 @@ class CallBackController extends AbstractController
Log::getInstance()->info("微信退款回调处理成功,推送消息");
// 发送推送消息
try {
// 发送站内、订阅、短信消息-问诊服务退款成功
$MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['order_inquiry_id']);
if ($inquiry_refund_status == 3){
try {
// 发送站内、订阅、短信消息-问诊服务退款成功
$MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['order_inquiry_id']);
// 取消订单原因1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时)
if ($order_inquiry['cancel_reason'] == 1){
$MessagePush->refundInquirySuccess(1);
} elseif ($order_inquiry['cancel_reason'] == 2){
$MessagePush->refundInquirySuccess(3);
} elseif ($order_inquiry['cancel_reason'] == 3){
$MessagePush->refundInquirySuccess(2);
// 取消订单原因1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时)
if ($order_inquiry['cancel_reason'] == 1){
$MessagePush->refundInquirySuccess(1);
} elseif ($order_inquiry['cancel_reason'] == 2){
$MessagePush->refundInquirySuccess(3);
} elseif ($order_inquiry['cancel_reason'] == 3){
$MessagePush->refundInquirySuccess(2);
}
// 发送站内消息-优惠卷退还
$MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['order_inquiry_id']);
$MessagePush->patientRefundCoupon();
}catch (\Exception $e) {
// 验证失败
Log::getInstance()->error("微信退款回调处理成功,推送消息失败:" . $e->getMessage());
return $server->serve();
}
}catch (\Exception $e) {
// 验证失败
Log::getInstance()->error("微信退款回调处理成功,推送消息失败:" . $e->getMessage());
return $server->serve();
}
return $server->serve();
}

View File

@ -1210,9 +1210,6 @@ class InquiryService extends BaseService
$params['user_coupon_id'] = $order_inquiry_coupon['user_coupon_id'];
UserCoupon::edit($params, $data);
// 发送站内消息-优惠卷退还
$MessagePush = new MessagePush($patient_user_id,$order_inquiry_id);
$MessagePush->patientRefundCoupon();
return true;
} catch(\Exception $e){
Log::getInstance()->error("退还用户优惠卷失败" . $e->getMessage());

View File

@ -40,12 +40,12 @@ class Kuaidi
* @return mixed
* @throws GuzzleException
*/
protected function httpRequest(string $path, array $arg = []): mixed
protected function httpRequest(string $path, string $arg = []): mixed
{
$option = [
"headers" => [
"sign" => config("ca.app_id"),
"signature" => $this->getRequestSign($arg),
"json" => [
"schema" => "json",
"param" => json_encode($params, JSON_UNESCAPED_UNICODE),
],
];
@ -75,8 +75,16 @@ class Kuaidi
return $body['body'];
}
protected function getSign(string $data){
$sign = md5($data . config("kuaidi100.key") . config("kuaidi100.customer"));
/**
* 获取签名
* @param string $params
* @return string
*/
protected function getSign(string $params): string
{
return md5($params . config("kuaidi100.key") . config("kuaidi100.customer"));
}
public function
}