all(), [ 'appid' => 'required', ], [ 'appid.required' => 'appid不存在', ] ); if ($validator->fails()) { return $this->validatorError($validator->messages()->all(), ErrorCode::CLIENT_WRONG_PARAMS); } $appid = $request->input('appid'); $cate_id = $request->input('id'); $model = new S1GoodsInfoModel(); $cates = S1GoodsCateModel::where('type_id',2)->orderBy('sort')->get(); $query = $model->where('appid',$appid)->where('is_home_cate',1)->orderBy('sort','desc'); if($cate_id) $query = $query->where('home_cate_id',$cate_id); $goods = $query->paginate(); return $this->api(compact('cates','goods')); } }