wesmiler 1 year ago
parent
commit
048be752cd
1 changed files with 8 additions and 1 deletions
  1. 8 1
      app/Services/Api/GoodsService.php

+ 8 - 1
app/Services/Api/GoodsService.php

@@ -231,6 +231,12 @@ class GoodsService extends BaseService
             return false;
         }
 
+        $cacheKey = "caches:goods:buyList:{$userId}_".md5(json_encode($params,256));
+        $datas = RedisService::get($cacheKey);
+        if($datas){
+            return $datas;
+        }
+
         $goods = [];
         $skuList = [];
         $usdtPrice = RedisService::get("caches:wallets:usdt_rate");
@@ -312,7 +318,8 @@ class GoodsService extends BaseService
             $this->error = 2901;
             return false;
         }
-
+        
+        RedisService::set($cacheKey, ['sku_list'=> array_values($skuList), 'goods'=> $goods], rand(2,3));
         return ['sku_list'=> array_values($skuList), 'goods'=> $goods];
     }