From d78c62620f144b13da78e2644e412881e33add0e Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Mon, 9 Dec 2024 11:36:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E7=83=AD=E9=94=80=E6=A6=9C?= =?UTF-8?q?=E5=8D=95=E8=8E=B7=E5=8F=96=E5=95=86=E5=93=81=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/IndexLogic.php | 51 ++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/app/api/logic/IndexLogic.php b/app/api/logic/IndexLogic.php index ea3fcc6b..c3e88276 100755 --- a/app/api/logic/IndexLogic.php +++ b/app/api/logic/IndexLogic.php @@ -263,7 +263,6 @@ class IndexLogic extends Logic // 热销榜单 $hot_list = self::getIndexHotList(); - return [ 'headlines' => $headlines, 'hots' => $hots, @@ -1085,30 +1084,30 @@ class IndexLogic extends Logic $count = count($hot_list); - if ($count < 6) { - $where[] = ['og.create_time', '>=', strtotime("today")]; - $where[] = ['og.create_time', '<=', strtotime("tomorrow") - 1]; - - $shopWhere = []; - if (!empty(GoodsLogic::filterShopsIds())) { - // 过滤已删除、已冻结、已暂停营业、已到期的店铺 - $shopWhere[] = ['og.shop_id', 'not in', GoodsLogic::filterShopsIds()]; - } - - $order_goods = Db::name('order_goods') - ->alias('og') - ->join('goods g', 'og.goods_id = g.id') - ->field('og.goods_id, og.create_time, count(*) as count, g.id as gid, g.name, g.image, g.issuing_price, g.market_price, g.min_price, g.purchase_price, g.wholesale_price') - ->group('og.goods_id') - ->where($shopWhere) - ->where($onSaleWhere) - ->limit(6 - $count) - ->order('og.create_time desc, count desc') - ->select() - ->toArray(); - } - $result = array_merge($hot_list, $order_goods); - foreach ($result as &$v) { +// if ($count < 6) { +// $where[] = ['og.create_time', '>=', strtotime("today")]; +// $where[] = ['og.create_time', '<=', strtotime("tomorrow") - 1]; +// +// $shopWhere = []; +// if (!empty(GoodsLogic::filterShopsIds())) { +// // 过滤已删除、已冻结、已暂停营业、已到期的店铺 +// $shopWhere[] = ['og.shop_id', 'not in', GoodsLogic::filterShopsIds()]; +// } +// +// $order_goods = Db::name('order_goods') +// ->alias('og') +// ->join('goods g', 'og.goods_id = g.id') +// ->field('og.goods_id, og.create_time, count(*) as count, g.id as gid, g.name, g.image, g.issuing_price, g.market_price, g.min_price, g.purchase_price, g.wholesale_price') +// ->group('og.goods_id') +// ->where($shopWhere) +// ->where($onSaleWhere) +// ->limit(6 - $count) +// ->order('og.create_time desc, count desc') +// ->select() +// ->toArray(); +// } +// $result = array_merge($hot_list, $order_goods); + foreach ($hot_list as &$v) { $v['market_price'] = round($v['min_price'],2); $v['min_price'] = round(0.88*$v['min_price'],2); if (isset($v['image'])) { @@ -1116,6 +1115,6 @@ class IndexLogic extends Logic } } - return $result; + return $hot_list; } }