获取指定类目下的商品

This commit is contained in:
wangxiaowei 2024-12-30 14:33:33 +08:00
parent 9ad0362c41
commit a592f99ac6
2 changed files with 12 additions and 5 deletions

@ -19,6 +19,7 @@
namespace app\api\controller;
use app\api\logic\DistributionLogic;
use app\api\logic\IndexLogic;
use app\common\basics\Api;
use app\api\logic\GoodsLogic;
use app\common\model\goods\GoodsItem;
@ -275,6 +276,7 @@ class Goods extends Api
return JsonServer::error('暂无数据');
}
}
/**
* 热销榜单
*/
@ -349,6 +351,15 @@ class Goods extends Api
}
}
// 年货超值购
public function yearList()
{
$page = $this->request->get('page_no', $this->page_no);
$size = $this->request->get('page_size', $this->page_size);
$list = IndexLogic::getYearGoods($page, $size);
return JsonServer::success('获取成功', $list);
}
// 2024-07-26 新版获取热销榜单
public function hotList()
@ -370,5 +381,4 @@ class Goods extends Api
$list = GoodsLogic::goodsList($type, $page, $size);
return JsonServer::success('获取成功', $list);
}
}

@ -1123,11 +1123,8 @@ class IndexLogic extends Logic
return $hot_list;
}
public static function getYearGoods($get = [])
public static function getYearGoods($page_no = 1, $page_size = 10)
{
$page_no = $get['page_no'] ?? 1;
$page_size = $get['page_size'] ?? 10;
// 销售中商品:未删除/审核通过/已上架
$where = [
['del', '=', GoodsEnum::DEL_NORMAL], // 未删除