【类 型】:fix

【原  因】:改在同意退款 或者主动退款的时候 就要改变订单的退款状态为同意 或者主动退,而不是在支付成功回调时在改
【过  程】:在refund接口操作 订单退款状态字段 和 同意退款时间字段
【影  响】:

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
air 2025-01-20 17:23:51 +08:00
parent 86a1109333
commit 78643ed01a

View File

@ -86,6 +86,17 @@ class PayController extends PublicController
exit();
}
// 更改订单状态 ps:此时只是商家同意申请 或 主动退 之后向微信服务器发起退款但不一定保证成功
if ($_REQUEST['refund_type'] == "buyer") { //买家申请
$data['refund_status'] = "已同意";
} elseif ($_REQUEST['refund_type'] == "seller") { //卖家主动退
$data['refund_status'] = "主动退";
}
$data['refundagree_time'] = time(); // 同意退款时间
if (!$orderDb->where($where)->data($data)->save()) {
echo json_encode(array('status' => 0, 'msg' => '操作退款失败'));
exit();
}
// 设置退款参数
$refundParameter = [
@ -123,13 +134,13 @@ class PayController extends PublicController
$data['refunded_time'] = time(); // 标记退款时间
$data['refund_sn'] = $result['resource']['ciphertext']['refund_id']; // 退款单号
$data['refund_price'] = $result['resource']['ciphertext']['amount']['refund'] / 100; // 退款金额,单位:元
$outRefundNo = $result['resource']['ciphertext']['out_refund_no'];
$refundType = substr($outRefundNo, strrpos($outRefundNo, '_') + 1); //截取退款类型
if ($refundType == "buyer") { //买家申请
$data['refund_status'] = "已同意";
} elseif ($refundType == "seller") { //卖家主动退
$data['refund_status'] = "主动退";
}
// $outRefundNo = $result['resource']['ciphertext']['out_refund_no'];
// $refundType = substr($outRefundNo, strrpos($outRefundNo, '_') + 1); //截取退款类型
// if ($refundType == "buyer") { //买家申请
// $data['refund_status'] = "已同意";
// } elseif ($refundType == "seller") { //卖家主动退
// $data['refund_status'] = "主动退";
// }
// 更新订单
$orderDb->where($where)->data($data)->save();