|
@@ -7,6 +7,7 @@ use App\Models\CmsContentTemplateSet;
|
|
use App\Models\CmsSubjectProduct;
|
|
use App\Models\CmsSubjectProduct;
|
|
use App\Models\CmsSubject;
|
|
use App\Models\CmsSubject;
|
|
use Illuminate\Support\Facades\Cache;
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
+use Illuminate\Support\Facades\Redis;
|
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
|
use Tymon\JWTAuth\Facades\JWTAuth;
|
|
use Tymon\JWTAuth\Facades\JWTAuth;
|
|
|
|
|
|
@@ -247,6 +248,9 @@ class CmsContentTemplateSetRepository
|
|
$pro_array = $product->toArray();
|
|
$pro_array = $product->toArray();
|
|
$res_id = implode(",", array_column($pro_array, 'product_id'));
|
|
$res_id = implode(",", array_column($pro_array, 'product_id'));
|
|
$get_product = $this->get_product($res_id);
|
|
$get_product = $this->get_product($res_id);
|
|
|
|
+ if ($get_product['products']){
|
|
|
|
+ $get_product['products'] = array_slice($get_product['products'],0,20);//楼层仅展示20个商品
|
|
|
|
+ }
|
|
$new_rule[$key]['id'] = $val['id'];
|
|
$new_rule[$key]['id'] = $val['id'];
|
|
$new_rule[$key]['show_type'] = intval($show_type->show_type) ?? '';
|
|
$new_rule[$key]['show_type'] = intval($show_type->show_type) ?? '';
|
|
$new_rule[$key]['url'] = $rule['url'];
|
|
$new_rule[$key]['url'] = $rule['url'];
|
|
@@ -293,6 +297,12 @@ class CmsContentTemplateSetRepository
|
|
$pro_array = $product->toArray();
|
|
$pro_array = $product->toArray();
|
|
$res_id = implode(",", array_column($pro_array, 'product_id'));
|
|
$res_id = implode(",", array_column($pro_array, 'product_id'));
|
|
|
|
|
|
|
|
+ $product_key = config('constants.CMS_PRODUCTS');
|
|
|
|
+ $product_key = sprintf($product_key,md5($res_id));
|
|
|
|
+ if (Cache::has($product_key)) {
|
|
|
|
+ return Cache::store('redis')->get($product_key);
|
|
|
|
+ }
|
|
|
|
+
|
|
try {
|
|
try {
|
|
if (isset($request['field_order'])) {
|
|
if (isset($request['field_order'])) {
|
|
$field_order = $request['field_order'];
|
|
$field_order = $request['field_order'];
|
|
@@ -308,7 +318,12 @@ class CmsContentTemplateSetRepository
|
|
}
|
|
}
|
|
|
|
|
|
$url = config("customer.app_service_url") . '/product/exchange/subject';
|
|
$url = config("customer.app_service_url") . '/product/exchange/subject';
|
|
- return http($url, $array, 'get');
|
|
|
|
|
|
+ $http = http($url, $array, 'get');
|
|
|
|
+ if (!Cache::has($product_key)) {
|
|
|
|
+ Cache::store('redis')->put($product_key, $http, 600);//10分钟过期
|
|
|
|
+ }
|
|
|
|
+ return $http;
|
|
|
|
+
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
return [];
|
|
return [];
|
|
}
|
|
}
|