| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334 |
- <?php
- namespace App\Http\Controllers\Game;
- use App\Facade\TableName;
- use App\Game\GameCard;
- use App\Game\Config\PPGameIDs;
- use App\Game\GlobalUserInfo;
- use App\Game\LogGamecardClick;
- use App\Game\Services\OuroGameService;
- use App\Game\Services\PgSoftService;
- use App\Game\Services\PlatformService;
- use App\Game\Services\ServerService;
- use App\Http\helper\ApiSign;
- use App\Models\AccountsInfo;
- use App\Notification\TelegramBot;
- use App\Util;
- use App\Utility\SetNXLock;
- use Illuminate\Http\Request;
- use Illuminate\Routing\Controller;
- use Illuminate\Support\Facades\Crypt;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Support\Facades\Redis;
- class PPSimController extends Controller
- {
- public function __construct()
- {
- }
- public function launch9x(Request $request)
- {
- $gid = $request->input('gid');
- $level=$request->input('level',0);
- $lang=$request->input('lang',env('DEFAULT_LOCALE','pu'));
- $userid = $request->UserID;
- $lang=['pu'=>'pt','en'=>'en','sp'=>'es'][$lang]??$lang;
- $protocol = $request->isSecure() ? 'https://' : 'http://';
- $domain = $protocol . $request->getHost();
- $rid=substr($gid,2);
- $params=[
- 'norot'=>1,
- 'lang'=>$lang,
- 'level'=>$level,
- 'gid'=>$rid,
- 'UserID'=>$userid,
- 't'=>time()
- ];
- $params['sign'] = ApiSign::sign($params);
- $url="$domain/api/pgsoft/lunchorg?".http_build_query($params);
- switch(substr($gid,0,2)){
- //igt
- case "92":
- $url = "$domain/api/igt/lunchorg?".http_build_query($params);
- break;
- //jili
- case "91":
- $url = "$domain/api/jiligames/lunchorg?".http_build_query($params);
- break;
- //pg
- case "90":
- $url="$domain/api/pgsoft/lunchorg?".http_build_query($params);
- break;
- default:
- $url="$domain/api/pp-0-/lunchorg?".http_build_query($params);
- break;
- }
- return redirect($url);
- }
- public function gameLunch(Request $request)
- {
- $gid = $request->input('gid');
- $user = $request->user();
- if (!$user) {
- $userid = $request->UserID;
- $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', 'PragmaticPlay')->first();
- if($gamecard){
- $gamecard->increment('play_num', 1);
- LogGamecardClick::recordClick($gamecard->id, $userid);
- GameCard::$enableStateCheck = false;
- }
- $gameName=$gamecard->title;
- $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));
- $gamecode=$gid;
- $short2=substr($gamecode, 0, 2);
- $host='test.pgn-nmu2nd.com';
- $game_url='https://'.$host.'/';
- $hide_logo=PPGameIDs::$ids[$gamecode]['hide_logo']||false;
- return view('game.ppsim.html5', compact('host', 'token','gamecode','short2','lang','gameName','game_url','hide_logo'));
- }
- 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>';
- }
- public function gameLunchOrg(Request $request)
- {
- $gid = $request->input('gid');
- $level=$request->input('level',0);
- $lang=$request->input('lang',env('DEFAULT_LOCALE','pu'));
- $lang=['pu'=>'pt','en'=>'en','sp'=>'es'][$lang]??$lang;
- // $lang='pt';
- $userid = $request->UserID;
- $GlobalUID = 'a1b1c1-b53b-'.ServerService::GetLocalSign().'-' . $userid;
- GameCard::$enableStateCheck = false;
- // $gamecard = GameCard::where('gid', $gid)->first();
- // $in_gameid = OuroGameService::getUserInGame($userid, $GlobalUID);
- // if ($in_gameid != intval($gamecard->id)) {
- // Util::WriteLog('24680game', compact('in_gameid', 'gamecard', 'GlobalUID'));
- //// die;
- // }
- //
- // $gamecard = GameCard::where('gid', $gid)->where('brand', 'PGSoft')->first();
- // $gamecard->increment('play_num', 1);
- // //$this->logGameClick($gamecard->id,$userid);
- //
- // LogGamecardClick::recordClick($gamecard->id, $userid);
- // $lang = GlobalUserInfo::getLocale();
- $supportLang = ['en' => "en-US", 'da' => "da-DK", 'es' => "es-AR", 'id' => "id-ID", 'ja' => "ja-JP", 'ko' => "ko-KR", 'pt' => "pt-BR", 'th' => "th-TH", 'vi' => "vi-VN", 'zh' => "zh-CN", 'my' => "my-MM"];
- if (!in_array($lang, array_keys($supportLang))) {
- $lang = 'en';
- }
- $lang=$supportLang[$lang];
- $cdnserver = 'https://sjj.pgn-nmu2nd.com';
- $LogonPass='123';
- $sign = GlobalUserInfo::genGuuidSign((object)compact('GlobalUID','LogonPass'));
- $or = $this->convertString(env('JILI_GAME_DOMAIN','jj.pgn-nmu2nd.com'));
- // $api = $this->convertString('orgbr.pgn-nmu2nd.com');
- // $api = $this->convertString('api.pgn-nmu2nd.com');
- $data=['UserID'=>ServerService::GlobalToUserID($GlobalUID)];
- $gameIdToCodes=[302=>'mcp',51=>'mc',49=>'fullhouse',403=>'fullhouse3',300=>'fg3',223=>'fgp',109=>'fg',35=>'ols2',258=>'dl',47=>'bfs',421=>'lj'];
- $params = ['lang' => $lang, 'ssoKey' => $sign, 'apiId' => 2,'gameId'=>$gid,'gs'=>$or,'domain_platform'=>$or,'domain_gs'=>$or,'be'=>$or];
- $url = $cdnserver . "/{$gameIdToCodes[$gid]}/index.html?" . http_build_query($params).'&iu=true&legalLang=true';
- // https://jj.pgn-nmu2nd.com/mcp/index.html?ssoKey=1e790573d14d23bf6c3c330e3edeef8a1d8b3cae&lang=en-US&legalLang=true&gameId=302&gs=moc.dn2umn-ngp.jj&domain_platform=moc.dn2umn-ngp.jj&domain_gs=semagilij&be=moc.dn2umn-ngp.jj&iu=true&apiId=2&demo=true
- $trans="no-rotated-iframe-container";
- $posClass = "defaultPos";
- $iconClass="widthIcon";
- if(in_array($gid,[49,403])){
- $iconClass="heightIcon";
- if (strpos(strtolower($request->header('User-Agent')), 'iphone') !== false) {
- $posClass = "iosPos";
- $iconClass="widthIcon";
- $trans="rotated-iframe-container";
- }
- }
- $leaveUrl=$request->getSchemeAndHttpHost().'/api/jiligames/leave?UserID='.$userid;
- echo '<!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>JiliGames</title>
- <style>
- body, html {
- margin: 0;
- padding: 0;
- background: #000;
- height: 100vh;
- overflow: hidden;
- -webkit-overflow-scrolling: touch; /* 启用惯性滚动 */
- }
- .rotated-iframe-container {
- width: 100vh; /* 旋转后高度变为宽度 */
- height: 100vw; /* 旋转后宽度变为高度 */
- transform: rotate(-90deg);
- transform-origin: top right;
- position: absolute;
- top: 0;
- right: 100%;
- overflow: hidden;
- }
- .no-rotated-iframe-container {
- width: 100vw; /* 旋转后高度变为宽度 */
- height: 100vh; /* 旋转后宽度变为高度 */
- position: absolute;
- top: 0;
- }
- .rotated-iframe {
- width: 100%;
- height: 100%;
- transform-origin: top right;
- }
- .widthIcon{
- width: 13vh; height: 13%;
- }
- .heightIcon{
- width: 13%; height: 13vw;
- }
- .defaultPos{
- position: absolute; top: 10px; left: 10px; z-index: 9999;
- }
- .iosPos{
- position: absolute; bottom: 10px; left: 10px; z-index: 9999; transform: rotate(-90deg);
- }
- </style>
- </head>
- <body>
- <script>
- document.addEventListener("touchstart", (e) => {
- // 确保滑动事件生效
- }, { passive: true });
- document.addEventListener("touchmove", (e) => {
- // 确保惯性滚动生效
- }, { passive: true });
- function backhome(){
- var xhr = new XMLHttpRequest();
- var url = "'.$leaveUrl.'"; // 这里替换成你实际要访问的 URL
- window.location.href=url;
- // console.log(url);
- // xhr.open("GET", url, true);
- // xhr.send();
- // setTimeout(()=>{
- // if(window.parent&&window.parent!=window){
- // window.parent.postMessage("backhome","*")
- // }else {
- // document.location = "game://a=1&b=2";
- // }
- // },500)
- // document.body.innerHTML=`<span style="color:#000">${url}</span>`;
- }
- </script>
- <div class="'.$trans.'">
- <!-- 嵌入的 iframe -->
- <iframe class="rotated-iframe" frameborder="0" src="'.$url.'"></iframe>
- </div>
- <div id="game-lobby" style="" class="'.$iconClass.' '.$posClass.'">
- <a href="#" onclick="backhome()" > <img src="https://static2.pgn-nmu2nd.com/0temp/back.png" style="display: block; width: 100%; height: 100%; margin-left: auto; margin-right: auto;"></a>
- </div>
- </body>
- </html>';
- return "";
- }
- private function convertString($input)
- {
- return strrev($input);
- }
- }
|