perf:优化ip2region,改为从服务器下载db文件,而不是打包到项目中
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
package com.tiesheng.login.service;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.tiesheng.login.config.TieshengLoginConfigurer;
|
||||
import com.tiesheng.util.exception.ApiException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
@@ -16,8 +13,6 @@ import java.util.function.Consumer;
|
||||
@Service
|
||||
public class LoginService {
|
||||
|
||||
@Value("${tiesheng.global.host}")
|
||||
String globalHost;
|
||||
@Autowired(required = false)
|
||||
TieshengLoginConfigurer tieshengLoginConfigurer;
|
||||
|
||||
@@ -32,26 +27,4 @@ public class LoginService {
|
||||
consumer.accept(tieshengLoginConfigurer);
|
||||
}
|
||||
|
||||
public String getContextPath() {
|
||||
String context = SpringUtil.getProperty("server.servlet.context-path");
|
||||
if (StrUtil.isEmpty(context)) {
|
||||
context = "";
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
public String buildPath(String path) {
|
||||
if (StrUtil.isEmpty(path)) {
|
||||
path = "";
|
||||
}
|
||||
|
||||
if (!StrUtil.isEmpty(this.globalHost) && !StrUtil.startWith(path, "http")) {
|
||||
path = this.globalHost + this.getContextPath() + path;
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user