|
|
@@ -324,4 +324,29 @@ class GoodsService extends BaseService
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 专区商品
|
|
|
+ * @param $type 专区类型:2-午夜限定,3-蜜友优选
|
|
|
+ * @return array|mixed
|
|
|
+ */
|
|
|
+ public function getListByZoneType($type)
|
|
|
+ {
|
|
|
+ $cacheKey = "caches:goods:zoneList_{$type}";
|
|
|
+ $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'])
|
|
|
+ ->orderBy('sort','desc')
|
|
|
+ ->orderBy('id','asc')
|
|
|
+ ->get();
|
|
|
+ $data = $data? $data->toArray() :[];
|
|
|
+ if($data){
|
|
|
+ RedisService::set($cacheKey, $data, rand(300, 600));
|
|
|
+ }
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
}
|