zoujiajian 1 年之前
父节点
当前提交
456ae13f9e

+ 6 - 5
netflix-web/src/main/java/com/cyksj/web/controller/mirror/MidjourneyController.java

@@ -19,7 +19,6 @@ import com.cyksj.web.util.StpUserUtil;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.SearchResult;
 import com.ejlchina.searcher.param.Operator;
-import com.ejlchina.searcher.util.MapBuilder;
 import com.ejlchina.searcher.util.MapUtils;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -68,10 +67,12 @@ public class MidjourneyController {
     @GetMapping("/mj/cars")
     public Result<SearchResult<MidjouneyCarInfoView>> getCarInfoList(Long relationId) {
         long userId = StpUserUtil.getLoginIdAsLong();
-        //查看用户是否存在车票
-        MidjourneyUser midjourneyUser = midjourneyService.getUser(userId, relationId);
-        if (midjourneyUser == null) {
-            throw BusinessRuntimeException.getInstance("您还未购买车票");
+        if (relationId != null) {
+            //查看用户是否存在车票
+            MidjourneyUser midjourneyUser = midjourneyService.getUser(userId, relationId);
+            if (midjourneyUser == null) {
+                throw BusinessRuntimeException.getInstance("您还未购买车票");
+            }
         }
         SearchResult<MidjouneyCarInfoView> carInfoList = beanSearcher.search(MidjouneyCarInfoView.class,MapUtils.flatBuilder(request.getParameterMap()).build());
         return GatewayResponse.SUCCESS.newBuilder().toResult(carInfoList);

+ 15 - 11
netflix-web/src/main/java/com/cyksj/web/controller/mirror/MirrorController.java

@@ -39,8 +39,6 @@ import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
 import java.time.LocalDateTime;
 import java.util.Date;
 import java.util.List;
@@ -159,12 +157,16 @@ public class MirrorController {
     @GetMapping("/gpt/cars")
     public Result<SearchResult<ChatgptCarInfoView>> getCarInfoList(Long relationId,@RequestParam(defaultValue = "20") Integer limit) {
         long userId = StpUserUtil.getLoginIdAsLong();
-        //查看用户是否存在车票
-        ChatgptUser carChatGptUser = chatGptAccountService.getCarChatGptUser(userId, relationId);
-        if (carChatGptUser == null) {
-            throw BusinessRuntimeException.getInstance("您还未购买车票");
+        String userToken = null;
+        if (relationId != null) {
+            //查看用户是否存在车票
+            ChatgptUser carChatGptUser = chatGptAccountService.getCarChatGptUser(userId, relationId);
+            if (carChatGptUser == null) {
+                throw BusinessRuntimeException.getInstance("您还未购买车票");
+            }
+            userToken = carChatGptUser.getUserToken();
         }
-        SearchResult<ChatgptCarInfoView> carInfoList = chatGptAccountService.getCarInfoPage(carChatGptUser.getUserToken(),limit);
+        SearchResult<ChatgptCarInfoView> carInfoList = chatGptAccountService.getCarInfoPage(userToken,limit);
         return GatewayResponse.SUCCESS.newBuilder().toResult(carInfoList);
     }
 
@@ -442,10 +444,12 @@ public class MirrorController {
     @GetMapping("/claude/cars")
     public Result<SearchResult<ClaudeCarInfoView>> claudeCarInfoList(Long relationId) {
         long userId = StpUserUtil.getLoginIdAsLong();
-        //查看用户是否存在车票
-        ClaudeUser claudeUser = claudeService.getClaudeUser(userId, relationId);
-        if (claudeUser == null) {
-            throw BusinessRuntimeException.getInstance("您还未购买车票");
+        if (relationId != null) {
+            //查看用户是否存在车票
+            ClaudeUser claudeUser = claudeService.getClaudeUser(userId, relationId);
+            if (claudeUser == null) {
+                throw BusinessRuntimeException.getInstance("您还未购买车票");
+            }
         }
         SearchResult<ClaudeCarInfoView> carInfoList = beanSearcher.search(ClaudeCarInfoView.class, MapUtils.flatBuilder(request.getParameterMap()).field(ClaudeCarInfoView::getCsStatus, true).orderBy(ClaudeCarInfoView::getSort).desc().orderBy(ClaudeCarInfoView::getScore).asc().build());
         carInfoList.getDataList().forEach((claudeCarInfoView)->{