model = new \addons\unishop\model\Category(); } /** * @ApiTitle (全部分类数据) * @ApiSummary (全部分类数据) * @ApiMethod (GET) * @ApiHeaders (name=token, type=string, required=true, description="用户登录的Token", sample="a2e3cc70-d2d1-41e6-9c14-f1d774ee5e1e") * @ApiHeaders (name=cookie, type=string, required=false, description="用户会话的cookie") * @ApiReturn ({"code":1,"msg":"","data":[]}) * * @ApiReturnParams (name="id", type="integer", description="分类id") * @ApiReturnParams (name="name", type="string", description="分类名称") * @ApiReturnParams (name="pid", type="integer", description="上级id") * @ApiReturnParams (name="image", type="string", description="图片") * @ApiReturnParams (name="type", type="string", description="类型") * @ApiReturnParams (name="flag", type="integer", description="标签/位置") * @ApiReturnParams (name="weigh", type="integer", description="排序") */ public function all(){ $all = $this->model ->where('type','product') ->where('status','normal') ->field('id,name,pid,image,type,flag,weigh') ->order('weigh ASC') ->select(); if ($all) { $all = collection($all)->toArray(); } $this->success('',$all); } public function inlist(){ $list = Db::name('unishop_category') ->where('status','normal') ->field('id,name,image') ->order('weigh ASC') ->select(); $list = list_domain_image($list,['image']); $this->success(1,$list); } /** * @ApiTitle (首页广告下面的分类) * @ApiSummary (首页广告下面的分类) * @ApiMethod (GET) * @ApiHeaders (name=token, type=string, required=true, description="用户登录的Token", sample="a2e3cc70-d2d1-41e6-9c14-f1d774ee5e1e") * @ApiHeaders (name=cookie, type=string, required=false, description="用户会话的cookie") * @ApiReturn ({"code":1,"msg":"","data":{}}) * * @ApiReturnParams (name="id", type="integer", description="分类id") * @ApiReturnParams (name="name", type="string", description="分类名称") * @ApiReturnParams (name="pid", type="integer", description="上级id") * @ApiReturnParams (name="image", type="string", description="图片") * @ApiReturnParams (name="type", type="string", description="类型") * @ApiReturnParams (name="flag", type="integer", description="标签/位置") * @ApiReturnParams (name="weigh", type="integer", description="排序") */ public function menu() { $list = $this->model ->where('flag','index') ->where('status','normal') ->select(); if ($list) { $list = collection($list)->toArray(); } $this->success('菜单',$list); } }