Преглед изворни кода

fix: out_order_no 从34字符缩短到31字符,符合微信32字符限制

skyline пре 2 недеља
родитељ
комит
bec837a5a3

+ 2 - 1
haha-service/src/main/java/com/haha/service/payment/payscore/impl/PayScoreServiceImpl.java

@@ -554,7 +554,8 @@ public class PayScoreServiceImpl implements PayScoreService {
     }
     }
 
 
     private String generateOutOrderNo(Long orderId) {
     private String generateOutOrderNo(Long orderId) {
-        return "PS" + System.currentTimeMillis() + orderId;
+        // 微信限制 out_order_no ≤ 32 字符,PS(2) + 秒级时间戳(10) + orderId(19) = 31
+        return "PS" + (System.currentTimeMillis() / 1000) + orderId;
     }
     }
 
 
     private String formatDateTime(LocalDateTime dateTime) {
     private String formatDateTime(LocalDateTime dateTime) {