From 9a0e92acb5f34800997f0373928595786ef5ba44 Mon Sep 17 00:00:00 2001 From: tk Date: Tue, 6 Aug 2024 19:18:20 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=B1=BB=20=20=E5=9E=8B=E3=80=91?= =?UTF-8?q?=EF=BC=9Afix=20=E9=80=80=E6=AC=BE=E6=8E=A5=E5=8F=A3=20=E5=9B=9E?= =?UTF-8?q?=E6=BB=9A=20=E3=80=90=E5=8E=9F=20=20=E5=9B=A0=E3=80=91=EF=BC=9A?= =?UTF-8?q?=E8=BF=98=E6=98=AF=E4=BD=BF=E7=94=A8=20=E5=8D=95=E7=8B=AC?= =?UTF-8?q?=E5=BE=97=E6=8E=A5=E5=8F=A3=E6=8E=A7=E5=88=B6=20=E5=B7=B2?= =?UTF-8?q?=E7=BB=8F=E5=8F=91=E8=B4=A7=E5=BE=97=E8=AE=A2=E5=8D=95=EF=BC=8C?= =?UTF-8?q?=E5=9B=A0=E4=B8=BA=E8=BF=98=E8=A6=81=E5=A4=84=E7=90=86=E7=AB=99?= =?UTF-8?q?=E7=82=B9=E5=88=97=E8=A1=A8=E5=BE=97=E5=B8=AE=E5=BD=93=E8=88=AA?= =?UTF-8?q?=E7=BA=BF=E5=AD=97=E6=AE=B5=20=E5=9C=A8=E9=80=80=E6=AC=BE?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=A4=84=E7=90=86=20=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=B8=8D=E6=B8=85=E6=99=B0=20=E3=80=90=E8=BF=87=20=20=E7=A8=8B?= =?UTF-8?q?=E3=80=91=EF=BC=9A=20=E3=80=90=E5=BD=B1=20=20=E5=93=8D=E3=80=91?= =?UTF-8?q?=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MpApi/Controller/PayController.class.php | 32 +++++-------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/FlyCube/MpApi/Controller/PayController.class.php b/FlyCube/MpApi/Controller/PayController.class.php index d0557cd..6005784 100644 --- a/FlyCube/MpApi/Controller/PayController.class.php +++ b/FlyCube/MpApi/Controller/PayController.class.php @@ -61,30 +61,19 @@ class PayController extends PublicController echo json_encode(array('status' => 0, 'msg' => '退款参数有误')); exit(); } - /*获取订单信息*/ + // 获取订单信息 $where['shop_id'] = $_REQUEST['shop_id']; $where['order_sn'] = $_REQUEST['order_sn']; $field = array('order_sn, total_price, pay_sn,main_status,shop_id'); $orderDb = D('order'); - //后端订单检查 if (!$order = $orderDb->where($where)->field($field)->find()) { echo json_encode(array('status' => 0, 'msg' => '订单不存在')); exit(); } - if ($order['shipment_status'] == "已发货") { - if (!($_REQUEST['refund_Shipment'] == "已送达" || $_REQUEST['refund_Shipment'] == "未送达")) { - echo json_encode(array('status' => 0, 'msg' => '请确认货物状态')); - exit(); - } - } if ($order['total_price'] < $_REQUEST['refund_price']) { echo json_encode(array('status' => 0, 'msg' => '退款申请超额')); exit(); } - if ($order['main_status'] == "已完成") { - echo json_encode(array('status' => 0, 'msg' => '已完成订单不可申请退款')); - exit(); - } if ($order['main_status'] == "已退款") { // 构建发布主题 并向地面终端提示刷新信息 $topic = 'refreshQuestList/' . $order['shop_id']; @@ -92,17 +81,16 @@ class PayController extends PublicController echo json_encode(array('status' => 1, 'msg' => '此订单已完成退款')); exit(); } - - /*设置退款参数*/ - //如果订单是已送货状态并且 前端发过来货物状态为 在退款订单号里面标记delivered 再回调时判断有这个标记 把货物状态改为已送达 - if ($order['shipment_status'] == "已发货" && $_REQUEST['refund_Shipment'] == "已送达") { - $out_refund_no = $order['order_sn'] . '_' . $_REQUEST['refund_type'] . '_delivered'; // 商户退款单号 - } else { - $out_refund_no = $order['order_sn'] . '_' . $_REQUEST['refund_type']; + if ($order['main_status'] == "已完成") { + echo json_encode(array('status' => 0, 'msg' => '已完成订单不可申请退款')); + exit(); } + + + // 设置退款参数 $refundParameter = [ 'out_trade_no' => $order['order_sn'], // 商户订单号 - 'out_refund_no' => $out_refund_no, // 商户退款单号 + 'out_refund_no' => $order['order_sn'] . '_' . $_REQUEST['refund_type'], // 商户退款单号 'amount' => [ 'refund' => $_REQUEST['refund_price'] * 100, // 退款金额,单位:分 'total' => $order['total_price'] * 100, // 订单金额,单位:分 @@ -142,10 +130,6 @@ class PayController extends PublicController } elseif ($refundType == "seller") { //卖家主动退 $data['refund_status'] = "主动退"; } - if (strpos($outRefundNo, 'delivered') !== false) { //有delivered标记 货物状态改为已送达 - $data['shipment_status'] = "已送达"; - } - $this->publish("demo", $outRefundNo); // 更新订单 $orderDb->where($where)->data($data)->save(); }