1
This commit is contained in:
parent
801f1bc6ad
commit
2324aadc59
@ -31,4 +31,87 @@ class ToolsController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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] = '<?php' . "\n";
|
||||||
|
$dataHash[$i] .= 'return array(' . "\n";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
$whiteList = require("../res/alphatestWhiteList@alphatestWhiteList.php");
|
||||||
|
foreach ($whiteList as $item) {
|
||||||
|
$account = trim(strtolower($item['account']));
|
||||||
|
if (strlen($account) != strlen('0x79b9997987800a4dD60049aa2e6bE3399be66F56')) {
|
||||||
|
var_dump($item);
|
||||||
|
|
||||||
|
}
|
||||||
|
$i = crc32($account) % 100;
|
||||||
|
$dataHash[$i] .= 'array(' . "\n";
|
||||||
|
$dataHash[$i] .= ' "account"=>"' . $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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function writeToFile($fileName, $data)
|
||||||
|
{
|
||||||
|
$fp = fopen($fileName, 'w');
|
||||||
|
if (!$fp) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fwrite($fp, $data . "\n");
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user