|
|
|
@ -196,16 +196,20 @@ class Goods extends Controller |
|
|
|
|
public function recommended(): Json |
|
|
|
|
{ |
|
|
|
|
$service = new GoodsService; |
|
|
|
|
$cache_key = "goods_recommended".$this->storeId; |
|
|
|
|
if(Cache::has($cache_key)) { |
|
|
|
|
$goodsList = Cache::get($cache_key); |
|
|
|
|
return $this->renderSuccess(compact('goodsList')); |
|
|
|
|
} |
|
|
|
|
// $cache_key = "goods_recommended".$this->storeId; |
|
|
|
|
// if(Cache::has($cache_key)) { |
|
|
|
|
// $goodsList = Cache::get($cache_key); |
|
|
|
|
// return $this->renderSuccess(compact('goodsList')); |
|
|
|
|
// } |
|
|
|
|
$goodsList = $service->recommended(); |
|
|
|
|
Cache::set($cache_key, $goodsList, 60*60); |
|
|
|
|
// Cache::set($cache_key, $goodsList, 60*60); |
|
|
|
|
return $this->renderSuccess(compact('goodsList')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 商品大牌和新品 |
|
|
|
|
* @return Json |
|
|
|
|
*/ |
|
|
|
|
public function brandList(): Json |
|
|
|
|
{ |
|
|
|
|
$service = new GoodsService; |
|
|
|
@ -231,6 +235,10 @@ class Goods extends Controller |
|
|
|
|
return $this->renderSuccess($goodsList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 排行行查看更多 |
|
|
|
|
* @return Json |
|
|
|
|
*/ |
|
|
|
|
public function chartsGoodsList(): Json |
|
|
|
|
{ |
|
|
|
|
$service = new GoodsService; |
|
|
|
@ -239,6 +247,10 @@ class Goods extends Controller |
|
|
|
|
return $this->renderSuccess($goodsList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 首页分类商品排行榜 默认返回3条 |
|
|
|
|
* @return Json |
|
|
|
|
*/ |
|
|
|
|
public function chartsGoodsJing(): Json |
|
|
|
|
{ |
|
|
|
|
$service = new GoodsService; |
|
|
|
|