master
ELF 4 years ago
parent 977cfcba3c
commit c550846454

@ -634,4 +634,9 @@ class ConsoleController extends Think {
}
} while($hasNext);
}
public function testIp()
{
var_dump(\Base\Tool\IPTool::getIpInfo('120.35.40.249'));
}
}

@ -100,10 +100,11 @@ body {
background: #E5E5E5;
color: #535875;
border: none;
border-radius: 4px;
border-radius: 3px;
cursor: pointer;
display: inline-block;
margin-left: 10px;
padding: 0px 10px;
}
.info-row button.bind-btn {
background: #409eff;

@ -469,7 +469,10 @@ class TestingResourceService
throw new \Exception('额度不足');
}
$olderBatch = M('testing_resource_batch', 'tab_')->field(['id'])->where(['user_id' => $testingUser['user_id'], 'game_id' => $gameId])->find();
$olderBatch = M('testing_resource_batch', 'tab_')
->field(['id'])
->where(['user_id' => $testingUser['user_id'], 'game_id' => $gameId, 'verify_status' => 1])
->find();
$batchNo = date('YmdHis') . substr(md5($roleId . strval(microtime(true)) . rand(0, 9999)), 8, 16);
try {

@ -0,0 +1,41 @@
<?php
namespace Base\Tool;
class IPTool
{
public static function getIpInfo($ip)
{
$host = 'https://api01.aliyun.venuscn.com';
$path = '/ip';
$method = 'GET';
$appcode = '244181f0846541a19e24df409736d3b9';
$headers = [];
array_push($headers, 'Authorization:APPCODE ' . $appcode);
$querys = 'ip=' . $ip;
$bodys = '';
$url = $host . $path . '?' . $querys;
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($curl, CURLOPT_HEADER, true);
if (1 == strpos('$'.$host, 'https://')) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
}
$response = curl_exec($curl);
if (!$response) {
return null;
}
$result = json_decode($response, true);
if ($result['ret'] == 200) {
return $result['data'];
} else {
return null;
}
}
}

@ -76,10 +76,11 @@
background: #E5E5E5;
color: #535875;
border: none;
border-radius: 4px;
border-radius: 3px;
cursor: pointer;
display: inline-block;
margin-left: 10px;
padding: 0px 10px;
}
.info-row button.bind-btn {
background: #409eff;

Loading…
Cancel
Save