zwhui 2 lat temu
rodzic
commit
f5b9fc6e9b

+ 1 - 1
midjourney/src/main/java/com/yhlxj/service/midjourney/impl/MidJourneyAccountServiceImpl.java

@@ -300,7 +300,7 @@ public class MidJourneyAccountServiceImpl extends ServiceImpl<MidjourneyAccountM
     @Transactional
     @Override
     public void syncAccountByMJPlus() throws Exception {
-        String body = HttpRequest.post(HOST + "/mj/account/query").body(Jsons.toJson(MapUtil.of("pageSize", 100))).execute().body();
+        String body = HttpRequest.post(HOST + "/mj/account/query").header("mj-api-secret", "5a9a3e9b-5a5e-4b6b-9a5a-9a5a5a5a5a5a").body(Jsons.toJson(MapUtil.of("pageSize", 100))).execute().body();
         log.info("getAllAccount body:{}", body);
         JSONObject jsonObject = JSONUtil.parseObj(body);
         List<MidjourneyProxyAccountInfo> content = JSONUtil.parseArray(jsonObject.getStr("content")).toList(MidjourneyProxyAccountInfo.class);

+ 11 - 2
midjourney/src/main/java/com/yhlxj/service/midjourney/impl/MidjourneyServiceImpl.java

@@ -78,7 +78,7 @@ public class MidjourneyServiceImpl implements MidjourneyService {
 
     private final MidjourneyUserConversationMapper conversationMapper;
 
-    private static final List<String> progress = List.of("35%","65","100%");
+    private static final List<String> progress = List.of("35%","65%","100%");
 
     private static final List<String> status = List.of("MODAL","CANCEL","FAILURE");
 
@@ -694,7 +694,16 @@ public class MidjourneyServiceImpl implements MidjourneyService {
                     throw new RuntimeException(e);
                 }
             }else {
-                list.add((MidjourneyUserConversation) redisService.get(RedisService.key.MIDJOURNEY_CONVERSATION.getName() + id));
+                Object obj = redisService.get(RedisService.key.MIDJOURNEY_CONVERSATION.getName() + id);
+                MidjourneyUserConversation conversation;
+                try {
+                    conversation = (MidjourneyUserConversation)obj;
+                }catch (Exception e){
+                    String jsonStr = JSONUtil.toJsonStr(obj);
+                    conversation = JSONUtil.parseObj(jsonStr).toBean(MidjourneyUserConversation.class);
+                    redisService.set(RedisService.key.MIDJOURNEY_CONVERSATION.getName() + id, conversation, RedisService.key.MIDJOURNEY_CONVERSATION.getTimeout());
+                }
+                list.add(conversation);
             }
         });
         return list;