select('title', 'id', 'time', 'type','child_id','sort','status','typebind')->orderBy('time', 'desc')->where('type', '!=', 8)->where('type', '!=', 9); if (!empty($where) && is_array($where)) { $data = $data->where($where); } $data = $data->paginate($list); if (!$data) { return -4010010022; //没有数据 } return $data->toArray(); } //获取信息 function getMsg($value, $type) { $fild = $this->getfild($type); $data = $this->select('id', 'time', 'title')->where($fild, $value)->orderBy('time', 'desc')->limit(10)->get(); if (!$data) { return -4010010122; //没有数据 } return $data->toArray(); } function getDmsg($value, $type) { $fild = $this->getfild($type); $data = $this->select('id', 'time', 'title', 'content','img','author','type','sort','child_id','mobilecontent','mobileimg','typebind')->where($fild, $value)->first(); if (!$data) { return -4010010122; //没有数据 } return $data->toArray(); } function getfild($k) { $a = array( 1 => 'id', 2 => 'type', ); return $a[$k]; } function updateMsg($data, $id) { $res = $this->where('id', $id)->update($data); if (!$res) { return -4010011122; } return 1; } //添加公告数据 function addNotice($data){ $res=$this->insert($data); if(!$res){ return -6030001222; } } //获取内容 function getContent($type){ $data=$this->where('type',$type)->orderBy('time', 'asc')->first(); if(!$data){ return -4010010022; //没有数据 } return $data->toArray(); } //更新内容 function updateContent($data,$type){ //检查是否存在 $check=$this->getContent($type); if(!$check<0){ $data['type']=$type; $data['identity']=UUID(); $res=$this->insert($data); }else{ $res=$this->where('type',$type)->orderBy('time', 'asc')->update($data); } if(!$res){ return -4010011122; } return 1; } public function closeGame($where,$data){ return $this->where($where)->update($data); } }