wesmiler 3 giorni fa
parent
commit
7c88625c92
1 ha cambiato i file con 5 aggiunte e 3 eliminazioni
  1. 5 3
      app/Services/Api/GoodsService.php

+ 5 - 3
app/Services/Api/GoodsService.php

@@ -17,6 +17,7 @@ use App\Models\GoodsModel;
 use App\Models\GoodsSkuModel;
 use App\Models\MemberModel;
 use App\Services\BaseService;
+use App\Services\ConfigService;
 use App\Services\RedisService;
 
 /**
@@ -332,16 +333,17 @@ class GoodsService extends BaseService
      * @param $type 专区类型:2-午夜限定,3-蜜友优选
      * @return array|mixed
      */
-    public function getListByZoneType($type)
+    public function getListByZoneType($type, $limit=0)
     {
-        $cacheKey = "caches:goods:zoneList_{$type}";
+        $limit = $limit?$limit : ConfigService::make()->getConfigByCode("zone_type{$type}_num", 6);
+        $cacheKey = "caches:goods:zoneList_{$type}_{$limit}";
         $data = RedisService::get($cacheKey);
         if($data){
             return $data;
         }
 
         $data = $this->model->where(['zone_type'=>$type,'status'=>1,'mark'=>1])
-            ->select(['id','thumb','price','sku_type','goods_name','sales','stock','category_id','type','zone_type','is_new','status'])
+            ->select(['id','thumb','price','market_price','sku_type','goods_name','sales','stock','category_id','type','zone_type','is_new','status'])
             ->orderBy('sort','desc')
             ->orderBy('id','asc')
             ->get();