<?php

namespace App\Http\Controllers\Game;

use App\Facade\TableName;
use App\Game\GameCard;
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 JiliSimController 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)){
            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');
        $level = $request->input('level',0);
        $user = $request->user();
        $userid = $user->UserID;

        $GlobalUID = $user->GlobalUID;

        GameCard::$enableStateCheck = false;
        $gamecard = GameCard::where('gid', $gid)->first();

        $in_gameid = OuroGameService::getUserInGame($userid, $user->GlobalUID);
        if ($in_gameid != intval($gamecard->id)) {
            Util::WriteLog('24680game', compact('in_gameid', 'gamecard', 'user'));
//            die;
        }

        $gamecard = GameCard::where('gid', $gid)->where('brand', 'JILI')->first();
        $gamecard->increment('play_num', 1);
        //$this->logGameClick($gamecard->id,$userid);

        LogGamecardClick::recordClick($gamecard->id, $userid);

        $lang = GlobalUserInfo::getLocale();



        GameCard::$enableStateCheck = false;

        $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];

        $configurls=json_decode(env('CONFIG_GAMES'),true);
        $configurl=$configurls['jili'];


        if($userid=='80001131'){
//            $configurl['api']='api.pgn-nmu2nd.com';
//            $configurl['source']='api.pgn-nmu2nd.com';
        }
        $cdnserver = 'https://'.$configurl['source'];
        $LogonPass='123';
        $sign = GlobalUserInfo::genGuuidSign((object)compact('GlobalUID','LogonPass'));
        $or = $this->convertString($configurl['api']);

        $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'];
        $numid=$this->getGameIDs()[strtoupper($gid)];


        $params = ['lang' => $lang, 'ssoKey' => $sign,  'apiId' => 2,'gameId'=>$gid,'gs'=>$or,'domain_platform'=>$or,'domain_gs'=>$or,'be'=>$or];

        $url = $cdnserver . "/{$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




        echo "<script>
