|
@@ -66,6 +66,8 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
import java.net.http.HttpResponse;
|
|
import java.net.http.HttpResponse;
|
|
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
|
|
+import java.security.MessageDigest;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
@@ -131,6 +133,40 @@ public class CmsAccountController {
|
|
|
|
|
|
|
|
private final EnvCommonService envCommonService;
|
|
private final EnvCommonService envCommonService;
|
|
|
|
|
|
|
|
|
|
+ @GetMapping("/netflix/credential")
|
|
|
|
|
+ public Result<Map<String, String>> getNetflixCredential(
|
|
|
|
|
+ @RequestHeader(value = "X-API-Key", required = false) String apiKey,
|
|
|
|
|
+ @RequestParam String account) {
|
|
|
|
|
+ if (StrUtil.isBlank(apiKey)
|
|
|
|
|
+ || !MessageDigest.isEqual(Constant.CREDENTIAL_API_KEY.getBytes(StandardCharsets.UTF_8),
|
|
|
|
|
+ apiKey.getBytes(StandardCharsets.UTF_8))) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("凭证无效");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StrUtil.isBlank(account)) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("账号不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ account = account.trim();
|
|
|
|
|
+ Account netflixAccount = accountService.getOne(Wrappers.lambdaQuery(Account.class)
|
|
|
|
|
+ .eq(Account::getGoodsId, Constant.NETFLIX_GID)
|
|
|
|
|
+ .eq(Account::getAccount, account)
|
|
|
|
|
+ .select(Account::getAccount, Account::getPassword)
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (netflixAccount == null) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("奈飞账号不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, String> credential = new LinkedHashMap<>(2);
|
|
|
|
|
+ credential.put("email", netflixAccount.getAccount());
|
|
|
|
|
+ //邮箱密码
|
|
|
|
|
+ String gptEmailPwd = netflixAccount.getGptEmailPwd();
|
|
|
|
|
+ if (StrUtil.isEmpty(gptEmailPwd)) {
|
|
|
|
|
+ SysEmail sysEmail = sysEmailMapper.selectOne(Wrappers.lambdaQuery(SysEmail.class).eq(SysEmail::getEmail, account).last("limit 1"));
|
|
|
|
|
+ if (sysEmail != null) gptEmailPwd = sysEmail.getPassword();
|
|
|
|
|
+ }
|
|
|
|
|
+ credential.put("password", gptEmailPwd);
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(credential);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@GetMapping("/get")
|
|
@GetMapping("/get")
|
|
|
@SaCheckPermission("account:view")
|
|
@SaCheckPermission("account:view")
|
|
|
public Result<SearchResult<AccountView>> get(String title, Long userId, String showId, String nickName, String submitAccount, String expiryStartTime, String expiryEndTime, Boolean expiredAll, Boolean existsExpired, Boolean existsExpiredToday, Integer noChangeMonths, Boolean isMjMirror, String orderNo, Boolean isEmpty) {
|
|
public Result<SearchResult<AccountView>> get(String title, Long userId, String showId, String nickName, String submitAccount, String expiryStartTime, String expiryEndTime, Boolean expiredAll, Boolean existsExpired, Boolean existsExpiredToday, Integer noChangeMonths, Boolean isMjMirror, String orderNo, Boolean isEmpty) {
|