支付模块的表的调整
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package cn.iocoder.common.framework.constant;
|
||||
|
||||
/**
|
||||
* 通用状态枚举
|
||||
*/
|
||||
public enum CommonStatusEnum {
|
||||
|
||||
ENABLE(1, "开启"),
|
||||
DISABLE(2, "关闭");
|
||||
|
||||
/**
|
||||
* 状态值
|
||||
*/
|
||||
private Integer value;
|
||||
/**
|
||||
* 状态名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
CommonStatusEnum(Integer value, String name) {
|
||||
this.value = value;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public CommonStatusEnum setValue(Integer value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public CommonStatusEnum setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,4 +18,25 @@ public class HttpUtil {
|
||||
return authorization.substring(index + 7).trim();
|
||||
}
|
||||
|
||||
public static String getIp(HttpServletRequest request) {
|
||||
// 基于 X-Forwarded-For 获得
|
||||
String ip = request.getHeader("X-Forwarded-For");
|
||||
if (!StringUtils.isEmpty(ip) && !"unKnown".equalsIgnoreCase(ip)) {
|
||||
// 多次反向代理后会有多个ip值,第一个 ip 才是真实 ip
|
||||
int index = ip.indexOf(",");
|
||||
if (index != -1) {
|
||||
return ip.substring(0, index);
|
||||
} else {
|
||||
return ip;
|
||||
}
|
||||
}
|
||||
// 基于 X-Real-IP 获得
|
||||
ip = request.getHeader("X-Real-IP");
|
||||
if (!StringUtils.isEmpty(ip) && !"unKnown".equalsIgnoreCase(ip)) {
|
||||
return ip;
|
||||
}
|
||||
// 默认方式
|
||||
return request.getRemoteAddr();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user