parent.postMessage({cmd:\"closeLoading\"},\"*\");
location.href='$url';
</script>";
        return "";

    }

    private function getGameIDs()
    {
        return ["DEFAULT"=>0,"CF"=>1,"CSH"=>2,"TKS"=>4,"CHILLI"=>5,"LTS"=>6,"DOFULI"=>7,"DOFULII"=>8,"FD"=>9,"GEM"=>10,"TQS"=>11,"CS"=>12,"WS"=>13,"HB"=>14,"KK"=>15,"KK2"=>16,"SH"=>17,"SH2"=>18,"GEM2"=>19,"CF2"=>20,"OLS"=>21,"TWKS"=>22,"GEM3"=>23,"QNZZ"=>24,"TBZZ"=>25,"SH3"=>26,"SSS"=>27,"QZSG"=>28,"QZDN"=>29,"SH4"=>30,"QZGF"=>31,"CF3"=>32,"PP"=>33,"OLS2"=>35,"BBC"=>36,"SH5"=>37,"FS"=>38,"OLS3"=>40,"XYY"=>43,"LFS"=>44,"CBT"=>45,"BS"=>46,"BFS"=>47,"LGB"=>48,"FH"=>49,"MC"=>51,"CK"=>52,"RB2"=>53,"LC"=>54,"SE"=>55,"HS"=>56,"CSHY"=>57,"PLY"=>59,"GQ"=>58,"DT"=>61,"DICE"=>62,"SUD"=>63,"BL"=>64,"ROLL"=>66,"MP"=>67,"EM"=>68,"JS"=>69,"TP"=>72,"TPAK"=>75,"NC"=>76,"BK"=>77,"AG2"=>78,"AB"=>79,"WEBLOBBY"=>80,"CSUS"=>81,"MW"=>85,"BOG"=>87,"LL"=>89,"IFFF"=>91,"CRH"=>92,"RM"=>94,"USA_BK"=>95,"IG"=>96,"SR"=>100,"MS"=>101,"RS2"=>102,"MW2"=>103,"TW"=>106,"SS"=>107,"MW3"=>108,"FG"=>109,"ALI"=>110,"NK"=>111,"PK"=>113,"AA"=>115,"TAXI"=>116,"P89"=>117,"USA_NC"=>120,"RM2"=>121,"B1"=>122,"DOTD"=>126,"CB"=>127,"LUDO"=>128,"THOR"=>130,"PRM"=>132,"MW4"=>134,"ME"=>135,"SAMBA"=>136,"GE"=>137,"USA_FH"=>138,"B2"=>139,"USA_FG"=>140,"USA_AA"=>141,"BH"=>142,"B3"=>143,"CAI"=>144,"LN"=>145,"FB"=>146,"B4"=>147,"B5"=>148,"B6"=>149,"B7"=>150,"B8"=>151,"BAC"=>152,"USA_BFS"=>155,"USA_MS"=>156,"USA_MC"=>157,"TP3"=>159,"CB2"=>160,"BAC2"=>161,"LUDOQ"=>163,"PIRATE"=>164,"USA_BOG"=>165,"USA_TAXI"=>166,"USA_DOTD"=>167,"USA_ME"=>168,"USA_SAMBA"=>169,"USA_GE"=>170,"SC"=>171,"IBINGO"=>172,"B10"=>174,"CNY"=>176,"PLI1"=>179,"LOE"=>180,"WA"=>181,"GJ"=>183,"RSX2"=>184,"FG2"=>185,"MC2"=>186,"C72"=>187,"USA_MW3"=>188,"GA"=>189,"PETRA"=>191,"DF"=>193,"SL"=>198,"USA_THOR"=>201,"USA_CAI"=>202,"PHOENIX"=>208,"AP"=>209,"FB2"=>213,"KA"=>214,"USA_WR"=>218,"USA_LN"=>222,"FGP"=>223,"CTK"=>225,"WITCH"=>226,"AFR"=>228,"CTS"=>230,"BB"=>238,"DBG"=>239,"PS"=>240,"USA_PIRATE"=>243,"USA_BH"=>244,"USA_CNY"=>245,"USA_WA"=>246,"USA_SL"=>247,"USA_GJ"=>251,"ZEUS"=>252,"DL"=>258,"BFS2"=>259,"TPH"=>263,"PW"=>299,"FG3"=>300,"JPJ"=>301,"MCP"=>302,"MP2"=>303,"USA_AP"=>304,"TSQ"=>307,"ENTITY"=>308,"ED"=>324,"DTS"=>372,"WW"=>374,"PSD"=>375,"SAMURAI"=>376,"SM"=>377,"CBT2"=>378,"MPT"=>379,"USA_DF"=>380,"USA_FGP"=>381,"CNT"=>392,"BITE"=>393,"SMG"=>394,"TCT"=>399,"SAD"=>403,"SK"=>408,"SAJ"=>409,"LJ"=>421,"LWC"=>422,"BIKINI"=>423,"GE2"=>424,"FGBB"=>437,"FGMF"=>444,"C7D"=>447,"RG7"=>448,"FGBK8"=>449,"CIY"=>458,"TCB"=>460,"PIRATE2"=>461,"TRP"=>467,"SAJP"=>471,"TCT2"=>472,"BKEX"=>495,"RXMW"=>517,"SAJB"=>520,"RC"=>523,"FG2BJ"=>525,"CROWN"=>526,"JC"=>529,"FG9F"=>533,"SA2"=>542,"TCGOX"=>547,"SMJ"=>549,"SAE"=>557,"FGEXC"=>560,"FGPEXC"=>561,"DOTDEXC"=>562,"FG3EXC"=>580,"SADE"=>585,"SA3T"=>588,"JPJF"=>605,"SAMD"=>625,"SSS_MW2"=>260,"SSS_OLS2"=>265,"SSS_DOTD"=>266,"SSS_MC"=>267,"SSS_ME"=>268,"SSS_KK2"=>269,"SSS_GJ"=>270,"SSS_CAI"=>271,"SSS_BFS"=>275,"SSS_MS"=>276,"SSS_CBT"=>277,"SSS_FG"=>278,"SSS_MW3"=>279,"SSS_ALI"=>281,"SSS_GE"=>282,"SSS_CNY"=>283,"SSS_USA_TAXI"=>284,"SSS_SH"=>285,"SSS_BH"=>286,"SSS_SSS"=>287,"SSS_GQ"=>288,"SSS_THOR"=>290,"SSS_SH4"=>291,"SSS_WS"=>292,"SSS_SH2"=>293,"SSS_LGB"=>294,"SSS_CHILLI"=>295,"SSS_MW"=>309,"SSS_OLS"=>310,"SSS_FGP"=>311,"SSS_BOG"=>312,"SSS_AA"=>313,"SSS_TAXI"=>314,"SSS_SAMBA"=>315,"SSS_RS2"=>316,"SSS_LTS"=>317,"SSS_NC"=>318,"SSS_TW"=>319,"SSS_PIRATE"=>320,"SSS_SL"=>321,"SSS_PP"=>322,"SSS_MW4"=>323,"SSS_GC_MW2"=>328,"SSS_GC_OLS2"=>329,"SSS_GC_DOTD"=>330,"SSS_GC_MC"=>331,"SSS_GC_ME"=>332,"SSS_GC_KK2"=>333,"SSS_GC_CAI"=>334,"SSS_GC_GJ"=>335,"SSS_GC_BFS"=>336,"SSS_GC_MS"=>337,"SSS_GC_CBT"=>338,"SSS_GC_FG"=>339,"SSS_GC_MW3"=>340,"SSS_GC_ALI"=>341,"SSS_GC_GE"=>342,"SSS_GC_CNY"=>343,"SSS_GC_BH"=>344,"SSS_GC_USA_TAXI"=>345,"SSS_GC_SSS"=>346,"SSS_GC_GQ"=>347,"SSS_GC_THOR"=>348,"SSS_GC_SH"=>349,"SSS_GC_LGB"=>350,"SSS_GC_SH4"=>351,"SSS_GC_WS"=>352,"SSS_GC_SH2"=>353,"SSS_GC_CHILLI"=>354,"SSS_GC_MW"=>355,"SSS_GC_OLS"=>356,"SSS_GC_FGP"=>357,"SSS_GC_BOG"=>358,"SSS_GC_AA"=>359,"SSS_GC_TAXI"=>360,"SSS_GC_SAMBA"=>361,"SSS_GC_RS2"=>362,"SSS_GC_LTS"=>363,"SSS_GC_NC"=>364,"SSS_GC_TW"=>365,"SSS_GC_PIRATE"=>366,"SSS_GC_SL"=>367,"SSS_GC_PP"=>368,"SSS_GC_MW4"=>369,"SSS_IBINGO"=>413,"SSS_DF"=>414,"SSS_PETRA"=>415,"SSS_GC_IBINGO"=>416,"SSS_GC_DF"=>417,"SSS_GC_PETRA"=>418,"SSS_ZEUS"=>450,"SSS_GC_ZEUS"=>451,"SSS_PW"=>452,"SSS_GC_PW"=>453,"SSS_TCT"=>454,"SSS_GC_TCT"=>455,"SSS_TPH"=>456,"SSS_GC_TPH"=>457,"SSS_TLP"=>465,"SSS_GC_TLP"=>466];

    }
    public function leaveOrg(Request $request){

        $UserID = $request->UserID;
        $config = ServerService::GetGlobalServerInfoByCode(ServerService::GetLocalSign());

        $api = env('APP_URL');

        try {
            file_get_contents("https://$api/game-api/000/v2/removePlayer/Get?UserID=$UserID");
        }catch (\Exception $e){

        }
        DB::connection('write')->table('QPTreasureDB.dbo.GameScoreLocker')
            ->where('UserID', $UserID)
            ->delete();
        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];



        $configurls=json_decode(env('CONFIG_GAMES'),true);
        $configurl=$configurls['jili'];



        $cdnserver = 'https://'.$configurl['source'];
        $LogonPass='123';
        $sign = GlobalUserInfo::genGuuidSign((object)compact('GlobalUID','LogonPass'));
        $or = $this->convertString($configurl['api']);

        $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 "";
    }

    public function loginSession(Request $request)
    {
        $key=$request->input('key');
        $lang=$request->input('lang');
        if(Redis::exists($key)){
            $session=json_decode(Redis::get($key),true);
        }else {
            try {
                $arr = explode('|', Crypt::decryptString($key));
                $GlobalUID = $arr[0];
                if (!ServerService::IsLocalUser($GlobalUID)) {
                    return ServerService::RedirectToSub($GlobalUID);
                }


                $timestamp = intval($arr[1]);
                if (time() > $timestamp) return ['dt' => null, 'err' => ['cd' => 1302, 'msg' => 'Invalid player session', 'tid' => $request->traceId]];
//            $user = GlobalUserInfo::getGameUserInfo('GlobalUID', $GlobalUID);
            } catch (\Exception $e) {
                $this->log($request, "wrong user");
            }
            if (!isset($GlobalUID) || empty($GlobalUID)) {
                return ['dt' => null, 'err' => ['cd' => 1302, 'msg' => 'Invalid player session', 'tid' => $request->traceId]];
            }


            $data = ['UserID' => ServerService::GlobalToUserID($GlobalUID)];


            $Currency = env("CONFIG_24680_CURRENCY", "BRL");
            $CurrencySymbol = env("CONFIG_24680_DOLLAR", "R$");



            $data['currency'] = $Currency;
            $data['dollar'] = $CurrencySymbol;

            $roomlevel = $request->btt ?? 1;
            $data['limit_room'] = 0;
            if ($roomlevel > 1) {
                $data['limit_room'] = 1;
            }

            $account = AccountsInfo::where('UserID', $data['UserID'])->first();
            if($account)$account=$account->toArray();
            else{
                TelegramBot::getDefault()->sendProgramNotify("jili","get account error",compact('GlobalUID','data'));
                return ['dt' => null, 'err' => ['cd' => 1302, 'msg' => 'Invalid player session', 'tid' => $request->traceId]];
            }
            $data = array_merge($data, $account);

            $session = $data;


//            $add=Redis::get($newToken);

        }
        if(!isset($session)||empty($session)) return ['dt' => null, 'err' => ['cd' => 1302, 'msg' => 'Invalid player session', 'tid' => $request->traceId]];
        $newToken = md5($key);
        Redis::setex($newToken, 7200, json_encode($session));
        return response()->json([
            'homeUrl'           => '',
            'linecode'          => 0,
            'profile'           => [
                'id'               => '',
                'aid'              => $session['UserID'],
                'apiId'            => 2,
                'transactionMode'  => 0,
                'subAgentCode'     => 0,
                'isLobbyOpen'      => true,
                'meta'             => ['agentAccount' => '<nil>'],
                'platform'         => '<nil>',
                'lobbyMode'        => 0,
                'switchOffs'       => [
                    2, 3, 4, 5, 25,
                    26, 27, 35, 41, 44,
                    49
                ],
                'wallets'          => null,
                'nickname'         => $session['NickName'],
                'newNickname'      => '',
                'siteId'           => 0,
                'account'          => $session['Accounts'],
                'coin'             => 0,
                'isJPEnabled'      => 0,
                'linecode'         => 0,
                'prefix'           => '',
                'clientMode'       => [
                    ['eventId' => 1, 'value' => [50]],
                    ['eventId' => 3, 'value' => [10, 20, 30, 40, 50]],
                    ['eventId' => 7, 'value' => ['400']],
                    ['eventId' => 8, 'value' => [120]]
                ],
                'betLevel'         => -1,
                'license'          => 0,
                'isGiftCodeOpen'   => false,
                'freeSpinBetValue' => 0,
                'apiType'          => 0,
                'walletType'       => 1
            ],
            'token'             => $newToken,
            'response'          => ['error' => 0, 'message' => '', 'time' => time()],
            'platformVersion'   => 'uat.2.0.96',
            'lobbyMode'         => 0,
            'disableFullScreen' => 0,
            'country'           => env('VALID_COUNTRY'),
            'certId'            => 0,
            'certArea'          => 0,
            'clientApiParam'    => [],
            'itaAuthId'         => '',
            'thousandthMode'    => '',
//            'add'=>$add
        ]);
    }

    private function convertString($input)
    {
        return strrev($input);

    }


    private function log(Request $request, $addLog = "")
    {
        $post = $request->all();
        Util::WriteLog('jilisim', $post);
        if (!empty($addLog)) Util::WriteLog('jilisim', $addLog);
    }

}
