Browse Source

fix mj用户信息增加小店id

zwhui 1 year ago
parent
commit
6da9e42c59

+ 6 - 0
midjourney/src/main/java/com/yhlxj/dao/mapper/midjourney/MidjourneyUserMapper.java

@@ -3,6 +3,7 @@ package com.yhlxj.dao.mapper.midjourney;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.yhlxj.dao.model.entity.MidjourneyUser;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
 
 /**
@@ -22,4 +23,9 @@ public interface MidjourneyUserMapper extends BaseMapper<MidjourneyUser> {
 
     @Update("update midjourney_user set mj_relax_num = mj_relax_num - #{num} where id = #{id} and mj_relax_num = #{relaxNum} and mj_relax_num > 0")
     int decRelaxNum(@Param("id") Long id, @Param("num") Integer num, @Param("relaxNum") Integer relaxNum);
+
+    @Select("select ums.custom_id from midjourney_user mu left join order_don o on mu.relation_id = o.relation_id " +
+            "left join user_mirror_shop_order_relate umsor on o.id = umsor.order_id left join user_mirror_shop ums on umsor.mp_id = ums.id " +
+            "where umsor.id is not null and  o.`status` = 'complete' and mu.id = #{userId} order by o.id desc limit 1")
+    String getUserCustomId(Long userId);
 }

+ 5 - 0
midjourney/src/main/java/com/yhlxj/dao/model/entity/MidjourneyUser.java

@@ -66,4 +66,9 @@ public class MidjourneyUser extends BaseEntity {
     @TableField(exist = false)
     @DbIgnore
     private MidjourneyUserSettings settings;
+
+
+    @TableField(exist = false)
+    @DbIgnore
+    private String customId;
 }

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

@@ -978,9 +978,7 @@ public class MidjourneyServiceImpl implements MidjourneyService {
         if (StringUtil.isNotBlank(conversation.getImageUrl())) {
             log.info("获取到的图片 url:{}", conversation.getImageUrl());
             String imgUrl = conversation.getImageUrl();
-            if(imgUrl.contains("webp")){
-                imgUrl = imgUrl.replace("cdn.discordapp.com","cdn.mj.liuliangbang.vip");
-            }
+            imgUrl = imgUrl.replace("cdn.discordapp.com","cdn.mj.liuliangbang.vip");
             conversation.setImageUrl(imgUrl);
         }
 

+ 1 - 0
midjourney/src/main/java/com/yhlxj/web/mirror/MidjourneyController.java

@@ -190,6 +190,7 @@ public class MidjourneyController {
     @GetMapping("/whoami")
     public Result<MidjourneyUser> queryUser() throws Exception {
         MidjourneyUser user = getUser();
+        user.setCustomId(midjourneyUserMapper.getUserCustomId(user.getId()));
         return GatewayResponse.SUCCESS.newBuilder().toResult(user);
     }
 

File diff suppressed because it is too large
+ 0 - 0
midjourney/src/main/resources/application-dev.yml


Some files were not shown because too many files changed in this diff