|
|
|
@ -294,11 +294,11 @@ class Goods extends Controller |
|
|
|
|
public function recommended(): Json |
|
|
|
|
{ |
|
|
|
|
$service = new GoodsService; |
|
|
|
|
$cache_key = "goods_recommended".$this->storeId; |
|
|
|
|
if(Cache::has($cache_key)) { |
|
|
|
|
$cache_key = "goods_recommended".$this->storeId.($this->user ? $this->user->user_type : 0); |
|
|
|
|
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); |
|
|
|
|
return $this->renderSuccess(compact('goodsList')); |
|
|
|
@ -411,7 +411,7 @@ class Goods extends Controller |
|
|
|
|
$wxConfig = WxappSettingModel::getConfigBasic($store_id); |
|
|
|
|
// 请求api获取短连接 |
|
|
|
|
$link_obj = new ShortLink($wxConfig['app_id'], $wxConfig['app_secret']); |
|
|
|
|
$url = $link_obj->shortUrl($page_url, $page_title); |
|
|
|
|
$url = $link_obj->shortUrl($page_url, ""); |
|
|
|
|
return $this->renderSuccess(['url' => $url]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|