From 6cb8a607fe7db9a140d11c934a1fc2bdfa3e1e64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=AD=E6=A1=83?= <1098598843@qq.com> Date: Tue, 28 Feb 2023 10:02:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/dao/store/product/SpuDao.php | 2 +- app/common/dao/system/merchant/MerchantDao.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/common/dao/store/product/SpuDao.php b/app/common/dao/store/product/SpuDao.php index 8b971dd0..e47540d3 100644 --- a/app/common/dao/store/product/SpuDao.php +++ b/app/common/dao/store/product/SpuDao.php @@ -29,7 +29,7 @@ class SpuDao extends BaseDao { $order = 'P.sort DESC'; if(isset($where['order'])){ - if(in_array($where['order'], ['is_new', 'price_asc', 'price_desc', 'rate', 'sales'])){ + if(in_array($where['order'], ['is_new', 'price_asc', 'price_desc', 'rate', 'sales','is_benefit'])){ if ($where['order'] == 'price_asc') { $order = 'S.price ASC'; } else if ($where['order'] == 'price_desc') { diff --git a/app/common/dao/system/merchant/MerchantDao.php b/app/common/dao/system/merchant/MerchantDao.php index 68658057..61d4e523 100644 --- a/app/common/dao/system/merchant/MerchantDao.php +++ b/app/common/dao/system/merchant/MerchantDao.php @@ -96,7 +96,9 @@ class MerchantDao extends BaseDao $query->when($order, function ($query) use ($where, $order) { if ($order == 'rate') { $query->order('is_best DESC, product_score DESC,service_score DESC,postage_score DESC'); - } else if ($order == 'location' && isset($where['location']['long'], $where['location']['lat'])) { + } else if ($order == 'sales'){ + $query->order('sales DESC,is_best DESC,sort DESC'); + }else if ($order == 'location' && isset($where['location']['long'], $where['location']['lat'])) { $lng = (float)$where['location']['long']; $lat = (float)$where['location']['lat']; $query->whereNotNull('lat')->whereNotNull('long')