diff --git a/wfc-modules/wfc-payment/src/main/java/org/wfc/payment/pay/alipay/controller/AliPayController.java b/wfc-modules/wfc-payment/src/main/java/org/wfc/payment/pay/alipay/controller/AliPayController.java
index 13a8084..7d801ec 100644
--- a/wfc-modules/wfc-payment/src/main/java/org/wfc/payment/pay/alipay/controller/AliPayController.java
+++ b/wfc-modules/wfc-payment/src/main/java/org/wfc/payment/pay/alipay/controller/AliPayController.java
@@ -161,6 +161,10 @@ public class AliPayController extends AbstractAliPayApiController {
String returnUrl = aliPayBean.getDomain() + RETURN_URL;
// String notifyUrl = aliPayBean.getDomain() + NOTIFY_URL;
String notifyUrl = aliPayBean.getDomain() + PRE_NOTIFY_URL + NOTIFY_URL;
+ if (StrUtil.isNotBlank(aliPayBean.getTestDomain())) {
+ notifyUrl = aliPayBean.getTestDomain() + PRE_NOTIFY_URL + NOTIFY_URL;
+ }
+
AlipayTradeWapPayModel model = new AlipayTradeWapPayModel();
model.setBody(body);
diff --git a/wfc-modules/wfc-user/pom.xml b/wfc-modules/wfc-user/pom.xml
index f3f7e33..107eab0 100644
--- a/wfc-modules/wfc-user/pom.xml
+++ b/wfc-modules/wfc-user/pom.xml
@@ -98,6 +98,11 @@
org.mapstruct
mapstruct
+
+
+ org.wfc
+ wfc-common-mail
+
diff --git a/wfc-modules/wfc-user/src/main/java/org/wfc/user/controller/UEmailController.java b/wfc-modules/wfc-user/src/main/java/org/wfc/user/controller/UEmailController.java
new file mode 100644
index 0000000..0abff67
--- /dev/null
+++ b/wfc-modules/wfc-user/src/main/java/org/wfc/user/controller/UEmailController.java
@@ -0,0 +1,60 @@
+package org.wfc.user.controller;
+
+
+import cn.hutool.core.util.RandomUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.wfc.common.core.constant.Constants;
+import org.wfc.common.core.constant.GlobalConstants;
+import org.wfc.common.core.domain.R;
+import org.wfc.common.core.utils.MessageUtils;
+import org.wfc.common.core.web.controller.BaseController;
+import org.wfc.common.mail.config.properties.MailProperties;
+import org.wfc.common.mail.utils.MailUtils;
+import org.wfc.common.redis.service.RedisService;
+
+import javax.validation.constraints.NotBlank;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 邮件功能
+ *
+ * @author cyc
+ */
+@Slf4j
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/email")
+public class UEmailController extends BaseController {
+
+ private final MailProperties mailProperties;
+ private final RedisService redisService;
+
+ /**
+ * 邮箱验证码
+ *
+ * @param email 邮箱
+ */
+ @GetMapping("/code")
+ public R emailCode(@NotBlank(message = "{user.email.not.blank}") String email) {
+ if (!mailProperties.getEnabled()) {
+ return R.fail(MessageUtils.message("user.email.not.enable"));
+ }
+ String key = GlobalConstants.CAPTCHA_CODE_KEY + email;
+ String code = RandomUtil.randomNumbers(4);
+ redisService.setCacheObject(key, code, Constants.MAIL_CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
+ try {
+ MailUtils.sendText(email, "Registration verification code", "Your verification code is: " + code + ", The validity period is " + Constants.MAIL_CAPTCHA_EXPIRATION + " minutes, please fill in as soon as possible.");
+ } catch (Exception e) {
+ log.error("验证码短信发送异常 => {}", e.getMessage());
+ return R.fail(e.getMessage());
+ }
+ return R.ok();
+ }
+
+}
diff --git a/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UOrderServiceImpl.java b/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UOrderServiceImpl.java
index dd3f210..5004c10 100644
--- a/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UOrderServiceImpl.java
+++ b/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UOrderServiceImpl.java
@@ -97,6 +97,7 @@ public class UOrderServiceImpl extends ServiceImpl impleme
UAccount account = accountService.getOne(Wrappers.lambdaQuery().eq(UAccount::getUserId, order.getUserId()), false);
Long accountId = null;
boolean isValid = false;
+ BigDecimal oldBalance = BigDecimal.ZERO;
if (ObjectUtil.isNull(account)) {
account = new UAccount();
account.setUserId(order.getUserId());
@@ -104,6 +105,7 @@ public class UOrderServiceImpl extends ServiceImpl impleme
account.setBalanceUsed(BigDecimal.ZERO);
} else {
accountId = account.getId();
+ oldBalance = account.getBalance();
isValid = AccountUtil.isValid(account, new Date());
}
if (OrderTypeEnum.PACKAGE.getCode().equals(order.getType())) {
@@ -126,7 +128,7 @@ public class UOrderServiceImpl extends ServiceImpl impleme
if (StrUtil.isNotBlank(client.getSiteId())) {
wifiApi.authClient(client.getSiteId(), client.getClientMac());
// 套餐生效已授权时,调reconnect重连接口,以便截取时间
- if (isValid) {
+ if (isValid && !(OrderTypeEnum.RECHARGE.getCode().equals(order.getType()) && oldBalance.compareTo(BigDecimal.ZERO) > 0)) {
wifiApi.reconnectClient(client.getSiteId(), client.getClientMac());
}
// 带宽限速