From 6c7cc0d9073023096de16cf2bbddba09908c402f Mon Sep 17 00:00:00 2001 From: devil Date: Thu, 29 Oct 2020 00:33:25 +0800 Subject: [PATCH] =?UTF-8?q?web=E5=90=8E=E7=AB=AF+=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=88=97=E8=A1=A8=E6=94=AF=E6=8C=81=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Answer.php | 1 + application/admin/controller/Appcenternav.php | 1 + application/admin/controller/Apphomenav.php | 1 + application/admin/controller/Article.php | 1 + application/admin/controller/Integrallog.php | 1 + application/admin/controller/Message.php | 1 + application/admin/controller/Paylog.php | 1 + .../admin/controller/Payrequestlog.php | 1 + application/admin/controller/Refundlog.php | 1 + application/admin/controller/Warehouse.php | 1 + .../admin/controller/Warehousegoods.php | 1 + application/admin/form/Article.php | 1 - application/admin/form/Message.php | 51 +++++++++++++++++ application/admin/form/Payrequestlog.php | 1 - application/admin/form/Useraddress.php | 2 + .../default/public/module/form_table.html | 8 +-- application/index/controller/Answer.php | 1 + application/index/controller/Message.php | 1 + application/index/controller/Order.php | 1 + .../index/controller/Orderaftersale.php | 1 + .../index/controller/Usergoodsbrowse.php | 1 + .../index/controller/Usergoodsfavor.php | 1 + application/index/controller/Userintegral.php | 1 + application/index/form/Answer.php | 4 ++ application/index/form/Message.php | 6 ++ application/index/form/Order.php | 25 ++++++++ application/index/form/Orderaftersale.php | 17 ++++++ application/index/form/Usergoodsbrowse.php | 5 ++ application/index/form/Usergoodsfavor.php | 5 ++ application/index/form/Userintegral.php | 6 ++ .../default/public/module/form_table.html | 6 +- application/module/FormHandleModule.php | 57 ++++++++++++------- application/service/AdminRoleService.php | 1 - application/service/AdminService.php | 1 - application/service/AnswerService.php | 4 +- application/service/AppCenterNavService.php | 1 - application/service/AppHomeNavService.php | 1 - application/service/BrandService.php | 2 +- application/service/GoodsBrowseService.php | 4 +- application/service/GoodsCommentsService.php | 5 +- application/service/GoodsFavorService.php | 4 +- application/service/IntegralService.php | 4 +- application/service/MessageService.php | 4 +- application/service/OrderAftersaleService.php | 4 +- application/service/OrderService.php | 5 +- application/service/PayLogService.php | 4 +- application/service/PayRequestLogService.php | 4 +- application/service/QuickNavService.php | 2 +- application/service/RefundLogService.php | 4 +- application/service/SearchService.php | 45 ++++++++++----- application/service/SlideService.php | 3 +- application/service/UserAddressService.php | 1 - application/service/UserService.php | 1 - application/service/WarehouseGoodsService.php | 3 +- public/static/common/css/common.css | 5 ++ 55 files changed, 249 insertions(+), 75 deletions(-) diff --git a/application/admin/controller/Answer.php b/application/admin/controller/Answer.php index a3da4114e..3c5d60969 100755 --- a/application/admin/controller/Answer.php +++ b/application/admin/controller/Answer.php @@ -67,6 +67,7 @@ class Answer extends Common 'where' => $this->form_where, 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, + 'order_by' => $this->form_order_by['data'], 'is_public' => 0, ]; $ret = AnswerService::AnswerList($data_params); diff --git a/application/admin/controller/Appcenternav.php b/application/admin/controller/Appcenternav.php index 564933b11..0c25c6b71 100755 --- a/application/admin/controller/Appcenternav.php +++ b/application/admin/controller/Appcenternav.php @@ -67,6 +67,7 @@ class AppCenterNav extends Common 'where' => $this->form_where, 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, + 'order_by' => $this->form_order_by['data'], ]; $ret = AppCenterNavService::AppCenterNavList($data_params); diff --git a/application/admin/controller/Apphomenav.php b/application/admin/controller/Apphomenav.php index 9facaf392..f537ab37d 100755 --- a/application/admin/controller/Apphomenav.php +++ b/application/admin/controller/Apphomenav.php @@ -67,6 +67,7 @@ class AppHomeNav extends Common 'where' => $this->form_where, 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, + 'order_by' => $this->form_order_by['data'], ]; $ret = AppHomeNavService::AppHomeNavList($data_params); diff --git a/application/admin/controller/Article.php b/application/admin/controller/Article.php index d18426f04..18a274cad 100755 --- a/application/admin/controller/Article.php +++ b/application/admin/controller/Article.php @@ -68,6 +68,7 @@ class Article extends Common 'where' => $this->form_where, 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, + 'order_by' => $this->form_order_by['data'], ]; $ret = ArticleService::ArticleList($data_params); diff --git a/application/admin/controller/Integrallog.php b/application/admin/controller/Integrallog.php index 7e04d58f3..431f54cc7 100755 --- a/application/admin/controller/Integrallog.php +++ b/application/admin/controller/Integrallog.php @@ -67,6 +67,7 @@ class IntegralLog extends Common 'where' => $this->form_where, 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, + 'order_by' => $this->form_order_by['data'], 'is_public' => 0, 'user_type' => 'admin', ]; diff --git a/application/admin/controller/Message.php b/application/admin/controller/Message.php index 36dc88249..117e3c3de 100755 --- a/application/admin/controller/Message.php +++ b/application/admin/controller/Message.php @@ -67,6 +67,7 @@ class Message extends Common 'where' => $this->form_where, 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, + 'order_by' => $this->form_order_by['data'], 'is_public' => 0, 'user_type' => 'admin', ]; diff --git a/application/admin/controller/Paylog.php b/application/admin/controller/Paylog.php index f60ea2665..5342a37a4 100755 --- a/application/admin/controller/Paylog.php +++ b/application/admin/controller/Paylog.php @@ -67,6 +67,7 @@ class PayLog extends Common 'where' => $this->form_where, 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, + 'order_by' => $this->form_order_by['data'], 'is_public' => 0, 'user_type' => 'admin', ]; diff --git a/application/admin/controller/Payrequestlog.php b/application/admin/controller/Payrequestlog.php index a6bdc7726..3e06c3464 100644 --- a/application/admin/controller/Payrequestlog.php +++ b/application/admin/controller/Payrequestlog.php @@ -68,6 +68,7 @@ class PayRequestLog extends Common 'where' => $this->form_where, 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, + 'order_by' => $this->form_order_by['data'], 'user_type' => 'admin', ]; $ret = PayRequestLogService::PayRequestLogList($data_params); diff --git a/application/admin/controller/Refundlog.php b/application/admin/controller/Refundlog.php index e9c717dec..7d80a16eb 100644 --- a/application/admin/controller/Refundlog.php +++ b/application/admin/controller/Refundlog.php @@ -67,6 +67,7 @@ class RefundLog extends Common 'where' => $this->form_where, 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, + 'order_by' => $this->form_order_by['data'], 'is_public' => 0, 'user_type' => 'admin', ]; diff --git a/application/admin/controller/Warehouse.php b/application/admin/controller/Warehouse.php index f717e33ff..a2bf968b5 100644 --- a/application/admin/controller/Warehouse.php +++ b/application/admin/controller/Warehouse.php @@ -56,6 +56,7 @@ class Warehouse extends Common // 获取列表 $data_params = [ 'where' => $this->form_where, + 'order_by' => $this->form_order_by['data'], ]; $ret = WarehouseService::WarehouseList($data_params); $this->assign('data_list', $ret['data']); diff --git a/application/admin/controller/Warehousegoods.php b/application/admin/controller/Warehousegoods.php index b4de4b846..e19709c8a 100644 --- a/application/admin/controller/Warehousegoods.php +++ b/application/admin/controller/Warehousegoods.php @@ -73,6 +73,7 @@ class WarehouseGoods extends Common 'where' => $this->form_where, 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, + 'order_by' => $this->form_order_by['data'], ]; $ret = WarehouseGoodsService::WarehouseGoodsList($data_params); diff --git a/application/admin/form/Article.php b/application/admin/form/Article.php index d9e69ce1c..781476851 100644 --- a/application/admin/form/Article.php +++ b/application/admin/form/Article.php @@ -75,7 +75,6 @@ class Article 'view_type' => 'field', 'view_key' => 'jump_url', 'grid_size' => 'sm', - 'is_sort' => 1, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', diff --git a/application/admin/form/Message.php b/application/admin/form/Message.php index 099f4fac2..e0a775084 100644 --- a/application/admin/form/Message.php +++ b/application/admin/form/Message.php @@ -145,6 +145,17 @@ class Message 'view_type' => 'field', 'view_key' => 'user_is_delete_time_text', 'is_sort' => 1, + 'search_config' => [ + 'form_type' => 'select', + 'where_type' => 'in', + 'form_name' => 'user_is_delete_time', + 'data' => lang('common_is_text_list'), + 'data_key' => 'id', + 'data_name' => 'name', + 'where_type_custom' => 'WhereTypeUserIsDelete', + 'where_value_custom' => 'WhereValueUserIsDelete', + 'is_multiple' => 1, + ], ], [ 'label' => '发送时间', @@ -167,6 +178,46 @@ class Message ]; } + /** + * 是否删除条件符号处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-06-08 + * @desc description + * @param [string] $form_key [表单数据key] + * @param [array] $params [输入参数] + */ + public function WhereTypeUserIsDelete($form_key, $params = []) + { + if(isset($params[$form_key])) + { + // 条件值是 0,1 + // 解析成数组,都存在则返回null,则1 >, 0 = + $value = explode(',', urldecode($params[$form_key])); + if(count($value) == 1) + { + return in_array(1, $value) ? '>' : '='; + } + } + return null; + } + + /** + * 是否删除条件值处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-06-08 + * @desc description + * @param [string] $form_key [表单数据key] + * @param [array] $params [输入参数] + */ + public function WhereValueUserIsDelete($value, $params = []) + { + return (count($value) == 2) ? null : 0; + } + /** * 用户信息条件处理 * @author Devil diff --git a/application/admin/form/Payrequestlog.php b/application/admin/form/Payrequestlog.php index 95dd85a96..8035d36e9 100644 --- a/application/admin/form/Payrequestlog.php +++ b/application/admin/form/Payrequestlog.php @@ -93,7 +93,6 @@ class PayRequestLog 'view_key' => 'payrequestlog/module/business_handle', 'align' => 'left', 'grid_size' => 'sm', - 'is_sort' => 1, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', diff --git a/application/admin/form/Useraddress.php b/application/admin/form/Useraddress.php index 26a898e36..afd015d32 100644 --- a/application/admin/form/Useraddress.php +++ b/application/admin/form/Useraddress.php @@ -122,12 +122,14 @@ class UserAddress 'view_type' => 'field', 'view_key' => 'city_name', 'is_sort' => 1, + 'sort_field' => 'city', ], [ 'label' => '所属区/县', 'view_type' => 'field', 'view_key' => 'county_name', 'is_sort' => 1, + 'sort_field' => 'county', ], [ 'label' => '详细地址', diff --git a/application/admin/view/default/public/module/form_table.html b/application/admin/view/default/public/module/form_table.html index b530cbb53..8fbb333e8 100644 --- a/application/admin/view/default/public/module/form_table.html +++ b/application/admin/view/default/public/module/form_table.html @@ -29,11 +29,11 @@ {{if isset($t['label'])}}{{$t.label}}{{/if}} {{/switch}} - - {{if isset($form_table['base']['is_search']) and $form_table['base']['is_search'] eq 1 and isset($t['is_sort']) and $t['is_sort'] eq 1 and !empty($t['sort_field'])}} + + {{if isset($t['is_sort']) and $t['is_sort'] eq 1 and !empty($t['sort_key'])}}
- - + +
{{/if}} diff --git a/application/index/controller/Answer.php b/application/index/controller/Answer.php index 423af60d8..cd1b8a58a 100755 --- a/application/index/controller/Answer.php +++ b/application/index/controller/Answer.php @@ -67,6 +67,7 @@ class Answer extends Common 'where' => $this->form_where, 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, + 'order_by' => $this->form_order_by['data'], ]; $ret = AnswerService::AnswerList($data_params); diff --git a/application/index/controller/Message.php b/application/index/controller/Message.php index f00bde531..523c5c1d8 100755 --- a/application/index/controller/Message.php +++ b/application/index/controller/Message.php @@ -66,6 +66,7 @@ class Message extends Common 'where' => $this->form_where, 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, + 'order_by' => $this->form_order_by['data'], ]; $ret = MessageService::MessageList($data_params); diff --git a/application/index/controller/Order.php b/application/index/controller/Order.php index 9ed83778d..4d55bc1e5 100755 --- a/application/index/controller/Order.php +++ b/application/index/controller/Order.php @@ -69,6 +69,7 @@ class Order extends Common 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, 'where' => $this->form_where, + 'order_by' => $this->form_order_by['data'], 'is_orderaftersale' => 1, 'user_type' => 'user', ]; diff --git a/application/index/controller/Orderaftersale.php b/application/index/controller/Orderaftersale.php index 898412e46..1446e65a5 100644 --- a/application/index/controller/Orderaftersale.php +++ b/application/index/controller/Orderaftersale.php @@ -66,6 +66,7 @@ class Orderaftersale extends Common 'where' => $this->form_where, 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, + 'order_by' => $this->form_order_by['data'], 'is_public' => 0, ]; $ret = OrderAftersaleService::OrderAftersaleList($data_params); diff --git a/application/index/controller/Usergoodsbrowse.php b/application/index/controller/Usergoodsbrowse.php index 50930e264..52c483018 100755 --- a/application/index/controller/Usergoodsbrowse.php +++ b/application/index/controller/Usergoodsbrowse.php @@ -66,6 +66,7 @@ class UserGoodsBrowse extends Common 'where' => $this->form_where, 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, + 'order_by' => $this->form_order_by['data'], ]; $ret = GoodsBrowseService::GoodsBrowseList($data_params); diff --git a/application/index/controller/Usergoodsfavor.php b/application/index/controller/Usergoodsfavor.php index 8d0541d6a..7393d3dc4 100755 --- a/application/index/controller/Usergoodsfavor.php +++ b/application/index/controller/Usergoodsfavor.php @@ -66,6 +66,7 @@ class UserGoodsFavor extends Common 'where' => $this->form_where, 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, + 'order_by' => $this->form_order_by['data'], ]; $ret = GoodsFavorService::GoodsFavorList($data_params); diff --git a/application/index/controller/Userintegral.php b/application/index/controller/Userintegral.php index f197f8213..4a95fb375 100755 --- a/application/index/controller/Userintegral.php +++ b/application/index/controller/Userintegral.php @@ -67,6 +67,7 @@ class UserIntegral extends Common 'where' => $this->form_where, 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, + 'order_by' => $this->form_order_by['data'], ]; $ret = IntegralService::IntegralLogList($data_params); diff --git a/application/index/form/Answer.php b/application/index/form/Answer.php index 926e5db34..65734868d 100644 --- a/application/index/form/Answer.php +++ b/application/index/form/Answer.php @@ -66,6 +66,7 @@ class Answer 'label' => '联系人', 'view_type' => 'field', 'view_key' => 'name', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -75,6 +76,7 @@ class Answer 'label' => '联系电话', 'view_type' => 'field', 'view_key' => 'tel', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -106,6 +108,7 @@ class Answer 'label' => '回复时间', 'view_type' => 'field', 'view_key' => 'reply_time_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', 'form_name' => 'reply_time', @@ -115,6 +118,7 @@ class Answer 'label' => '创建时间', 'view_type' => 'field', 'view_key' => 'add_time_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', 'form_name' => 'add_time', diff --git a/application/index/form/Message.php b/application/index/form/Message.php index 3249a67a7..f191ed03a 100644 --- a/application/index/form/Message.php +++ b/application/index/form/Message.php @@ -70,6 +70,7 @@ class Message 'view_key' => 'type', 'view_data_key' => 'name', 'view_data' => lang('common_message_type_list'), + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -83,6 +84,7 @@ class Message 'label' => '业务类型', 'view_type' => 'field', 'view_key' => 'business_type', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -96,6 +98,7 @@ class Message 'label' => '标题', 'view_type' => 'field', 'view_key' => 'title', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -106,6 +109,7 @@ class Message 'view_type' => 'field', 'view_key' => 'detail', 'grid_size' => 'lg', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -117,6 +121,7 @@ class Message 'view_key' => 'is_read', 'view_data_key' => 'name', 'view_data' => lang('common_is_read_list'), + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -130,6 +135,7 @@ class Message 'label' => '时间', 'view_type' => 'field', 'view_key' => 'add_time_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', 'form_name' => 'add_time', diff --git a/application/index/form/Order.php b/application/index/form/Order.php index 3d4ab47a9..4ccc4df6d 100644 --- a/application/index/form/Order.php +++ b/application/index/form/Order.php @@ -89,6 +89,7 @@ class Order 'view_key' => 'status', 'view_data_key' => 'name', 'view_data' => lang('common_order_user_status'), + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -102,6 +103,7 @@ class Order 'label' => '支付状态', 'view_type' => 'module', 'view_key' => 'order/module/pay_status', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'form_name' => 'pay_status', @@ -116,6 +118,7 @@ class Order 'label' => '总价(元)', 'view_type' => 'field', 'view_key' => 'total_price', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', 'is_point' => 1, @@ -125,6 +128,7 @@ class Order 'label' => '支付金额(元)', 'view_type' => 'field', 'view_key' => 'pay_price', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', 'is_point' => 1, @@ -134,6 +138,7 @@ class Order 'label' => '单价(元)', 'view_type' => 'field', 'view_key' => 'price', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', 'is_point' => 1, @@ -145,6 +150,7 @@ class Order 'view_key' => 'order_model', 'view_data_key' => 'name', 'view_data' => lang('common_site_type_list'), + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -160,6 +166,7 @@ class Order 'view_key' => 'client_type', 'view_data_key' => 'name', 'view_data' => lang('common_platform_type'), + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -199,6 +206,7 @@ class Order 'label' => '退款金额(元)', 'view_type' => 'field', 'view_key' => 'refund_price', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', 'is_point' => 1, @@ -208,6 +216,7 @@ class Order 'label' => '退货数量', 'view_type' => 'field', 'view_key' => 'returned_quantity', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', ], @@ -216,6 +225,7 @@ class Order 'label' => '购买总数', 'view_type' => 'field', 'view_key' => 'buy_number_count', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', ], @@ -224,6 +234,7 @@ class Order 'label' => '增加金额(元)', 'view_type' => 'field', 'view_key' => 'increase_price', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', 'is_point' => 1, @@ -233,6 +244,7 @@ class Order 'label' => '优惠金额(元)', 'view_type' => 'field', 'view_key' => 'preferential_price', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', 'is_point' => 1, @@ -242,6 +254,7 @@ class Order 'label' => '支付方式', 'view_type' => 'field', 'view_key' => 'payment_name', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'form_name' => 'payment_id', @@ -256,6 +269,7 @@ class Order 'label' => '留言信息', 'view_type' => 'field', 'view_key' => 'user_note', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'like', @@ -276,6 +290,7 @@ class Order 'label' => '快递公司', 'view_type' => 'field', 'view_key' => 'express_name', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'form_name' => 'express_id', @@ -290,6 +305,7 @@ class Order 'label' => '快递单号', 'view_type' => 'field', 'view_key' => 'express_number', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -299,6 +315,7 @@ class Order 'label' => '是否评论', 'view_type' => 'module', 'view_key' => 'order/module/is_comments', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -315,6 +332,7 @@ class Order 'label' => '确认时间', 'view_type' => 'field', 'view_key' => 'confirm_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', ], @@ -323,6 +341,7 @@ class Order 'label' => '支付时间', 'view_type' => 'field', 'view_key' => 'pay_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', ], @@ -331,6 +350,7 @@ class Order 'label' => '发货时间', 'view_type' => 'field', 'view_key' => 'delivery_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', ], @@ -339,6 +359,7 @@ class Order 'label' => '完成时间', 'view_type' => 'field', 'view_key' => 'collect_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', ], @@ -347,6 +368,7 @@ class Order 'label' => '取消时间', 'view_type' => 'field', 'view_key' => 'cancel_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', ], @@ -355,6 +377,7 @@ class Order 'label' => '关闭时间', 'view_type' => 'field', 'view_key' => 'close_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', ], @@ -363,6 +386,7 @@ class Order 'label' => '创建时间', 'view_type' => 'field', 'view_key' => 'add_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', ], @@ -371,6 +395,7 @@ class Order 'label' => '更新时间', 'view_type' => 'field', 'view_key' => 'upd_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', ], diff --git a/application/index/form/Orderaftersale.php b/application/index/form/Orderaftersale.php index 00bbf5118..2f12d4a23 100644 --- a/application/index/form/Orderaftersale.php +++ b/application/index/form/Orderaftersale.php @@ -68,6 +68,8 @@ class Orderaftersale 'view_type' => 'module', 'view_key' => 'orderaftersale/module/goods', 'grid_size' => 'lg', + 'is_sort' => 1, + 'sort_field' => 'goods_id', 'search_config' => [ 'form_type' => 'input', 'form_name' => 'id', @@ -84,6 +86,7 @@ class Orderaftersale 'view_data_key' => 'name', 'view_data' => lang('common_order_aftersale_status_list'), 'width' => 120, + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -100,6 +103,7 @@ class Orderaftersale 'view_data_key' => 'name', 'view_data' => lang('common_order_aftersale_type_list'), 'width' => 120, + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -113,6 +117,7 @@ class Orderaftersale 'label' => '原因', 'view_type' => 'field', 'view_key' => 'reason', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -122,6 +127,7 @@ class Orderaftersale 'label' => '退款金额(元)', 'view_type' => 'field', 'view_key' => 'price', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', 'is_point' => 1, @@ -131,6 +137,7 @@ class Orderaftersale 'label' => '退货数量', 'view_type' => 'field', 'view_key' => 'number', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', ], @@ -140,6 +147,7 @@ class Orderaftersale 'view_type' => 'field', 'view_key' => 'msg', 'grid_size' => 'sm', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -152,6 +160,7 @@ class Orderaftersale 'view_data_key' => 'name', 'view_data' => lang('common_order_aftersale_refundment_list'), 'width' => 120, + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -165,6 +174,7 @@ class Orderaftersale 'label' => '快递公司', 'view_type' => 'field', 'view_key' => 'express_name', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -174,6 +184,7 @@ class Orderaftersale 'label' => '快递单号', 'view_type' => 'field', 'view_key' => 'express_number', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -183,6 +194,7 @@ class Orderaftersale 'label' => '申请时间', 'view_type' => 'field', 'view_key' => 'apply_time_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', 'form_name' => 'apply_time', @@ -192,6 +204,7 @@ class Orderaftersale 'label' => '确认时间', 'view_type' => 'field', 'view_key' => 'confirm_time_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', 'form_name' => 'confirm_time', @@ -201,6 +214,7 @@ class Orderaftersale 'label' => '退货时间', 'view_type' => 'field', 'view_key' => 'delivery_time_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', 'form_name' => 'delivery_time', @@ -210,6 +224,7 @@ class Orderaftersale 'label' => '审核时间', 'view_type' => 'field', 'view_key' => 'audit_time_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', 'form_name' => 'audit_time', @@ -219,6 +234,7 @@ class Orderaftersale 'label' => '创建时间', 'view_type' => 'field', 'view_key' => 'add_time_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', 'form_name' => 'add_time', @@ -228,6 +244,7 @@ class Orderaftersale 'label' => '更新时间', 'view_type' => 'field', 'view_key' => 'upd_time_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', 'form_name' => 'upd_time', diff --git a/application/index/form/Usergoodsbrowse.php b/application/index/form/Usergoodsbrowse.php index 639773a59..4379d1577 100644 --- a/application/index/form/Usergoodsbrowse.php +++ b/application/index/form/Usergoodsbrowse.php @@ -78,6 +78,8 @@ class UserGoodsBrowse 'view_type' => 'module', 'view_key' => 'usergoodsbrowse/module/goods', 'grid_size' => 'lg', + 'is_sort' => 1, + 'sort_field' => 'g.title', 'search_config' => [ 'form_type' => 'input', 'form_name' => 'g.title|g.model|g.simple_desc|g.seo_title|g.seo_keywords|g.seo_keywords', @@ -89,6 +91,7 @@ class UserGoodsBrowse 'label' => '销售价格(元)', 'view_type' => 'field', 'view_key' => 'price', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', 'form_name' => 'g.min_price', @@ -99,6 +102,7 @@ class UserGoodsBrowse 'label' => '原价(元)', 'view_type' => 'field', 'view_key' => 'original_price', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', 'form_name' => 'g.min_original_price', @@ -109,6 +113,7 @@ class UserGoodsBrowse 'label' => '创建时间', 'view_type' => 'field', 'view_key' => 'add_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', 'form_name' => 'b.add_time', diff --git a/application/index/form/Usergoodsfavor.php b/application/index/form/Usergoodsfavor.php index a5e0c6044..80ae247cd 100644 --- a/application/index/form/Usergoodsfavor.php +++ b/application/index/form/Usergoodsfavor.php @@ -78,6 +78,8 @@ class UserGoodsFavor 'view_type' => 'module', 'view_key' => 'usergoodsfavor/module/goods', 'grid_size' => 'lg', + 'is_sort' => 1, + 'sort_field' => 'g.title', 'search_config' => [ 'form_type' => 'input', 'form_name' => 'g.title|g.model|g.simple_desc|g.seo_title|g.seo_keywords|g.seo_keywords', @@ -89,6 +91,7 @@ class UserGoodsFavor 'label' => '销售价格(元)', 'view_type' => 'field', 'view_key' => 'price', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', 'form_name' => 'g.min_price', @@ -99,6 +102,7 @@ class UserGoodsFavor 'label' => '原价(元)', 'view_type' => 'field', 'view_key' => 'original_price', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', 'form_name' => 'g.min_original_price', @@ -109,6 +113,7 @@ class UserGoodsFavor 'label' => '创建时间', 'view_type' => 'field', 'view_key' => 'add_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', 'form_name' => 'f.add_time', diff --git a/application/index/form/Userintegral.php b/application/index/form/Userintegral.php index ae31a8dbe..d16069e5a 100644 --- a/application/index/form/Userintegral.php +++ b/application/index/form/Userintegral.php @@ -68,6 +68,7 @@ class Userintegral 'view_key' => 'type', 'view_data_key' => 'name', 'view_data' => lang('common_integral_log_type_list'), + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'select', 'where_type' => 'in', @@ -81,6 +82,7 @@ class Userintegral 'label' => '操作积分', 'view_type' => 'field', 'view_key' => 'operation_integral', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', ], @@ -89,6 +91,7 @@ class Userintegral 'label' => '原始积分', 'view_type' => 'field', 'view_key' => 'original_integral', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', ], @@ -97,6 +100,7 @@ class Userintegral 'label' => '最新积分', 'view_type' => 'field', 'view_key' => 'new_integral', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'section', ], @@ -106,6 +110,7 @@ class Userintegral 'view_type' => 'field', 'view_key' => 'msg', 'grid_size' => 'sm', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'input', 'where_type' => 'like', @@ -115,6 +120,7 @@ class Userintegral 'label' => '时间', 'view_type' => 'field', 'view_key' => 'add_time_time', + 'is_sort' => 1, 'search_config' => [ 'form_type' => 'datetime', 'form_name' => 'add_time', diff --git a/application/index/view/default/public/module/form_table.html b/application/index/view/default/public/module/form_table.html index b530cbb53..9422783f5 100644 --- a/application/index/view/default/public/module/form_table.html +++ b/application/index/view/default/public/module/form_table.html @@ -30,10 +30,10 @@ {{/switch}} - {{if isset($form_table['base']['is_search']) and $form_table['base']['is_search'] eq 1 and isset($t['is_sort']) and $t['is_sort'] eq 1 and !empty($t['sort_field'])}} + {{if isset($t['is_sort']) and $t['is_sort'] eq 1 and !empty($t['sort_key'])}}
- - + +
{{/if}} diff --git a/application/module/FormHandleModule.php b/application/module/FormHandleModule.php index a9e7e7072..ad965a2ad 100644 --- a/application/module/FormHandleModule.php +++ b/application/module/FormHandleModule.php @@ -108,6 +108,9 @@ class FormHandleModule ]); } + // 初始化 + $this->Init(); + // md5key $this->FromMd5Key($module, $action); @@ -138,6 +141,23 @@ class FormHandleModule return DataReturn('success', 0, $data); } + /** + * 初始化 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-10-29 + * @desc description + */ + public function Init() + { + // 排序 + $this->order_by['key'] = empty($this->out_params['fp_order_by_key']) ? '' : $this->out_params['fp_order_by_key']; + $this->order_by['val'] = empty($this->out_params['fp_order_by_val']) ? '' : $this->out_params['fp_order_by_val']; + $this->order_by['field'] = ''; + $this->order_by['data'] = ''; + } + /** * 排序字段处理 * @author Devil @@ -148,15 +168,10 @@ class FormHandleModule */ public function FormOrderByHandle() { - $order_by_key = empty($this->out_params['fp_order_by_key']) ? '' : $this->out_params['fp_order_by_key']; - $order_by_val = empty($this->out_params['fp_order_by_val']) ? '' : $this->out_params['fp_order_by_val']; - $order_by_data = (empty($order_by_key) || empty($order_by_val)) ? '' : $order_by_key.' '.$order_by_val; - - $this->order_by = [ - 'data' => $order_by_data, - 'key' => $order_by_key, - 'val' => $order_by_val, - ]; + if(!empty($this->order_by['field']) && !empty($this->order_by['val'])) + { + $this->order_by['data'] = $this->order_by['field'].' '.$this->order_by['val']; + } } /** @@ -333,15 +348,15 @@ class FormHandleModule } } + // 表单key + $fk = 'f'.$k; + + // 表单名称 + $form_name = (!empty($v['search_config']) && !empty($v['search_config']['form_name'])) ? $v['search_config']['form_name'] : (isset($v['view_key']) ? $v['view_key'] : ''); + // 条件处理 if(!empty($v['search_config']) && !empty($v['search_config']['form_type'])) { - // 搜索 key 未指定则使用显示数据的字段名称 - if(empty($v['search_config']['form_name'])) - { - $v['search_config']['form_name'] = isset($v['view_key']) ? $v['view_key'] : ''; - } - // 基础数据处理 if(!empty($v['search_config']['form_name'])) { @@ -349,7 +364,7 @@ class FormHandleModule $label = empty($v['label']) ? '' : $v['label']; // 唯一 formkey - $form_key = 'f'.$k.'p'; + $form_key = $fk.'p'; $v['form_key'] = $form_key; // 根据组件类型处理 @@ -413,7 +428,7 @@ class FormHandleModule // 搜索条件数据处理 // 表单字段名称 - $where_name = $v['search_config']['form_name']; + $where_name = $form_name; // 条件类型 $where_type = isset($v['search_config']['where_type']) ? $v['search_config']['where_type'] : $v['search_config']['form_type']; // 是否自定义条件处理 @@ -551,9 +566,13 @@ class FormHandleModule break; } } + } - // 排序字段 - $v['sort_field'] = empty($v['sort_field']) ? $where_name : $v['sort_field']; + // 排序key与字段 + $v['sort_key'] = $fk.'o'; + if($v['sort_key'] == $this->order_by['key']) + { + $this->order_by['field'] = empty($v['sort_field']) ? $form_name : $v['sort_field']; } } } diff --git a/application/service/AdminRoleService.php b/application/service/AdminRoleService.php index 66d1dd14d..8bc57b570 100644 --- a/application/service/AdminRoleService.php +++ b/application/service/AdminRoleService.php @@ -35,7 +35,6 @@ class AdminRoleService $where = empty($params['where']) ? [] : $params['where']; $field = empty($params['field']) ? '*' : $params['field']; $order_by = empty($params['order_by']) ? 'id desc' : trim($params['order_by']); - $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; diff --git a/application/service/AdminService.php b/application/service/AdminService.php index 887a33f7a..9c4dff35b 100755 --- a/application/service/AdminService.php +++ b/application/service/AdminService.php @@ -34,7 +34,6 @@ class AdminService $where = empty($params['where']) ? [] : $params['where']; $field = empty($params['field']) ? '*' : $params['field']; $order_by = empty($params['order_by']) ? 'id desc' : trim($params['order_by']); - $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; diff --git a/application/service/AnswerService.php b/application/service/AnswerService.php index 316bb507d..1f1731a51 100755 --- a/application/service/AnswerService.php +++ b/application/service/AnswerService.php @@ -48,10 +48,10 @@ class AnswerService public static function AnswerList($params = []) { $where = empty($params['where']) ? [] : $params['where']; - $m = isset($params['m']) ? intval($params['m']) : 0; - $n = isset($params['n']) ? intval($params['n']) : 10; $field = empty($params['field']) ? '*' : $params['field']; $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; + $m = isset($params['m']) ? intval($params['m']) : 0; + $n = isset($params['n']) ? intval($params['n']) : 10; // 获取数据列表 $data = Db::name('Answer')->field($field)->where($where)->limit($m, $n)->order($order_by)->select(); diff --git a/application/service/AppCenterNavService.php b/application/service/AppCenterNavService.php index 59e1732d4..675eb61ee 100755 --- a/application/service/AppCenterNavService.php +++ b/application/service/AppCenterNavService.php @@ -36,7 +36,6 @@ class AppCenterNavService $where = empty($params['where']) ? [] : $params['where']; $field = empty($params['field']) ? '*' : $params['field']; $order_by = empty($params['order_by']) ? 'sort asc, id asc' : trim($params['order_by']); - $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; diff --git a/application/service/AppHomeNavService.php b/application/service/AppHomeNavService.php index c5a2c37a1..ea80ae0c6 100755 --- a/application/service/AppHomeNavService.php +++ b/application/service/AppHomeNavService.php @@ -36,7 +36,6 @@ class AppHomeNavService $where = empty($params['where']) ? [] : $params['where']; $field = empty($params['field']) ? '*' : $params['field']; $order_by = empty($params['order_by']) ? 'sort asc,id asc' : trim($params['order_by']); - $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; diff --git a/application/service/BrandService.php b/application/service/BrandService.php index 98a8a44d2..c86cc3816 100755 --- a/application/service/BrandService.php +++ b/application/service/BrandService.php @@ -34,8 +34,8 @@ class BrandService */ public static function BrandList($params = []) { - $field = empty($params['field']) ? '*' : $params['field']; $where = empty($params['where']) ? [] : $params['where']; + $field = empty($params['field']) ? '*' : $params['field']; $order_by = empty($params['order_by']) ? 'sort asc,id asc' : trim($params['order_by']); $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; diff --git a/application/service/GoodsBrowseService.php b/application/service/GoodsBrowseService.php index 92dbb85ba..2ce83d162 100644 --- a/application/service/GoodsBrowseService.php +++ b/application/service/GoodsBrowseService.php @@ -132,10 +132,10 @@ class GoodsBrowseService public static function GoodsBrowseList($params = []) { $where = empty($params['where']) ? [] : $params['where']; + $field = empty($params['field']) ? 'b.*, g.title, g.original_price, g.price, g.min_price, g.images' : $params['field']; + $order_by = empty($params['order_by']) ? 'b.id desc' : $params['order_by']; $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; - $order_by = empty($params['order_by']) ? 'b.id desc' : $params['order_by']; - $field = 'b.*, g.title, g.original_price, g.price, g.min_price, g.images'; // 获取数据 $data = Db::name('GoodsBrowse')->alias('b')->join(['__GOODS__'=>'g'], 'g.id=b.goods_id')->field($field)->where($where)->limit($m, $n)->order($order_by)->select(); diff --git a/application/service/GoodsCommentsService.php b/application/service/GoodsCommentsService.php index d6f2a969f..b894ccd90 100644 --- a/application/service/GoodsCommentsService.php +++ b/application/service/GoodsCommentsService.php @@ -194,12 +194,13 @@ class GoodsCommentsService public static function GoodsCommentsList($params = []) { $where = empty($params['where']) ? [] : $params['where']; + $field = empty($params['field']) ? '*' : $params['field']; + $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; - $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; // 获取数据列表 - $data = Db::name('GoodsComments')->where($where)->limit($m, $n)->order($order_by)->select(); + $data = Db::name('GoodsComments')->where($where)->field($field)->limit($m, $n)->order($order_by)->select(); if(!empty($data)) { // 获取商品信息 diff --git a/application/service/GoodsFavorService.php b/application/service/GoodsFavorService.php index 8be5c1419..64b5405b0 100644 --- a/application/service/GoodsFavorService.php +++ b/application/service/GoodsFavorService.php @@ -195,10 +195,10 @@ class GoodsFavorService public static function GoodsFavorList($params = []) { $where = empty($params['where']) ? [] : $params['where']; + $field = empty($params['field']) ? 'f.*, g.title, g.original_price, g.price, g.min_price, g.images' : $params['field']; + $order_by = empty($params['order_by']) ? 'f.id desc' : $params['order_by']; $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; - $order_by = empty($params['order_by']) ? 'f.id desc' : $params['order_by']; - $field = 'f.*, g.title, g.original_price, g.price, g.min_price, g.images'; // 获取数据 $data = Db::name('GoodsFavor')->alias('f')->join(['__GOODS__'=>'g'], 'g.id=f.goods_id')->field($field)->where($where)->limit($m, $n)->order($order_by)->select(); diff --git a/application/service/IntegralService.php b/application/service/IntegralService.php index eb75c3351..1fea6fa12 100755 --- a/application/service/IntegralService.php +++ b/application/service/IntegralService.php @@ -72,10 +72,10 @@ class IntegralService public static function IntegralLogList($params = []) { $where = empty($params['where']) ? [] : $params['where']; + $field = empty($params['field']) ? '*' : $params['field']; + $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; - $field = '*'; - $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; // 获取数据列表 $data = Db::name('UserIntegralLog')->where($where)->field($field)->limit($m, $n)->order($order_by)->select(); diff --git a/application/service/MessageService.php b/application/service/MessageService.php index 30d459a20..d6f5db102 100755 --- a/application/service/MessageService.php +++ b/application/service/MessageService.php @@ -185,10 +185,10 @@ class MessageService public static function MessageList($params = []) { $where = empty($params['where']) ? [] : $params['where']; + $field = empty($params['field']) ? '*' : $params['field']; + $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; - $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; - $field = '*'; // 获取数据列表 $data = Db::name('Message')->where($where)->field($field)->limit($m, $n)->order($order_by)->select(); diff --git a/application/service/OrderAftersaleService.php b/application/service/OrderAftersaleService.php index 1cd743d9f..86210456e 100644 --- a/application/service/OrderAftersaleService.php +++ b/application/service/OrderAftersaleService.php @@ -388,10 +388,10 @@ class OrderAftersaleService public static function OrderAftersaleList($params = []) { $where = empty($params['where']) ? [] : $params['where']; - $m = isset($params['m']) ? intval($params['m']) : 0; - $n = isset($params['n']) ? intval($params['n']) : 10; $field = empty($params['field']) ? '*' : $params['field']; $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; + $m = isset($params['m']) ? intval($params['m']) : 0; + $n = isset($params['n']) ? intval($params['n']) : 10; // 获取数据列表 $data = Db::name('OrderAftersale')->field($field)->where($where)->limit($m, $n)->order($order_by)->select(); diff --git a/application/service/OrderService.php b/application/service/OrderService.php index 4b0ac1172..b26d3f34a 100755 --- a/application/service/OrderService.php +++ b/application/service/OrderService.php @@ -988,12 +988,13 @@ class OrderService public static function OrderList($params = []) { $where = empty($params['where']) ? [] : $params['where']; + $field = empty($params['field']) ? '*' : $params['field']; + $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; - $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; // 获取订单 - $data = Db::name('Order')->where($where)->limit($m, $n)->order($order_by)->select(); + $data = Db::name('Order')->where($where)->field($field)->limit($m, $n)->order($order_by)->select(); // 数据处理 return self::OrderDataHandle($data, $params); diff --git a/application/service/PayLogService.php b/application/service/PayLogService.php index d1aef68c1..5658729d1 100755 --- a/application/service/PayLogService.php +++ b/application/service/PayLogService.php @@ -177,10 +177,10 @@ class PayLogService public static function PayLogList($params = []) { $where = empty($params['where']) ? [] : $params['where']; + $field = empty($params['field']) ? '*' : $params['field']; + $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; - $field = '*'; - $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; // 获取数据列表 $data = Db::name('PayLog')->where($where)->field($field)->limit($m, $n)->order($order_by)->select(); diff --git a/application/service/PayRequestLogService.php b/application/service/PayRequestLogService.php index 9346da3f6..1c8703bf0 100644 --- a/application/service/PayRequestLogService.php +++ b/application/service/PayRequestLogService.php @@ -108,10 +108,10 @@ class PayRequestLogService public static function PayRequestLogList($params = []) { $where = empty($params['where']) ? [] : $params['where']; + $field = empty($params['field']) ? '*' : $params['field']; + $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; - $field = '*'; - $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; // 获取数据列表 $data = Db::name('PayRequestLog')->where($where)->field($field)->limit($m, $n)->order($order_by)->select(); diff --git a/application/service/QuickNavService.php b/application/service/QuickNavService.php index e075bbbae..31a8d9c65 100755 --- a/application/service/QuickNavService.php +++ b/application/service/QuickNavService.php @@ -33,8 +33,8 @@ class QuickNavService */ public static function QuickNavList($params = []) { - $field = empty($params['field']) ? '*' : $params['field']; $where = empty($params['where']) ? [] : $params['where']; + $field = empty($params['field']) ? '*' : $params['field']; $order_by = empty($params['order_by']) ? 'sort asc,id asc' : trim($params['order_by']); $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; diff --git a/application/service/RefundLogService.php b/application/service/RefundLogService.php index a4565f73a..aaedf0dbf 100644 --- a/application/service/RefundLogService.php +++ b/application/service/RefundLogService.php @@ -89,10 +89,10 @@ class RefundLogService public static function RefundLogList($params = []) { $where = empty($params['where']) ? [] : $params['where']; + $field = empty($params['field']) ? '*' : $params['field']; + $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; - $field = '*'; - $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; // 获取数据列表 $data = Db::name('RefundLog')->where($where)->field($field)->limit($m, $n)->order($order_by)->select(); diff --git a/application/service/SearchService.php b/application/service/SearchService.php index 75d44facb..373a13208 100755 --- a/application/service/SearchService.php +++ b/application/service/SearchService.php @@ -11,6 +11,7 @@ namespace app\service; use think\Db; +use think\facade\Hook; use app\service\GoodsService; /** @@ -116,6 +117,34 @@ class SearchService $where[] = ['g.min_price', 'LT', $params['max_price']]; } + // 排序 + if(!empty($params['order_by_field']) && !empty($params['order_by_type']) && $params['order_by_field'] != 'default') + { + $order_by = 'g.'.$params['order_by_field'].' '.$params['order_by_type']; + } else { + $order_by = 'g.access_count desc, g.sales_count desc, g.id desc'; + } + + // 分页计算 + $field = 'g.*'; + $page = max(1, isset($params['page']) ? intval($params['page']) : 1); + $n = 20; + $m = intval(($page-1)*$n); + + // 搜索商品列表读取前钩子 + $hook_name = 'plugins_service_search_goods_list_begin'; + Hook::listen($hook_name, [ + 'hook_name' => $hook_name, + 'is_backend' => true, + 'params' => &$params, + 'where' => &$where, + 'where_keywords'=> &$where_keywords, + 'field' => &$field, + 'order_by' => &$order_by, + 'm' => &$m, + 'n' => &$n, + ]); + // 获取商品总数 $result['total'] = (int) Db::name('Goods')->alias('g')->join(['__GOODS_CATEGORY_JOIN__'=>'gci'], 'g.id=gci.goods_id')->where($where)->where(function($query) use($where_keywords) { $query->whereOr($where_keywords); @@ -124,22 +153,8 @@ class SearchService // 获取商品列表 if($result['total'] > 0) { - // 排序 - $order_by = ''; - if(!empty($params['order_by_field']) && !empty($params['order_by_type']) && $params['order_by_field'] != 'default') - { - $order_by = 'g.'.$params['order_by_field'].' '.$params['order_by_type']; - } else { - $order_by = 'g.access_count desc, g.sales_count desc, g.id desc'; - } - - // 分页计算 - $page = max(1, isset($params['page']) ? intval($params['page']) : 1); - $n = 20; - $m = intval(($page-1)*$n); - // 查询数据 - $data = Db::name('Goods')->alias('g')->join(['__GOODS_CATEGORY_JOIN__'=>'gci'], 'g.id=gci.goods_id')->field('g.*')->where($where)->where(function($query) use($where_keywords) { + $data = Db::name('Goods')->alias('g')->join(['__GOODS_CATEGORY_JOIN__'=>'gci'], 'g.id=gci.goods_id')->field($field)->where($where)->where(function($query) use($where_keywords) { $query->whereOr($where_keywords); })->group('g.id')->order($order_by)->limit($m, $n)->select(); diff --git a/application/service/SlideService.php b/application/service/SlideService.php index d8410c205..81089c8a4 100755 --- a/application/service/SlideService.php +++ b/application/service/SlideService.php @@ -33,11 +33,12 @@ class SlideService */ public static function SlideList($params = []) { - $field = empty($params['field']) ? '*' : $params['field']; $where = empty($params['where']) ? [] : $params['where']; + $field = empty($params['field']) ? '*' : $params['field']; $order_by = empty($params['order_by']) ? 'sort asc,id asc' : trim($params['order_by']); $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; + $data = Db::name('Slide')->field($field)->where($where)->order($order_by)->limit($m, $n)->select(); if(!empty($data)) { diff --git a/application/service/UserAddressService.php b/application/service/UserAddressService.php index 53c727ff7..7341a9d6e 100644 --- a/application/service/UserAddressService.php +++ b/application/service/UserAddressService.php @@ -38,7 +38,6 @@ class UserAddressService $where = empty($params['where']) ? [] : $params['where']; $field = empty($params['field']) ? '*' : $params['field']; $order_by = empty($params['order_by']) ? 'id desc' : trim($params['order_by']); - $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; diff --git a/application/service/UserService.php b/application/service/UserService.php index 4c780b346..0ae35df3d 100755 --- a/application/service/UserService.php +++ b/application/service/UserService.php @@ -129,7 +129,6 @@ class UserService $where = empty($params['where']) ? [] : $params['where']; $field = empty($params['field']) ? '*' : $params['field']; $order_by = empty($params['order_by']) ? 'id desc' : trim($params['order_by']); - $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; diff --git a/application/service/WarehouseGoodsService.php b/application/service/WarehouseGoodsService.php index 5656a372e..2599e0853 100644 --- a/application/service/WarehouseGoodsService.php +++ b/application/service/WarehouseGoodsService.php @@ -41,7 +41,8 @@ class WarehouseGoodsService $field = empty($params['field']) ? '*' : $params['field']; $m = isset($params['m']) ? intval($params['m']) : 0; $n = isset($params['n']) ? intval($params['n']) : 10; - $order_by = 'id desc'; + + $order_by = empty($params['order_by']) ? 'id desc' : trim($params['order_by']); $data = Db::name('WarehouseGoods')->field($field)->where($where)->order($order_by)->limit($m, $n)->select(); return DataReturn('处理成功', 0, self::DataHandle($data)); } diff --git a/public/static/common/css/common.css b/public/static/common/css/common.css index c9174d802..432d598f4 100755 --- a/public/static/common/css/common.css +++ b/public/static/common/css/common.css @@ -637,6 +637,11 @@ button.colorpicker-submit img { .form-table-operate-checkbox .am-checkbox { margin-top: 0; } +.form-table-operate-checkbox-submit { + position: absolute; + left: calc(50% - 25px); + top: calc(50% - 14px); +} /** * 表格-字段选择