_rspErr(1, '解析失败'); return; } if (phpcommon\bnCmp($priceBn, phpcommon\bnInit('0')) <= 0) { myself()->_rspErr(1, '不能为负数'); return; } if (phpcommon\bnCmp($priceBn, phpcommon\bnInit('10000000000000')) >= 0) { myself()->_rspErr(1, '超过限制'); return; } myself()->_rspOk(); } public function clearDB() { global $g_conf_mysql_cluster; foreach ($g_conf_mysql_cluster as $mysql_conf) { $conn = new phpcommon\Mysql(array( 'host' => $mysql_conf['host'], 'port' => $mysql_conf['port'], 'user' => $mysql_conf['user'], 'passwd' => $mysql_conf['passwd'], 'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id'] )); $tables = $conn->execQueryAsArray('show tables;'); foreach ($tables as $table) { $tblName = $table[0]; $conn->execScript("DROP TABLE {$tblName};", array()); } } } public function checkWhiteList() { $resHash = array(); $whiteList = require("../res/alphatestWhiteList@alphatestWhiteList.php"); foreach ($whiteList as $item) { $account = trim(strtolower($item['account'])); $i = crc32($account) % 100; if (!getXVal($resHash, $i)) { $list = require("../res/alphatestWhiteList${i}@alphatestWhiteList.php"); $resHash[$i] = $list; } $list = getXVal($resHash, $i); $found = false; foreach ($list as $item2) { $account2 = trim(strtolower($item2['account'])); if ($account == $account2) { $found = true; } } if (!$found) { echo $account . ' not found'; } } myself()->_rspOk(); } public function inWhiteList() { $account = trim(strtolower(getReqVal('account', ''))); $i = crc32($account) % 100; $list = require("../res/alphatestWhiteList${i}@alphatestWhiteList.php"); $found = false; foreach ($list as $item2) { $account2 = trim(strtolower($item2['account'])); if ($account == $account2) { $found = true; } } myself()->_rspData(array( 'found' => $found )); } public function splitWhiteList() { $dataHash = array(); for ($i = 0; $i < 100; ++$i){ $dataHash[$i] = '"' . $account . '"' . "\n"; $dataHash[$i] .= '),' . "\n"; } } for ($i = 0; $i < 100; ++$i){ $dataHash[$i] .= ');' . "\n"; $this->writeToFile("../res/alphatestWhiteList${i}@alphatestWhiteList.php", $dataHash[$i]); } myself()->_rspOk(); } public function isSameSeriesAccount() { $accountId1 = getReqVal('account_id1', ''); $accountId2 = getReqVal('account_id2', ''); error_log(phpcommon\extractOpenId($accountId1)); error_log(phpcommon\extractRealOpenId(phpcommon\extractOpenId($accountId1))); error_log($accountId1 . ' **** ' . $accountId2 . ' ' . phpcommon\isSameSeriesAccount($accountId1, $accountId2)); myself()->_rspData(array( )); } public function outappRecharge() { $price = BlockChainService::formatCurrencyEx(1, 6); echo $price; return; /*{ $obj = array( 'a' => 'safdf' ); if (empty($obj['b'])) { echo '22222'; } //echo $obj['b']; SqlHelper::update( myself()->_getMysql(''), 't_user', array( 'account_id' => getReqVal('account_id', '') ), array( 'address' => null ) ); error_log(json_encode($_REQUEST)); echo 1434; } return;*/ $orderInfo = null; { $params = array( 'c' => 'Shop', 'a' => 'outappPurchase', 'account_id' => getReqVal('account_id', ''), 'session_id' => getReqVal('session_id', ''), 'goods_id' => getReqVal('goods_id', ''), 'goods_num' => getReqVal('goods_num', ''), 'platform' => getReqVal('platform', ''), 'network' => getReqVal('network', ''), 'crypto' => getReqVal('crypto', ''), 'fiat' => getReqVal('fiat', ''), 'fiatAmount' => getReqVal('fiatAmount', ''), 'payWayCode' => getReqVal('payWayCode', ''), 'country' => getReqVal('country', ''), ); $url = "https://game2006api-test.kingsome.cn/webapp/index.php?"; $response = ''; if (!phpcommon\HttpClient::get ($url, $params, $response)) { error_log($response); myself()->_rspErr(500, 'server internal error 3, url:' . $url); die(); return; } $orderInfo = json_decode($response, true); //echo $response; } { $params = array( 'c' => 'Callback', 'a' => 'dispatch', 'action' => 'outappPurchase', //'c' => 'Shop', //'a' => 'buyGoodsDirect', 'account_id' => getReqVal('account_id', ''), 'order_id' => $orderInfo['order_id'], 'status' => 9, 'id' => 1, 'txhash' => '', ); { $signArr = array( 'account_id' => $params['account_id'], 'order_id' => $params['order_id'], 'status' => $params['status'], 'id' => $params['id'], 'txhash' => $params['txhash'] ); ksort($signArr); $arrSign = array(); foreach($signArr as $key => $val){ array_push($arrSign, $key . '=' . $val); } $signStr = implode('&', $arrSign); $sign = hash_hmac('sha256', $signStr, BUY_SERVER_PKEY); error_log($signStr . BUY_SERVER_PKEY . '|!' . $sign); $params['sign'] = $sign; } $url = "https://game2006api-test.kingsome.cn/webapp/index.php?"; $response = ''; if (!phpcommon\HttpClient::get ($url, $params, $response)) { error_log($response); myself()->_rspErr(500, 'server internal error 3, url:' . $url); die(); return; } echo $response; } } private function writeToFile($fileName, $data) { $fp = fopen($fileName, 'w'); if (!$fp) { return; } fwrite($fp, $data . "\n"); fclose($fp); } }