chenbiao 1 жил өмнө
parent
commit
04c2f30fec

+ 4 - 7
netflix-service/src/main/java/com/cyksj/service/chatgpt/impl/ChatGptAccountServiceImpl.java

@@ -43,10 +43,7 @@ import java.math.RoundingMode;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.time.LocalDateTime;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @author chan
@@ -568,7 +565,7 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
                     .goodsId(goodsDonSku.getGoodsId())
                     .skuId(goodsDonSku.getId())
                     .months(goodsDonSku.getMonths())
-                    .use(Math.min(chatgptUser.getLimitNum(), conversationCount.getLong("count")))
+                    .use(Math.min(chatgptUser.getLimitNum(), Optional.ofNullable(conversationCount.getLong("count")).orElse(0L)))
                     .packageId(chatgptUser.getPackageId())
                     .packagePrice(packagePrice)
                     .isRenewPackage(chatgptUser.getRenewOrderId() != null ? true : false)
@@ -576,8 +573,8 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
                     .renewOrderId(chatgptUser.getRenewOrderId())
                     .build();
             if (chatgptUser.getLimitNum() > 20) {
-                view.setO1PUse(Math.min(chatgptUser.getLimitNum() < 60 ? 5L : 15L, conversationCount.getLong("o1_p")));
-                view.setO1MiniUse(Math.min(chatgptUser.getLimitNum() < 60 ? 10L : 25L, conversationCount.getLong("o1_mini")));
+                view.setO1PUse(Math.min(chatgptUser.getLimitNum() < 60 ? 5L : 15L, Optional.ofNullable(conversationCount.getLong("o1_p")).orElse(0L)));
+                view.setO1MiniUse(Math.min(chatgptUser.getLimitNum() < 60 ? 10L : 25L, Optional.ofNullable(conversationCount.getLong("o1_mini")).orElse(0L)));
             }
             return view;
         } else {