| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- <?php
- namespace App\Models;
- class Setinfo extends BaseModel {
- // const CREATED_AT = 'createTime';
- protected $table = "setinfo";
- // const UPDATED_AT = 'updateTime';
- public $timestamps = false;
- // protected $primaryKey = "id";
- //获得公告内容
- function getNotice(){
- $data=$this->where('id',19)->where('infotype',8)->first();
- if(!$data){
- return -6010000122;
- }
- return $data->toArray();
- }
- //获得弹框内容
- function getBoxOut(){
- $data=$this->where('infotype',6)->first();
- if(!$data){
- return -6010000222;//没有弹框信息
- }
- return $data->toArray();
- }
- function fsnum(){
- $data=$this->where('id',1001)->first();
- if(!$data){
- return -6010000222;//没有弹框信息
- }
- return $data->toArray();
- }
- //获取客服qq信息
- function getQQnumber(){
- $data=$this->where('infotype',16)->first();
- if(!$data){
- return -6010000322;//没有qq信息
- }
- return $data->toArray();
- }
- //获取代理模式开关信息
- function getAgentSet(){
- $data=$this->where('infotype',13)->first();
- if(!$data){
- return -6010000422;//获取设置信息失败
- }
- return $data->toArray();
- }
- //获取平台维护开关设置
- function getPlatSet(){
- $data=$this->where('infotype',17)->first();
- if(!$data){
- return -6010000622;//获取失败
- }
- return $data->toArray();
- }
- //虚拟游戏设置信息
- function getPrizeSet(){
- $data=$this->where('infotype',15)->first();
- if(!$data){
- return -6010000622;//获取失败
- }
- return $data->toArray();
- }
- //获取转账银行信息
- function getBankInfo(){
- $data=$this->where('infotype',10)->first();
- if(!$data){
- return -6010000722;//获取失败
- }
- return $data->toArray();
- }
- //跑马灯内容
- function getRunNotice(){
- $data=$this->where('infotype',9)->first();
- if(!$data){
- return -6010000822;//获取失败
- }
- return $data->toArray();
- }
- function getAllSet($where=''){
- $data=array(6,9,13,15,16,17,18,19);
- if(!empty($where)&&is_array($where)){
- $data=$this->where($where)->whereIn('infotype',$data)->get();
- }else{
- $data=$this->whereIn('infotype',$data)->get();
- }
- if(!$data){
- return -6010000822;//获取失败
- }
- return $data->toArray();
- }
- protected function getsInfo($info_type){
- $info= $this->getInfo($info_type);
- if($info<0){
- return $info;
- }
- return $info['infocontent'];
- }
- //获取msg
- function getInfo($info_type){
- $data=$this->where('infotype',$info_type)->first();
- if(!$data){
- return -6010000122;
- }
- return $data->toArray();
- }
- function getInfos($info_type){
- $data=$this->where('infotype',$info_type)->get();
- if(!$data){
- return -6010000122;
- }
- return $data->toArray();
- }
- //更新设置
- function updateInfo($data,$type){
- $data_arr=$this->where('infotype',$type)->first();
- if(!$data_arr){
- if(!isset($data['infoname'])){
- $data['infoname']='新增';
- }
- $data['identity']=UUID();
- $data['infotype']=$type;
- $res=$this->insert($data);
- }else{
- $res=$this->where('infotype',$type)->update($data);
- }
- if(!$res){
- return -7020050022;//更新失败
- }
- return $res;
- }
- //添加设置
- function addInfo($data){
- $data['identity']=UUID();
- $res=$this->insert($data);
- if(!$res){
- return -7020050022;//更新失败
- }
- return $res;
- }
- //更新设置
- function updateInfos($data,$id){
- $res=$this->where('id',$id)->update($data);
- if(!$res){
- return -7020050022;//更新失败
- }
- return 1;
- }
- function checkdata($data,$id){
- if(empty($id)){
- $arr = $this->where('infoname',$data['infoname'])->where('remarks',$data['remarks'])->first();
- if($arr && isset($arr->id)){
- $id = $arr->id;
- return $this->updateInfos($data,$id);
- }
- return $this->addInfo($data);
- }else{
- $arr = $this->where('id',$id)->first();
- if (!$arr) {
- return -7020050022;//没有数据
- }
- return $this->updateInfos($data,$id);
- }
- }
- protected function getIPlimit(){
- $data=$this->where('infotype',23)->where('status',1)->first();
- if(!$data){
- return -7022250022;//ip设置关闭
- }
- return 1;
- }
- protected function getWebSet(){
- $data=$this->where('remarks','recedata')->first();
- if(!$data){
- return array('infocontent'=>'开游');
- }
- return $data->toArray();
- }
- protected function getPath(){
- $data=$this->where('infotype',18)->first();
- if(!$data){
- return -1234;
- }
- return $data->infocontent;
- }
- //域名检测 2019-01-16 anton liu
- protected function checkDom($dmo)
- {
- return $this
- ->where('infotype','=',1018)
- ->where('infocontent','like','%'.$dmo.'%')
- ->first();
- }
- }
|