$category_id) { $query->whereOrRaw("find_in_set($category_id, category_ids)"); } })->where('status',GoodsEnum::STATUS_ON_SALE)->order('weigh desc,id desc'); $arrfield = ['id','title','image','category_ids','price','sales','views','description','lineation_price','is_hot','createtime']; // 判断是否分页 if($page > 0){ $nStart = $page * $pageSize; $goodsList = $query->field($arrfield) ->limit($nStart, $pageSize) ->select(); }else{ $goodsList = $query->field($arrfield) ->select(); } $arrGoods = collection($goodsList)->toArray(); return $arrGoods; } // 查询商品关联规格 public static function getGoodsCustomizedSpec($goods_id = 0, $type = 0) { $goodsSkuSpec = GoodsSkuSpec::where('id', $goods_id) ->where('type', $type) ->find(); return $goodsSkuSpec; } }