获取指定类目下的商品

This commit is contained in:
wangxiaowei 2024-12-30 14:17:34 +08:00
parent 127d39bdb1
commit 8ed6952c07

@ -1,6 +1,7 @@
<?php <?php
namespace app\api\logic; namespace app\api\logic;
use app\api\logic\GoodsLogic;
use app\common\basics\Logic; use app\common\basics\Logic;
use app\common\enum\CommunityArticleEnum; use app\common\enum\CommunityArticleEnum;
use app\common\enum\FootprintEnum; use app\common\enum\FootprintEnum;
@ -19,7 +20,6 @@ use app\common\server\ConfigServer;
use app\common\server\UrlServer; use app\common\server\UrlServer;
use app\api\logic\SeckillGoodsLogic; use app\api\logic\SeckillGoodsLogic;
use app\api\logic\GroupBuyLogic; use app\api\logic\GroupBuyLogic;
use app\api\logic\GoodsLogic;
use think\facade\Db; use think\facade\Db;
use app\common\model\activity_area\ActivityArea; use app\common\model\activity_area\ActivityArea;
use think\facade\Event; use think\facade\Event;
@ -283,6 +283,7 @@ class IndexLogic extends Logic
// 'mall_news' => [], // 'mall_news' => [],
'mall_news' => $mall_news, 'mall_news' => $mall_news,
'hot_list' => $hot_list, 'hot_list' => $hot_list,
'year_shop' => $year_shop,
]; ];
} }
@ -1124,8 +1125,8 @@ class IndexLogic extends Logic
public static function getYearShop($get = []) public static function getYearShop($get = [])
{ {
$page_no = isset($get['page_no']) ?? 1; $page_no = $get['page_no'] ?? 1;
$page_size = isset($get['page_size']) ?? 10; $page_size = $get['page_size'] ?? 10;
// 销售中商品:未删除/审核通过/已上架 // 销售中商品:未删除/审核通过/已上架
$where = [ $where = [
@ -1139,6 +1140,11 @@ class IndexLogic extends Logic
'id' => 'desc' 'id' => 'desc'
]; ];
if (!empty(GoodsLogic::filterShopsIds())) {
// 过滤已删除、已冻结、已暂停营业、已到期的店铺
$where[] = ['shop_id', 'not in', GoodsLogic::filterShopsIds()];
}
// 分类ID // 分类ID
$category_id = 290; $category_id = 290;
$wh = ""; $wh = "";