From 806a9172c1f035eb0adcf86dce93c50f12648f9b Mon Sep 17 00:00:00 2001 From: "home.fengxinyhyl" Date: Tue, 28 May 2024 22:57:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/dao/store/product/SpuDao.php | 4 ++++ app/controller/api/store/product/StoreSpu.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/common/dao/store/product/SpuDao.php b/app/common/dao/store/product/SpuDao.php index 545d79e..0fbe0f4 100644 --- a/app/common/dao/store/product/SpuDao.php +++ b/app/common/dao/store/product/SpuDao.php @@ -17,6 +17,7 @@ use app\common\model\store\StoreCategory; use app\common\repositories\store\StoreCategoryRepository; use app\common\repositories\system\merchant\MerchantRepository; use crmeb\services\VicWordService; +use think\facade\Log; class SpuDao extends BaseDao { @@ -39,10 +40,13 @@ class SpuDao extends BaseDao } }elseif($where['order'] == 'star'){ $order = 'S.star DESC,S.rank DESC'; + }elseif($where['order'] == 'product_id'){ + $order = 'S.product_id ASC'; }else{ $order = 'S.'. (($where['order'] !== '') ?$where['order']: 'star' ).' DESC'; } } + Log::info("Order is ". $order); $order .= ',S.create_time DESC'; if(isset($where['order']) && $where['order'] === 'none'){ diff --git a/app/controller/api/store/product/StoreSpu.php b/app/controller/api/store/product/StoreSpu.php index 366e427..b8a8486 100644 --- a/app/controller/api/store/product/StoreSpu.php +++ b/app/controller/api/store/product/StoreSpu.php @@ -67,7 +67,7 @@ class StoreSpu extends BaseController $limit = 10; $where['is_good'] = 1; } - $where['order'] = $where['order'] ?: 'star'; + $where['order'] = $where['order'] ?: 'product_id'; if ($where['is_trader'] != 1) unset($where['is_trader']); $data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo); return app('json')->success($data);