From 87934af41d821e03f0efedbf1e0a6f1ee2c371b8 Mon Sep 17 00:00:00 2001 From: tk Date: Mon, 3 Jun 2024 21:34:31 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=B1=BB=09=E5=9E=8B=E3=80=91?= =?UTF-8?q?=EF=BC=9Arefactor=20=E3=80=90=E4=B8=BB=09=E9=A2=98=E3=80=91?= =?UTF-8?q?=EF=BC=9A=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95=E7=8A=B6=E6=80=81?= =?UTF-8?q?=20=E3=80=90=E6=8F=8F=09=E8=BF=B0=E3=80=91=EF=BC=9A=20=09[?= =?UTF-8?q?=E5=8E=9F=E5=9B=A0]=EF=BC=9A=E4=B8=8D=E5=A4=84=E7=90=86?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=8A=B6=E6=80=81=E5=A4=84=E4=BA=8E=20?= =?UTF-8?q?=E5=B7=B2=E5=8F=96=E6=B6=88=20=E6=9C=AA=E4=BB=98=E6=AC=BE=20?= =?UTF-8?q?=E4=BA=A4=E6=98=93=E5=85=B3=E9=97=AD=E7=9A=84=E6=83=85=E5=86=B5?= =?UTF-8?q?=20=09[=E8=BF=87=E7=A8=8B]=EF=BC=9A=20=09[=E5=BD=B1=E5=93=8D]?= =?UTF-8?q?=EF=BC=9A=20=E3=80=90=E7=BB=93=09=E6=9D=9F=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动 --- .../Controller/PlaneController.class.php | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/FlyCube/MpApi/Controller/PlaneController.class.php b/FlyCube/MpApi/Controller/PlaneController.class.php index 7f9eb90..05ee6a6 100644 --- a/FlyCube/MpApi/Controller/PlaneController.class.php +++ b/FlyCube/MpApi/Controller/PlaneController.class.php @@ -542,33 +542,38 @@ class PlaneController extends PublicController echo json_encode(array('status' => 1, 'msg' => '访问成功', "questList" => $questList)); } /** - * @description: 改变订单 quest字段 改变为接单状态 + * @description: 改变订单状态或退款字段 不处理 已取消 未付款 交易关闭的订单 */ public function questAss() { if ($this->tokenShop_id != C('powerId')) { //非总管理员 $where['shop_id'] = $this->tokenShop_id; } - + //前端提交数据校验 if ($_REQUEST['id'] && $_REQUEST['state'] && $_REQUEST['val']) { $where['id'] = $_REQUEST['id']; $orderDb = D('order'); - if ($_REQUEST['state'] == 'status') { - $data['status'] = $_REQUEST['val']; //改变订单状态 - } elseif ($_REQUEST['state'] == 'back') { - if ($_REQUEST['val'] == 'zero') { - $data['back'] = '0'; //改变退货状态 - } else { - $data['back'] = '1'; //改变退货状态 - } - } - if ($orderDb->where($where)->save($data)) { - echo json_encode(array('status' => 1, 'msg' => '订单修改成功')); - } else { - echo json_encode(array('status' => 0, 'msg' => '订单修改失败')); + $field = array('status'); + $order = $orderDb->where($where)->field($field)->find(); + //不处理订单状态处于 已取消 未付款 交易关闭的情况 + if ($order['status'] == 'canceled' || $order['status'] == 'unpaid' || $order['status'] == 'closed') { + echo json_encode(array('status' => 0, 'msg' => '参数有误')); + exit(); } } else { echo json_encode(array('status' => 0, 'msg' => '参数有误')); + exit(); + } + //操作数据库 + if ($_REQUEST['state'] == 'status') { + $data['status'] = $_REQUEST['val']; //改变订单状态 + } elseif ($_REQUEST['state'] == 'back') { + $data['back'] = $_REQUEST['val']; //改变订单状态 + } + if ($orderDb->where($where)->save($data)) { + echo json_encode(array('status' => 1, 'msg' => '订单修改成功')); + } else { + echo json_encode(array('status' => 0, 'msg' => '订单修改失败')); } } }