From d4645df2048e3b44b64e567c491af2734cf9994e Mon Sep 17 00:00:00 2001 From: tk Date: Fri, 5 Jul 2024 15:28:33 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=B1=BB=09=E5=9E=8B=E3=80=91?= =?UTF-8?q?=EF=BC=9Afix=20=E3=80=90=E4=B8=BB=09=E9=A2=98=E3=80=91=EF=BC=9A?= =?UTF-8?q?=201.=E4=BF=AE=E6=AD=A3=20=E8=8E=B7=E5=8F=96=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8bug=202.=E6=B7=BB=E5=8A=A0=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E5=AD=97=E6=AE=B5=20=E3=80=90?= =?UTF-8?q?=E6=8F=8F=09=E8=BF=B0=E3=80=91=EF=BC=9A=20=09[=E5=8E=9F?= =?UTF-8?q?=E5=9B=A0]=EF=BC=9A=E7=8A=B6=E6=80=81=E6=8F=90=E4=BA=A4=20?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=8F=90=E4=BA=A4=E4=B8=BA=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=20=09[=E8=BF=87=E7=A8=8B]=EF=BC=9A=E7=94=A8,=20?= =?UTF-8?q?=E6=8A=8A=E6=9D=A1=E4=BB=B6=20=E5=85=88=E5=88=86=E5=89=B2?= =?UTF-8?q?=E6=88=90=E6=95=B0=E7=BB=84=20=09[=E5=BD=B1=E5=93=8D]=EF=BC=9A?= =?UTF-8?q?=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/AdminController.class.php | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/FlyCube/MpApi/Controller/AdminController.class.php b/FlyCube/MpApi/Controller/AdminController.class.php index d71197e..90976d8 100644 --- a/FlyCube/MpApi/Controller/AdminController.class.php +++ b/FlyCube/MpApi/Controller/AdminController.class.php @@ -761,7 +761,6 @@ class AdminController extends PublicController $main_status_array = explode(',', $_REQUEST['main_status']); $where['main_status'] = array('in', $main_status_array); } - $this->publish("demo", $_REQUEST['search']); // 添加 shipment_status 条件 if (isset($_REQUEST['shipment_status']) && !empty($_REQUEST['shipment_status'])) { @@ -775,26 +774,29 @@ class AdminController extends PublicController $where['refund_status'] = array('in', $refund_status_array); } - // // 添加搜索条件 - // if (isset($_REQUEST['search']) && is_array($_REQUEST['search']) && count($_REQUEST['search']) == 2) { - // list($field, $value) = $_REQUEST['search']; - // if (!empty($field) && !empty($value)) { - // $fieldMap = [ - // 'orderSn' => 'order_sn', - // 'name' => 'receiver', - // 'tel' => 'tel', - // 'remark' => 'remark', - // 'desc' => 'describe' - // ]; + // 添加搜索条件 + if (isset($_REQUEST['search']) && !empty($_REQUEST['search'])) { + $search = explode(',', $_REQUEST['search']); + if (count($search) == 2) { + list($field, $value) = $search; + if (!empty($field)) { + $fieldMap = [ + 'orderSn' => 'order_sn', + 'name' => 'receiver', + 'tel' => 'tel', + 'remark' => 'remark', + 'desc' => 'describe' + ]; - // if (array_key_exists($field, $fieldMap)) { - // $where[$fieldMap[$field]] = array('like', '%' . $value . '%'); - // } - // } - // } - - $orderDb = D('order'); - $orderList = $orderDb->where($where)->select(); + if (array_key_exists($field, $fieldMap) && !empty($value)) { + $where[$fieldMap[$field]] = array('like', '%' . $value . '%'); + } + } + } + } + $field = array('id',); + $orderDb = D('order', 'order_sn', 'main_status', 'shipment_status', 'refund_status', 'order_time'); + $orderList = $orderDb->where($where)->field($field)->select(); echo json_encode(array('status' => 1, 'msg' => '访问成功', 'orderList' => $orderList)); } }