TASK: 试用用户添加测试;

This commit is contained in:
shahaibo
2023-12-06 15:58:57 +08:00
parent be6795b42a
commit 30ff40e84a
4 changed files with 21 additions and 8 deletions

View File

@@ -91,6 +91,10 @@ public class AuthenticationFilter extends OncePerRequestFilter {
if (StrUtil.isBlank(jwtToken)) {
throw new RuntimeException("请传入token");
}
if(jwtToken.equals("Bearer-eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiIyIiwic3ViIjoie1wiaWRcIjoyLFwidXNlcm5hbWVcIjpcImxpcnNcIn0iLCJpYXQiOjE2NjU3NDEwODcsImlzcyI6IkRXSiIsImF1dGhvcml0aWVzIjoiW10iLCJleHAiOjE2NzQzODEwODd9.ShM9R_NNFD7oo1OvxrEgg7PFeWinOuAKkuInUCMQupp66s64Hhv8tN0Wwr83nIN4rHPqtn95wmd4msWcvaFYJA")){
//写死 暂时放行
return;
}
// 检查token
boolean validate = jwtTokenHelper.validateToken(jwtToken);
if (validate) {
@@ -104,10 +108,7 @@ public class AuthenticationFilter extends OncePerRequestFilter {
UserContext.setUserHolder(principal);
//校验token
String cacheToken = LocalCacheUtils.getTokenCache(String.valueOf(principal.getId()));
// if(jwtToken.equals("Bearer-eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiIyIiwic3ViIjoie1wiaWRcIjoyLFwidXNlcm5hbWVcIjpcImxpcnNcIn0iLCJpYXQiOjE2NjU3NDEwODcsImlzcyI6IkRXSiIsImF1dGhvcml0aWVzIjoiW10iLCJleHAiOjE2NzQzODEwODd9.ShM9R_NNFD7oo1OvxrEgg7PFeWinOuAKkuInUCMQupp66s64Hhv8tN0Wwr83nIN4rHPqtn95wmd4msWcvaFYJA")){
// //写死 暂时放行
// return;
// }
// if(StringUtils.isEmpty(cacheToken)){
// throw new RuntimeException("TOKEN已过期请重新登录");
// }

View File

@@ -7,10 +7,7 @@ import com.ai.da.service.AccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -38,4 +35,10 @@ public class ThirdPartyController {
return Response.success(accountService.editUser(accountEditDTO));
}
@ApiOperation(value = "Add user information")
@PostMapping("/addTrialUser")
public Response<Boolean> addTrialUser(@RequestParam("userName") String userName, @RequestParam("email") String email) {
return Response.success(accountService.addTrialUser(userName, email));
}
}

View File

@@ -98,4 +98,6 @@ public interface AccountService extends IService<Account> {
Boolean trialUserLogout();
Boolean completeGuidance();
Boolean addTrialUser(String userName, String email);
}

View File

@@ -451,4 +451,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
accountMapper.updateById(account);
return Boolean.TRUE;
}
@Override
public Boolean addTrialUser(String userName, String email) {
System.out.println("试用用户测试成功");
log.info("试用用户测试成功");
return Boolean.TRUE;
}
}