first(); if($card){ $card=self::formatGames([$card])[0]; } return $card; } public static function formatGames($games) { $cdn_org=["cdn.moeda777.com"]; $cdn_replace="24680.imgix.net"; $img_add_param="?auto=format,compress&cs=srgb&dpr=2&w=140"; $img_add_param=""; //处理多语言 $locale=GlobalUserInfo::getLocale(); //处理房间信息 $ouroGameInfos=self::getOuroGameInfo(); foreach($games as $game){ //不是http开头,补齐 if(!strstr($game->link,"http")){ $game->link=GameBasicConfig::$ApiServer.$game->link; } if($game->brand=="PG"&&RouteService::isTestSite()){ $game->link=str_replace('pgpro','pg',$game->link); } if(isset($ouroGameInfos)&&$game->brand=="OURO777"&&!empty($game->gid)){ if(GlobalUserInfo::$me) { $score=GlobalUserInfo::getScoreByUserID(GlobalUserInfo::$me->UserID); if($score>=0) { if (isset($ouroGameInfos[$game->gid]) && !empty($ouroGameInfos[$game->gid])) { $game->level_info = $ouroGameInfos[$game->gid]; } } } } // if($locale=='en'){ // unset($game->img_pt,$game->img_es); // continue; // } if($locale=="pt"&&!empty($game->img_pt)){ $game->img=$game->img_pt; }elseif($locale=="es"){ if(!empty($game->img_es)){ $game->img=$game->img_es; }elseif (!empty($game->img_pt)){ $game->img=$game->img_pt; } } unset($game->img_pt,$game->img_es); $game->img=str_replace($cdn_org,$cdn_replace,$game->img).$img_add_param; } return $games; } /** * 关闭state检查 * @var bool */ public static $enableStateCheck=true; protected static function boot() { parent::boot(); if(self::$enableStateCheck) { static::addGlobalScope('where', function (Builder $builder) { // $builder->where('state', 1); $builder->whereRaw(RouteService::getStateToWhereRaw()); }); } } }