From ca5ce3f1e51af6733af93deb415f420ad89910c3 Mon Sep 17 00:00:00 2001 From: wanghousheng Date: Sun, 4 Feb 2024 16:19:50 +0800 Subject: [PATCH] 1 --- app/admin/controller/Goods.php | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/app/admin/controller/Goods.php b/app/admin/controller/Goods.php index 088ca85a..0349f99e 100644 --- a/app/admin/controller/Goods.php +++ b/app/admin/controller/Goods.php @@ -12,8 +12,8 @@ declare (strict_types=1); namespace app\admin\controller; -use think\response\Json; use think\facade\Db; +use think\response\Json; /** * 商城管理 @@ -61,24 +61,17 @@ class Goods extends Controller if (isset($params['max_price']) && $params['max_price']) { $where[] = ['net_price', '<=', $params['max_price']]; } - $list = Db::connect("dataCenterMysql")->table('goods_sku') - ->where($where) - ->order($sort." ".$order) - ->paginate($this->request->param('per_page', 15))->each(function ($item, $key){ - $item['create_time'] = date("Y-m-d H:i:s", $item['create_time']); - $item['update_time'] = date("Y-m-d H:i:s", $item['update_time']); - $item['channel'] = config('app.platformList')[$item['channel']] ?? ""; - return $item; - }); + $list = Db::connect("dataCenterMysql")->table('goods_sku') + ->where($where) + ->order($sort, $order) + ->paginate($this->request->param('per_page', 15))->each(function ($item, $key) { + $item['create_time'] = date("Y-m-d H:i:s", $item['create_time']); + $item['update_time'] = date("Y-m-d H:i:s", $item['update_time']); + $item['channel'] = config('app.platformList')[$item['channel']] ?? ""; + return $item; + }); return $this->renderSuccess(compact('list')); } - - - - - - - }