From 939e70779185ab91598acf8c7078ff9dcb7ff8cc Mon Sep 17 00:00:00 2001 From: "1213317725@qq.com" <1213317725@qq.com> Date: Mon, 26 May 2025 16:08:06 +0800 Subject: [PATCH] 1 --- .../controller/order_table/OrderTable.php | 2 +- .../admin/order_table/OrderTableService.php | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/niucloud/app/adminapi/controller/order_table/OrderTable.php b/niucloud/app/adminapi/controller/order_table/OrderTable.php index 5b0843f5..83bfb645 100644 --- a/niucloud/app/adminapi/controller/order_table/OrderTable.php +++ b/niucloud/app/adminapi/controller/order_table/OrderTable.php @@ -30,7 +30,7 @@ class OrderTable extends BaseAdminController $data = $this->request->params([ ["order_status",""], ["payment_type",""], - ["resource_id",""] + ["resource_id",""] ]); return success((new OrderTableService())->getPage($data)); } diff --git a/niucloud/app/service/admin/order_table/OrderTableService.php b/niucloud/app/service/admin/order_table/OrderTableService.php index b5d245c9..9bf51eb2 100644 --- a/niucloud/app/service/admin/order_table/OrderTableService.php +++ b/niucloud/app/service/admin/order_table/OrderTableService.php @@ -38,12 +38,23 @@ class OrderTableService extends BaseAdminService * @param array $where * @return array */ - public function getPage(array $where = []) + public function getPage(array $data = []) { + $where = []; $field = 'id,resource_id,payment_id,order_status,payment_type,order_amount,course_id,class_id,staff_id,after_sales_status,after_sales_reason,after_sales_time,created_at,updated_at,payment_time,subscription_payment_time'; $order = 'id desc'; - - $search_model = $this->model->withSearch(["order_status","payment_type","resource_id"], $where)->with(['customerResources','course','classGrade','personnel'])->field($field)->order($order); + if($data['order_status']){ + $where[] = ['order_status','=',$data['order_status']]; + } + + if($data['payment_type']){ + $where[] = ['payment_type','=',$data['payment_type']]; + } + + if($data['resource_id']){ + $where[] = ['resource_id','=',$data['resource_id']]; + } + $search_model = $this->model->where($where)->with(['customerResources','course','classGrade','personnel'])->field($field)->order($order); $list = $this->pageQuery($search_model); return $list; }