This commit is contained in:
jianghanbo 2025-03-25 18:52:13 +08:00
parent f486c1f5fb
commit 70cc6a12ca
2 changed files with 9 additions and 2 deletions
service
app/admin/controller
support

View File

@ -196,7 +196,7 @@ class IndexController extends base
END) AS tobeused_price_80
');
if ($request->admin->id != 1) {
if ($request->admin->is_super != 1) {
$order = $order->where('admin_id', $request->admin->id);
}

View File

@ -15,6 +15,7 @@
use app\server\BaiduApiService;
use support\Container;
use support\Redis;
use support\Request;
use support\Response;
use support\Translation;
@ -540,6 +541,10 @@ function input(string $param = null, $default = null)
}
function get_ip_address($ip) {
$key = 'ip:' . $ip;
if ($ipAddress = Redis::get($key)) {
return $ipAddress;
}
$apiKey = 'a343376de75af8'; // 需注册获取免费额度
$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'];
return (new BaiduApiService())->translate($str, 'auto', 'zh');
$ipAddress = (new BaiduApiService())->translate($str, 'auto', 'zh');
Redis::set($key, $ipAddress);
return $ipAddress;
}