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)); } }