Kaynağa Gözat

fix 第三方获取奈飞账号车队类型

zoujiajian 1 ay önce
ebeveyn
işleme
f7160bbc4c

+ 21 - 2
netflix-web/src/main/java/com/cyksj/web/controller/manage/account/CmsAccountController.java

@@ -5,6 +5,7 @@ import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.extra.servlet.ServletUtil;
 import com.alibaba.excel.EasyExcel;
@@ -147,9 +148,9 @@ public class CmsAccountController {
         }
         account = account.trim();
         Account netflixAccount = accountService.getOne(Wrappers.lambdaQuery(Account.class)
-                .eq(Account::getGoodsId, Constant.NETFLIX_GID)
+                .in(Account::getGoodsId, List.of(Constant.NETFLIX_GID, Constant.DISNEY_GID))
                 .eq(Account::getAccount, account)
-                .select(Account::getAccount, Account::getGptEmailPwd)
+                .select(Account::getAccount, Account::getGptEmailPwd, Account::getId, Account::getGoodsId)
                 .last("limit 1"));
         if (netflixAccount == null) {
             throw BusinessRuntimeException.getInstance("奈飞账号不存在");
@@ -164,6 +165,24 @@ public class CmsAccountController {
             if (sysEmail != null) gptEmailPwd = sysEmail.getPassword();
         }
         credential.put("password", gptEmailPwd);
+
+        if (ObjectUtil.equals(netflixAccount.getGoodsId(), Constant.NETFLIX_GID)) {
+            String type = "ohter";
+            GroupsTrips groupsTrips = groupsMapper.selectOne(Wrappers.lambdaQuery(GroupsTrips.class).eq(GroupsTrips::getAccountId, netflixAccount.getId()).last("limit 1"));
+            if (groupsTrips != null) {
+                Long skuId = groupsTrips.getSkuId();
+                GoodsDonSku goodsDonSku = goodsDonSkuMapper.selectById(skuId);
+                if (goodsDonSku != null && goodsDonSku.getMonths() == 1) {
+                    type = "month";
+                }
+            }
+            credential.put("type", type);
+        }
+        String goods = "Netflix";
+        if (ObjectUtil.equals(netflixAccount.getGoodsId(), Constant.DISNEY_GID)) {
+            goods = "Disney";
+        }
+        credential.put("goods", goods);
         return GatewayResponse.SUCCESS.newBuilder().toResult(credential);
     }