TASK:AiDA

This commit is contained in:
shahaibo
2024-12-19 13:31:01 +08:00
parent 3dc432131c
commit ec094d7471
4 changed files with 12 additions and 9 deletions

View File

@@ -73,7 +73,8 @@ public class SendEmailUtil {
/** /**
* 绑定邮箱模板id * 绑定邮箱模板id
*/ */
public static Long BIND_MAILBOX_TEMPLATE_ID = 45619L; // public static Long BIND_MAILBOX_TEMPLATE_ID = 45619L;
public static Long BIND_MAILBOX_TEMPLATE_ID = 132754L;
public static Long CHANGE_MAILBOX_TEMPLATE_ID = 128210L; public static Long CHANGE_MAILBOX_TEMPLATE_ID = 128210L;

View File

@@ -4,6 +4,7 @@ import com.ai.da.common.config.exception.BusinessException;
import com.ai.da.common.response.PageBaseResponse; import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.common.response.Response; import com.ai.da.common.response.Response;
import com.ai.da.mapper.primary.entity.Account; import com.ai.da.mapper.primary.entity.Account;
import com.ai.da.mapper.primary.entity.AccountExtend;
import com.ai.da.mapper.primary.entity.TrialOrder; import com.ai.da.mapper.primary.entity.TrialOrder;
import com.ai.da.model.dto.*; import com.ai.da.model.dto.*;
import com.ai.da.model.vo.AccountLoginVO; import com.ai.da.model.vo.AccountLoginVO;
@@ -313,13 +314,13 @@ public class AccountController {
@GetMapping("/bindGoogle") @GetMapping("/bindGoogle")
@ApiOperation(value = "绑定谷歌") @ApiOperation(value = "绑定谷歌")
public Response<Boolean> bindGoogle(@RequestParam("credential") String credential) { public Response<AccountExtend> bindGoogle(@RequestParam("credential") String credential) {
return Response.success(accountService.bindGoogle(credential)); return Response.success(accountService.bindGoogle(credential));
} }
@GetMapping("/bindWeChat") @GetMapping("/bindWeChat")
@ApiOperation(value = "绑定微信") @ApiOperation(value = "绑定微信")
public Response<Boolean> bindWeChat(@RequestParam("code") String code) { public Response<AccountExtend> bindWeChat(@RequestParam("code") String code) {
return Response.success(accountService.bindWeChat(code)); return Response.success(accountService.bindWeChat(code));
} }

View File

@@ -2,6 +2,7 @@ package com.ai.da.service;
import com.ai.da.common.response.PageBaseResponse; import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.mapper.primary.entity.Account; import com.ai.da.mapper.primary.entity.Account;
import com.ai.da.mapper.primary.entity.AccountExtend;
import com.ai.da.mapper.primary.entity.GoogleUser; import com.ai.da.mapper.primary.entity.GoogleUser;
import com.ai.da.mapper.primary.entity.TrialOrder; import com.ai.da.mapper.primary.entity.TrialOrder;
import com.ai.da.model.dto.*; import com.ai.da.model.dto.*;
@@ -210,9 +211,9 @@ public interface AccountService extends IService<Account> {
AccountLoginVO getAccountDetail(); AccountLoginVO getAccountDetail();
Boolean bindGoogle(String credential); AccountExtend bindGoogle(String credential);
Boolean bindWeChat(String code); AccountExtend bindWeChat(String code);
Boolean unbindWeChat(); Boolean unbindWeChat();

View File

@@ -2432,7 +2432,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
} }
@Override @Override
public Boolean bindGoogle(String credential) { public AccountExtend bindGoogle(String credential) {
try { try {
// 配置 Google ID Token 验证器 // 配置 Google ID Token 验证器
GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder( GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder(
@@ -2466,7 +2466,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
accountExtendInsert.setAccountId(authPrincipalVo.getId()); accountExtendInsert.setAccountId(authPrincipalVo.getId());
accountExtendMapper.insert(accountExtendInsert); accountExtendMapper.insert(accountExtendInsert);
return Boolean.TRUE; return accountExtendInsert;
} else { } else {
throw new IllegalArgumentException("Invalid ID token."); throw new IllegalArgumentException("Invalid ID token.");
} }
@@ -2478,7 +2478,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
} }
@Override @Override
public Boolean bindWeChat(String code) { public AccountExtend bindWeChat(String code) {
// 1. 获取 access_token 和 openid // 1. 获取 access_token 和 openid
JSONObject accessTokenResponse = getAccessTokenFromWeChat(code); JSONObject accessTokenResponse = getAccessTokenFromWeChat(code);
String accessToken = accessTokenResponse.getString("access_token"); String accessToken = accessTokenResponse.getString("access_token");
@@ -2508,7 +2508,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
accountExtendInsert.setAccountId(authPrincipalVo.getId()); accountExtendInsert.setAccountId(authPrincipalVo.getId());
accountExtendMapper.insert(accountExtendInsert); accountExtendMapper.insert(accountExtendInsert);
return Boolean.TRUE; return accountExtendInsert;
} }
@Override @Override