select('gp.id','gp.name','gp.code','gp.bet_example','gp.sample_number','gp.sort','gc.name AS cate_name') ->leftJoin('game_category AS gc','gp.cate_id','=','gc.id') ->orderBy('gp.sort','desc') ->paginate($list); if(!$data){ return -5040000522;//没有数据 } return $data->toArray(); } function getPlayOne($id){ $data=$this->where('id',$id)->first(); if(!$data){ return -5040000622; } return $data->toArray(); } //更新分类信息 function updateOne($data,$id){ $res=$this->where('id',$id)->update($data); if(!$res){ return -5040000122; } return 1; } //检测是否存在 function checkCopyPlay($cate,$code) { $data=$this->where('code',$code)->where('cate_id',$cate)->first(); if(!$data){ return 1; } return -5040451122; } function addPlay($data) { $res=$this->insert($data); if(!$res){ return -5040001122; } } function getAll() { $data = $this->select('id','name')->orderBy('id','asc')->get()->toArray(); if(!$data){ return -5040000522;//没有数据 } return $data; } }