| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace App\Models;
- use Illuminate\Support\Facades\DB;
- class Egame_team extends BaseModel {
- protected $table = "egame_team";
- public $timestamps = false;
- //获取赛事信息
- protected function getTeam($where,$list=10){
- $data=$this->orderBy('id','desc');
- if(is_array($where)&&count($where)>0){
- $data=$data->where($where);
- }
- $data=$data->paginate($list);
- return $data->toArray();
- }
- //一条关闭信息
- function getCloseOne($id){
- $data=$this->where('id',$id)->first();
- if(!$data){
- return -5040000622;
- }
- return $data->toArray();
- }
- //检测游戏名字
- function checkCopyGame($match_id){
- $data=$this->where('match_id',$match_id)->first();
- if(!$data){
- return 1;
- }
- return 5040451122;
- }
- //更新关闭信息
- function updateOne($data,$id){
- $res=$this->where('id',$id)->update($data);
- if(!$res){
- return -5040000122;
- }
- return 1;
- }
- //添加
- function addGame($data)
- {
- if(!isset($data['identity'])) {
- $data['identity'] = UUID();
- }
- if(!isset($data['create_time'])){
- $data['create_time'] = date('Y-m-d H:i:s');
- }
- $res = $this->insert($data);
- if (!$res) {
- return -5040001122;
- }
- return 1;
- }
- //获取
- protected function getInfoByID($id){
- $data=$this->where('identity',$id)->first();
- if(!$data){
- return -9040420322;
- }
- return $data->toArray();
- }
- //获取赛事参赛队伍
- protected function getMatchTeam($match_id){
- $data=$this->where('match_id',$match_id)->get();
- if(!$data){
- return -9040440422;
- }
- return $data->toArray();
- }
- }
|