|
|
|
@ -170,6 +170,41 @@ class Goods extends GoodsService |
|
|
|
|
} |
|
|
|
|
return $this->formatGoodsList($goodsList); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 推荐的商品列表 |
|
|
|
|
* @return array |
|
|
|
|
* @throws \think\db\exception\DataNotFoundException |
|
|
|
|
* @throws \think\db\exception\DbException |
|
|
|
|
* @throws \think\db\exception\ModelNotFoundException |
|
|
|
|
*/ |
|
|
|
|
public function recommendedNew(): array |
|
|
|
|
{ |
|
|
|
|
// 获取商品推荐数据 |
|
|
|
|
$setting = $this->getRecommendedSetting(); |
|
|
|
|
// 获取商品数据 |
|
|
|
|
$model = new GoodsModel; |
|
|
|
|
if ($setting['params']['source'] === 'choice') { |
|
|
|
|
// 数据来源:手动 |
|
|
|
|
// if (empty($setting['params']['goodsIds'])) return []; |
|
|
|
|
// $goodsList = $model->getListByIdsFromApi($setting['params']['goodsIds']); |
|
|
|
|
// 数据来源:自动 |
|
|
|
|
$goodsList = $model->getList([ |
|
|
|
|
'status' => 10, |
|
|
|
|
'goodsIds' => implode(",",$setting['params']['goodsIds']), |
|
|
|
|
'sortType' => "all", |
|
|
|
|
], 10); |
|
|
|
|
} else { |
|
|
|
|
// 数据来源:自动 |
|
|
|
|
$goodsList = $model->getList([ |
|
|
|
|
'status' => 10, |
|
|
|
|
'categoryId' => $setting['params']['auto']['category'], |
|
|
|
|
'sortType' => $setting['params']['auto']['goodsSort'], |
|
|
|
|
], 10); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $this->formatGoodsList($goodsList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//大牌正品列表 |
|
|
|
|
public function brandList(): array |
|
|
|
|