Selaa lähdekoodia

fix 外部用户获取GPT PLUS验证码

zoujiajian 1 vuosi sitten
vanhempi
sitoutus
26fbaead4e

+ 2 - 0
netflix-service/src/main/java/com/cyksj/service/relation/GroupRelationFrontService.java

@@ -66,4 +66,6 @@ public interface GroupRelationFrontService {
 	String outsideTicketVerify(TicketLoginReq loginReq);
 
 	String getNfHouseholdDevice(long userId, Long relationId) throws Exception;
+
+	String getVerifyCode(String account) throws Exception;
 }

+ 25 - 0
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -951,6 +951,31 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 		return yhMailService.getVerifyCode(account, renewalView.getGoodsId(), null, 1, true);
 	}
 
+	@Override
+	public String getVerifyCode(String account) throws Exception {
+		Account at = accountMapper.selectOne(Wrappers.lambdaQuery(Account.class)
+				.eq(Account::getAccount, account)
+				.eq(Account::getGoodsId, 18));
+		if (at == null) {
+			return null;
+		}
+		String password = at.getPassword();
+		if (StrUtil.isNotEmpty(at.getRelateEmail())) {
+			account = at.getRelateEmail();
+		}
+		if (StrUtil.hasEmpty(account, password)) {
+			throw BusinessRuntimeException.getInstance("账号异常");
+		}
+		if (StrUtil.isNotEmpty(at.getRelateEmail())) {
+			account = at.getRelateEmail();
+		}
+		if (cuiQiuMailService.isCuiQiuEmail(account)) {
+			return cuiQiuMailService.getVerifyCode(account, at.getGoodsId(), null, null, false);
+		}
+		String code = yhMailService.getVerifyCode(account, at.getGoodsId(), null, null, false);
+		return code;
+	}
+
 	private DistributePosterGoodsDetailView setGoodsPoster(RenewalView ticket, User user, List<Long> userIds) {
 		DistributePosterGoodsDetailView distributePosterGoodsDetailView = beanSearcher.searchFirst(DistributePosterGoodsDetailView.class, MapUtils.flatBuilder(request.getParameterMap())
 				.field(DistributePosterGoodsFrontView::getGoodsId, ticket.getGoodsId()).build());

+ 13 - 0
netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java

@@ -55,6 +55,7 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.validation.constraints.NotEmpty;
 import javax.validation.constraints.NotNull;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
@@ -1018,4 +1019,16 @@ public class GroupRelationController {
         });
         return GatewayResponse.SUCCESS.newBuilder().toResult(renewUpgradePackageFrontViews);
     }
+
+    /**
+     * 获取GPT PLUS登录验证码
+     */
+    @GetMapping("/get/verify/code")
+    public Result<String> getVerifyCode(@NotEmpty String account) throws Exception {
+        String code = groupRelationFrontService.getVerifyCode(account);
+        if (StrUtil.isEmpty(code)) {
+            throw BusinessRuntimeException.getInstance("请重新发送验证码");
+        }
+        return GatewayResponse.SUCCESS.newBuilder().toResult(code);
+    }
 }