| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416 |
- <?php
- namespace App\Http\Controllers\Game;
- use App\Game\Config\IgtData;
- use App\Game\GameCard;
- use App\Game\GlobalUserInfo;
- use App\Game\LogGamecardClick;
- use App\Game\Services\ServerService;
- use App\Game\Services\IgtUserAgentParser;
- use App\Models\AccountsInfo;
- use App\Util;
- use Illuminate\Http\Request;
- use Illuminate\Routing\Controller;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Support\Facades\Redis;
- class IgtSimController extends Controller
- {
- public function __construct()
- {
- }
- public $gameConfig=[];
- public function gameLunch(Request $request)
- {
- $softwareId = $request->input('softwareid', '200-1551-001');
- $user = $request->user();
- if (!$user) {
- return response('Unauthorized', 401);
- }
- return $this->renderGateway($request, $softwareId);
- }
- public function gameLunchOrg(Request $request)
- {
- $softwareId = $request->input('softwareid', '200-1551-001');
- return $this->renderGateway($request, $softwareId);
- }
- public function leaveOrg(Request $request)
- {
- $UserID = $request->UserID;
- try {
- DB::connection('write')->table('QPTreasureDB.dbo.GameScoreLocker')
- ->where('UserID', $UserID)
- ->delete();
- } catch (\Throwable $e) {
- }
- return '<script>
- if(window.parent&&window.parent!=window){
- window.parent.postMessage("backhome","*")
- }else {
- document.location = "game://a=1&b=2";
- }
- </script>';
- }
- private function renderGateway(Request $request, string $softwareId)
- {
- if(!strstr($softwareId,'-')){
- $softwareId=substr($softwareId,0,3).'-'.substr($softwareId,3,4).'-'.substr($softwareId,7,3);
- }
- $gid = $request->input('gid');
- $level = $request->input('level',0);
- $user = $request->user();
- if (!$user) {
- $userid = $request->UserID;
- if(!$userid){
- $token=$request->deviceInfoString;
- $session=json_decode(Redis::get($token),true);
- $userid=$session['UserID'];
- if($session['GlobalUID']){
- $GlobalUID=$session['GlobalUID'];
- }
- }else{
- $GlobalUID = 'a1b1c1-b53b-'.ServerService::GetLocalSign().'-' . $userid;
- }
- $user=GlobalUserInfo::getGameUserInfo('UserID',$userid);
- if(!$user){
- $user=AccountsInfo::find($userid);
- }
- }else{
- $GlobalUID = $user->GlobalUID;
- $userid = $user->UserID;
- }
- $lang = GlobalUserInfo::getLocaleByUserID($userid,$request->input('language', env('DEFAULT_LOCALE', 'en')));
- $gamecard = GameCard::where('gid', $gid)->where('brand', 'IGT')->first();
- if($gamecard){
- $gamecard->increment('play_num', 1);
- LogGamecardClick::recordClick($gamecard->id, $userid);
- GameCard::$enableStateCheck = false;
- }
- $data = ['UserID' => ServerService::GlobalToUserID($GlobalUID)];
- $Currency = env("CONFIG_24680_CURRENCY", "USD");
- $CurrencySymbol = env("CONFIG_24680_DOLLAR", "$");
- $data['currency'] = $Currency;
- $data['dollar'] = $CurrencySymbol;
- if(!is_array($user))$user=$user->toArray();
- $data = array_merge($data, $user);
- $session = $data;
- $token = md5($GlobalUID.'|'.microtime());
- Redis::setex($token, 7200, json_encode($session));
- $global = IgtData::$global;
- $games = json_decode(file_get_contents(base_path('app/Game/Config/IGTgamesConfig.json')), true);
- if (!isset($games[$softwareId])) {
- http_response_code(500);
- }
- $game = $games[$softwareId];
- $this->gameConfig=$game;
- $lang = in_array($lang, $global['languages']) ? $lang : 'en';
- $ua = $request->header('User-Agent', '');
- $uaParser = new IgtUserAgentParser($ua);
- $deviceConfig = $uaParser->getDeviceConfig();
- $isMobile = $this->isMobileUA($ua);
- $assetPack = $isMobile ? 'mobile' : 'desktop';
- $cdnBase = rtrim($global['cdnBaseUrl'], '/');
- $skbGatewayPath = $global['skbGatewayPath'];
- $gamePath = $game['gamePath'];
- $requireVersion = $global['requireVersion'];
- $paramGet = [
- 'skincode' => $request->input('skincode', 'MKW'),
- 'ipaddress' => $request->ip(),
- 'forcelat' => $request->input('forcelat', ''),
- 'minbet' => $request->input('minbet', $game['minbet']),
- 'deviceInfoString' => $request->input('deviceInfoString', $token),
- 'forcelocationstatus' => $request->input('forcelocationstatus', '0'),
- 'countrycode' => $request->input('countrycode', 'US'),
- 'channel' => $request->input('channel', $isMobile ? 'MOB' : 'INT'),
- 'nscode' => $request->input('nscode', 'AGLC'),
- 'language' => $lang,
- 'technology' => $request->input('technology', 'HTML'),
- 'loadskin' => $request->input('loadskin', 'IGT'),
- 'forcelng' => $request->input('forcelng', ''),
- 'currencycode' => $request->input('currencycode', 'FPY'),
- 'securetoken' => $request->input('securetoken', 'RGS-DEMO04.SKB'),
- 'softwareid' => $softwareId,
- 'forcelocationmessage' => $request->input('forcelocationmessage', '-SUCCESS'),
- 'presenttype' => $request->input('presenttype', 'STD'),
- 'denomamount' => $game['denomamount']??IgtData::$global['denomamount'],//$request->input('denomamount', '1.0'),
- 'uniqueid' => $request->input('uniqueid', '986'),
- ];
- $paramRGS = [
- 'skincode' => $paramGet['skincode'],
- 'minbet' => $game['minbet'],
- 'countrycode' => $paramGet['countrycode'],
- 'channel' => $paramGet['channel'],
- 'language' => $paramGet['language'],
- 'nscode' => $paramGet['nscode'],
- 'technology' => $paramGet['technology'],
- 'currencycode' => $paramGet['currencycode'],
- 'securetoken' => $paramGet['securetoken'],
- 'playMode' => $request->input('playMode', 'real'),
- 'softwareid' => $paramGet['softwareid'],
- 'denomamount' => $game['denomamount']??IgtData::$global['denomamount'],//$paramGet['denomamount'],
- 'presenttype' => $paramGet['presenttype'],
- 'uniqueid' => $paramGet['uniqueid'],
- ];
- // 注入语言文案
- $langMap = json_decode(file_get_contents(base_path('app/Game/Config/IGTlanguages.json')), true);
- $strings = is_array($langMap) && isset($langMap[$lang]) && is_array($langMap[$lang]) ? $langMap[$lang] : [];
- $jackpotUrl=IgtData::$global['jackpotUrl'];
- $jackpotMeterUrl=null;
- if (isset(IgtData::$global['jackpotMeterPath'])) {
- $jackpotMeterUrl=$jackpotUrl.IgtData::$global['jackpotMeterPath'];
- }
- $jackpotWinsUrl=null;
- if (isset(IgtData::$global['jackpotWinsPath'])) {
- $jackpotWinsUrl=$jackpotUrl.IgtData::$global['jackpotWinsPath'];
- }
- $config = [
- 'serverConfig' => [
- 'paramGet' => $paramGet,
- 'paramRGS' => $paramRGS,
- 'softwareid' => $softwareId,
- 'nscode' => 'SKB',
- 'skincode' => $paramGet['skincode'],
- 'server' => $global['rgsServer'],
- 'showInitialCashier' => 'false',
- 'autopull' => 'N',
- 'securetoken' => $paramGet['securetoken'],
- 'uniqueid' => $paramGet['uniqueid'],
- 'channel' => $paramGet['channel'],
- 'presenttype' => $paramGet['presenttype'],
- 'buildnumber' => $global['buildnumber'],
- 'gameUrl' => $cdnBase . $gamePath . '/launcher.html',
- 'requestTimeout' => $global['requestTimeout'],
- 'requestRetries' => $global['requestRetries'],
- 'ipaddress' => $paramGet['ipaddress'],
- 'playMode' => $request->input('playMode', 'real'),
- 'denomamount' => $game['denomamount']??IgtData::$global['denomamount'],//$game['minbet'],
- 'countrycode' => $paramGet['countrycode'],
- 'revisionTag' => $game['revisionTag'],
- 'paramGame' => [
- 'skincode' => $paramGet['skincode'],
- 'softwareid' => $softwareId,
- 'countrycode' => $paramGet['countrycode'],
- 'assetPack' => $assetPack,
- 'language' => $lang,
- 'currencycode' => $paramGet['currencycode'],
- 'playMode' => $request->input('playMode', 'real'),
- 'revisionTag' => $game['revisionTag'],
- ],
- 'autospin' => [
- 'winLimit' => [1, 2, 5, 10, 100],
- 'lossLimit' => [1, 2, 5, 10, 100],
- 'steps' => [10, 20, 30, 50, 100],
- 'version' => 2,
- ],
- 'cecServerUrl' => $global['rgsCecServer'],
- 'gameVersion' => $game['gameVersion'],
- 'sessionToken' => 'IGTGSRID=' . $token,
- 'dateFormatter' => [
- 'country' => $paramGet['countrycode'],
- 'dateFormatterShort' => 'dd/MM/yyyy',
- 'dateFormatterLong' => 'dd/MM/yyyy HH:mm:ss',
- ],
- 'fusionIntegrationInd' => false,
- 'pendingGps' => false,
- 'checkPass' => false,
- 'jackpotMeterUrl'=>$jackpotMeterUrl,
- 'jackpotWinsUrl'=>$jackpotWinsUrl,
- 'baseHostUrl' => $cdnBase,
- 'needShareButton' => false,
- 'nicknameAutoGen' => true,
- 'authorizationId' => 0,
- 'widgetsEnabled' => true,
- 'supportGSPType' => 'widget',
- 'showTournmentWelComeMessage' => false,
- 'blockInsufficientFund' => false,
- 'enableCustomGSP' => false,
- 'gameInfoInterval' => '',
- ],
- 'deviceConfig' => $deviceConfig,
- 'kernelConfig' => [
- 'splashUrl' => $cdnBase . $gamePath . '/splash.html',
- 'serverType' => 'RGS',
- 'platformVersion' => $global['platformVersion'],
- 'loglevel' => 'WARN',
- 'paramSplash' => [
- 'skincode' => $paramGet['skincode'],
- 'softwareid' => $softwareId,
- 'countrycode' => $paramGet['countrycode'],
- 'assetPack' => $assetPack,
- 'language' => $lang,
- 'currencycode' => $paramGet['currencycode'],
- 'playMode' => $request->input('playMode', 'real'),
- 'revisionTag' => $game['revisionTag'],
- ],
- 'intVerify' => false,
- 'sentryEnabled' => true,
- 'showSoundPrompt' => true,
- 'reportLevels' => new \stdClass(),
- ],
- 'consoleConfig' => [
- 'paramConsole' => [
- 'skincode' => $paramGet['skincode'],
- 'softwareid' => $softwareId,
- 'nscode' => $paramGet['nscode'],
- 'language' => $lang,
- 'currencycode' => $paramGet['currencycode'],
- 'cashiertype' => 'N',
- 'securetoken' => $paramGet['securetoken'],
- 'uniqueid' => $paramGet['uniqueid'],
- ],
- 'lobbyUrl' => $global['mainSiteUrl'],
- 'cashiertype' => 'N',
- 'TCustomView' => [
- 'consoleUrl' => $global['consoleBaseUrl'] . $game['tCustomPath'],
- 'resizable' => 'Y',
- 'width' => '100',
- 'timeout' => '15000',
- 'height' => '31',
- ],
- 'BCustomView' => [
- // 'consoleUrl' => $global['consoleBaseUrl'] . $game['bCustomPath'],
- // 'resizable' => 'N',
- // 'width' => '100%',
- // 'timeout' => '15000',
- // 'height' => '0%',
- ],
- ],
- 'stringsConfig' => $strings,
- 'forceGetParamNames' => [],
- 'gameConfig' => [
- 'studio' => $game['studio'],
- 'gameType' => $game['gameType'],
- 'game' => $game['game'],
- 'gameWindowWidth' => $game['gameWindowWidth'],
- 'spaceBarSpin' => $game['spaceBarSpin'],
- 'minbet' => $game['minbet'],
- 'gameWindowHeight' => $game['gameWindowHeight'],
- 'softDisplay' => $game['softDisplay'],
- 'gameTitle' => $game['gameTitle'],
- 'assetPack' => $assetPack,
- 'language' => $lang,
- 'currencycode' => $paramGet['currencycode'],
- 'denomid' => $game['denomid'],
- 'turboMode' => $game['turboMode'],
- 'speedOption' => $game['speedOption'],
- 'slamStop' => $game['slamStop'],
- 'softwareId' => $softwareId,
- 'dealerVoice' => $game['dealerVoice'],
- 'gleVersion' => $game['gleVersion'],
- 'skbGateWayVersion' => $global['skbGateWayVersion'],
- 'autospin' => [
- 'winLimit' => [1, 2, 5, 10, 100],
- 'lossLimit' => [1, 2, 5, 10, 100],
- 'steps' => [10, 20, 30, 50, 100],
- 'version' => 2,
- ],
- 'rgPresentation' => $game['rgPresentation'],
- ],
- 'gameServiceConfig' => [
- 'flightdeck' => [
- 'url' => $global['flightdeckUrl'],
- ],
- ],
- 'widgetConfig' => [
- 'dcid' => 'SF',
- 'connectorUrl' => $global['widgetUrl'],
- ],
- ];
- $configJson = htmlspecialchars(json_encode($config, JSON_UNESCAPED_SLASHES), ENT_QUOTES, 'UTF-8');
- $iconUrl = $cdnBase . $gamePath . '/icons/icon.png';
- $html = '<!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="X-UA-Compatible" content="IE=EDGE">
- <meta charset="UTF-8">
- <link rel="apple-touch-icon" href="' . $iconUrl . '">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <script>
- (function () {
- var scale = 1;
- if (navigator.userAgent.match(/\s+[789]_[\d_]+\s+like Mac OS X/) && navigator.userAgent.indexOf("7_0") == -1 && /(iPod|iPhone)/.test(navigator.userAgent)) {
- document.write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=" + scale + ", minimum-scale=" + scale + ", maximum-scale=" + scale + ", user-scalable=no, minimal-ui\" />");
- } else {
- document.write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=" + scale + ", minimum-scale=" + scale + ", maximum-scale=" + scale + ", user-scalable=no, viewport-fit=cover\" />");
- }
- })();
- window.addEventListener("message", function(e){ if(!e.data||!e.data.message) return; var m=document.getElementById("messageBoxDiv"); if(m){ m.style.visibility="visible"; document.getElementById("message").innerHTML=e.data.message; } var c=document.getElementById("container"); if(c&&c.parentNode){ c.parentNode.removeChild(c); } }, true);
- </script>
- <meta name="com.igt.skateboard.CLIENTCONFIG" content="' . $configJson . '"/>
- <title>' . htmlspecialchars($game['gameTitle']) . '</title>
- <script type="text/javascript">var require={"waitSeconds":0,"urlArgs":"v=' . $requireVersion . '"};</script>
- <link rel="stylesheet" type="text/css" href="' . $cdnBase . $skbGatewayPath . '/css/style.mob.css?v=' . $requireVersion . '">
- </head>
- <body>
- <img id="loader" class="loader" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==">
- <div id="messageBoxDiv" class="messageBoxDiv" style="visibility:hidden"><div id="message" class="message"></div></div>
- <script data-main="' . $cdnBase . $skbGatewayPath . '/js/kernel.js" src="' . $cdnBase . $skbGatewayPath . '/js/require.js?v=2.1.20"></script>
- </body>
- </html>';
- Util::WriteLog('igtsim', ['softwareid' => $softwareId, 'lang' => $lang]);
- return response($html);
- }
- private function isMobileUA(string $ua): bool
- {
- $ua = strtolower($ua);
- $mobiles = ['iphone', 'ipad', 'ipod', 'android', 'mobile'];
- foreach ($mobiles as $m) {
- if (strpos($ua, $m) !== false) return true;
- }
- return false;
- }
- }
|