Просмотр исходного кода

feat : 支付宝订单设置自动关闭参数

bilingfeng 1 год назад
Родитель
Сommit
4caf3beeef

+ 21 - 0
game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/pay/AliPayService.java

@@ -13,6 +13,7 @@ import com.zanxiang.common.enums.HttpStatusEnum;
 import com.zanxiang.common.enums.OrderStateEnum;
 import com.zanxiang.common.enums.OsEnum;
 import com.zanxiang.common.exception.BaseException;
+import com.zanxiang.module.util.DateUtil;
 import com.zanxiang.module.util.JsonUtil;
 import com.zanxiang.module.util.URIUtil;
 import com.zanxiang.mybatis.entity.Order;
@@ -35,6 +36,8 @@ import org.springframework.web.client.RestTemplate;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.net.URL;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -195,12 +198,30 @@ public class AliPayService extends PayBaseService {
         AlipayTradeWapPayResponse response;
         try {
             log.error("支付宝H5下单订单号 , outTradeNo : {}", product.getOutTradeNo());
+
+            String timeExpire = DateUtil.formatLocalDateTime(LocalDateTime.now().plusMinutes(3));
+
             response = Factory.Payment.Wap().asyncNotify(notifyUrl)
+                    .optional("time_expire", timeExpire)
                     .pay(product.getSubject(), product.getOutTradeNo(), product.getTotalFee(), "", "");
+
+
+//            response = Factory.Payment.Wap().asyncNotify(notifyUrl)
+//                    .pay(product.getSubject(), product.getOutTradeNo(), product.getTotalFee(), "", "");
+
         } catch (Exception e) {
             log.error("支付宝H5支付异常, product : {}, e:{}", JsonUtil.toString(product), e.getMessage());
             throw new BaseException("支付宝H5支付异常");
         }
+
+
+
+
+
+
+
+
+
         //请求失败
         if (!ResponseChecker.success(response)) {
             log.error("支付宝H5支付失败, product : {}, response : {}", JsonUtil.toString(product), JsonUtil.toString(response));