This commit is contained in:
parent
f486c1f5fb
commit
70cc6a12ca
service
|
@ -196,7 +196,7 @@ class IndexController extends base
|
||||||
END) AS tobeused_price_80
|
END) AS tobeused_price_80
|
||||||
');
|
');
|
||||||
|
|
||||||
if ($request->admin->id != 1) {
|
if ($request->admin->is_super != 1) {
|
||||||
$order = $order->where('admin_id', $request->admin->id);
|
$order = $order->where('admin_id', $request->admin->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
use app\server\BaiduApiService;
|
use app\server\BaiduApiService;
|
||||||
use support\Container;
|
use support\Container;
|
||||||
|
use support\Redis;
|
||||||
use support\Request;
|
use support\Request;
|
||||||
use support\Response;
|
use support\Response;
|
||||||
use support\Translation;
|
use support\Translation;
|
||||||
|
@ -540,6 +541,10 @@ function input(string $param = null, $default = null)
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_ip_address($ip) {
|
function get_ip_address($ip) {
|
||||||
|
$key = 'ip:' . $ip;
|
||||||
|
if ($ipAddress = Redis::get($key)) {
|
||||||
|
return $ipAddress;
|
||||||
|
}
|
||||||
$apiKey = 'a343376de75af8'; // 需注册获取免费额度
|
$apiKey = 'a343376de75af8'; // 需注册获取免费额度
|
||||||
$url = "https://ipinfo.io/{$ip}/json?token={$apiKey}&language=zh-CN";
|
$url = "https://ipinfo.io/{$ip}/json?token={$apiKey}&language=zh-CN";
|
||||||
|
|
||||||
|
@ -551,5 +556,7 @@ function get_ip_address($ip) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$str = $data['country'] . '-' . $data['region'] . '-'. $data['city'];
|
$str = $data['country'] . '-' . $data['region'] . '-'. $data['city'];
|
||||||
return (new BaiduApiService())->translate($str, 'auto', 'zh');
|
$ipAddress = (new BaiduApiService())->translate($str, 'auto', 'zh');
|
||||||
|
Redis::set($key, $ipAddress);
|
||||||
|
return $ipAddress;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue