mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-25 05:24:50 +00:00
feat 增加IP地址校验器
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
- [ ] DEMO增加获取微信OpenID和支付宝OpenId功能
|
- [ ] DEMO增加获取微信OpenID和支付宝OpenId功能
|
||||||
- [ ] 支付宝微信等消息通知地址支持一键生成
|
- [ ] 支付宝微信等消息通知地址支持一键生成
|
||||||
- [ ] 管理端界面支持扫码绑定对账接收方功能
|
- [ ] 管理端界面支持扫码绑定对账接收方功能
|
||||||
|
- [ ] 请求IP参数增加正则校验
|
||||||
- [ ] 支付接口公共参数添加随机数字段, 预防重放问题
|
- [ ] 支付接口公共参数添加随机数字段, 预防重放问题
|
||||||
- [ ] 请求接口增加有效期校验, 一个请求十分钟后失效
|
- [ ] 请求接口增加有效期校验, 一个请求十分钟后失效
|
||||||
- [x] 订单和扩展信息进行合并
|
- [x] 订单和扩展信息进行合并
|
||||||
@@ -51,10 +52,5 @@
|
|||||||
- [ ] 同步接口
|
- [ ] 同步接口
|
||||||
- [ ] 对账接口
|
- [ ] 对账接口
|
||||||
**任务池**
|
**任务池**
|
||||||
- [ ] 通道费率计算
|
|
||||||
- [ ] 每日资金流水计算
|
|
||||||
- [ ] 微信消息通知相关配置
|
|
||||||
- [ ] 钉钉消息通知配置
|
|
||||||
- [ ] 支付宝接口升级为V3接口
|
- [ ] 支付宝接口升级为V3接口
|
||||||
- [ ] 增加验签调试等功能的页面
|
- [ ] 增加验签调试等功能的页面
|
||||||
- [ ] 请求IP参数增加正则校验
|
|
||||||
|
@@ -0,0 +1,26 @@
|
|||||||
|
package cn.bootx.platform.common.core.validation;
|
||||||
|
|
||||||
|
import javax.validation.Constraint;
|
||||||
|
import javax.validation.Payload;
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author xxm
|
||||||
|
* @since 2024/6/11
|
||||||
|
*/
|
||||||
|
@Target({ElementType.METHOD, ElementType.FIELD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
// 标记由哪个类来执行校验逻辑,该类需要实现ConstraintValidator接口
|
||||||
|
@Constraint(validatedBy = IpAddressValidator.class)
|
||||||
|
public @interface IpAddress {
|
||||||
|
|
||||||
|
String message() default "IP地址不合法!";
|
||||||
|
|
||||||
|
Class<?>[] groups() default {};
|
||||||
|
|
||||||
|
Class<? extends Payload>[] payload() default {};
|
||||||
|
}
|
@@ -0,0 +1,26 @@
|
|||||||
|
package cn.bootx.platform.common.core.validation;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Validator;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|
||||||
|
import javax.validation.ConstraintValidator;
|
||||||
|
import javax.validation.ConstraintValidatorContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ip地址校验器
|
||||||
|
* @author xxm
|
||||||
|
* @since 2024/6/11
|
||||||
|
*/
|
||||||
|
public class IpAddressValidator implements ConstraintValidator<IpAddress, String> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验是否为IP地址。成功返回true,失败返回false
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isValid(String str, ConstraintValidatorContext constraintValidatorContext) {
|
||||||
|
if (StrUtil.isNotBlank(str)){
|
||||||
|
return Validator.isIpv4(str) || Validator.isIpv6(str);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@@ -41,7 +41,7 @@
|
|||||||
<!-- 二方库版本 -->
|
<!-- 二方库版本 -->
|
||||||
<bootx-platform.version>1.3.6.2</bootx-platform.version>
|
<bootx-platform.version>1.3.6.2</bootx-platform.version>
|
||||||
<!-- 三方库 -->
|
<!-- 三方库 -->
|
||||||
<hutool.version>5.8.24</hutool.version>
|
<hutool.version>5.8.27</hutool.version>
|
||||||
<oshi.version>6.4.4</oshi.version>
|
<oshi.version>6.4.4</oshi.version>
|
||||||
<jackson.version>2.12.3</jackson.version>
|
<jackson.version>2.12.3</jackson.version>
|
||||||
<lang3.version>3.11</lang3.version>
|
<lang3.version>3.11</lang3.version>
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package cn.daxpay.single.param;
|
package cn.daxpay.single.param;
|
||||||
|
|
||||||
import cn.daxpay.single.serializer.TimestampToLocalDateTimeDeserializer;
|
import cn.daxpay.single.serializer.TimestampToLocalDateTimeDeserializer;
|
||||||
|
import cn.bootx.platform.common.core.validation.IpAddress;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -19,6 +20,7 @@ public abstract class PaymentCommonParam {
|
|||||||
|
|
||||||
/** 客户端ip */
|
/** 客户端ip */
|
||||||
@Schema(description = "客户端ip")
|
@Schema(description = "客户端ip")
|
||||||
|
@IpAddress
|
||||||
private String clientIp;
|
private String clientIp;
|
||||||
|
|
||||||
/** 签名 */
|
/** 签名 */
|
||||||
|
Reference in New Issue
Block a user