Unverified Commit 2fd0baa9 authored by Zzm0809's avatar Zzm0809 Committed by GitHub

[Optimization] Optimize login detection (#3405)

parent 0f5acd0d
...@@ -77,6 +77,7 @@ public class WebExceptionHandler { ...@@ -77,6 +77,7 @@ public class WebExceptionHandler {
@ExceptionHandler @ExceptionHandler
@ResponseBody @ResponseBody
@ResponseStatus(HttpStatus.UNAUTHORIZED)
public Result<Void> notLoginException(NotLoginException notLoginException) { public Result<Void> notLoginException(NotLoginException notLoginException) {
ServletRequestAttributes servletRequestAttributes = ServletRequestAttributes servletRequestAttributes =
(ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
...@@ -91,7 +92,7 @@ public class WebExceptionHandler { ...@@ -91,7 +92,7 @@ public class WebExceptionHandler {
} }
/** /**
* 参数异常处理程序 设置状态码为 400 * Parameter exception handler sets status code to 400
* *
* @param e e * @param e e
* @return {@link Result}<{@link String}> * @return {@link Result}<{@link String}>
...@@ -101,11 +102,12 @@ public class WebExceptionHandler { ...@@ -101,11 +102,12 @@ public class WebExceptionHandler {
@ResponseBody @ResponseBody
public Result<String> paramExceptionHandler(MethodArgumentNotValidException e) { public Result<String> paramExceptionHandler(MethodArgumentNotValidException e) {
BindingResult exceptions = e.getBindingResult(); BindingResult exceptions = e.getBindingResult();
// 判断异常中是否有错误信息,如果存在就使用异常中的消息,否则使用默认消息 // Check if there is any error message in the exception. If there is, use the message in the exception.
// Otherwise, use the default message
if (exceptions.hasErrors()) { if (exceptions.hasErrors()) {
List<ObjectError> errors = exceptions.getAllErrors(); List<ObjectError> errors = exceptions.getAllErrors();
if (!errors.isEmpty()) { if (!errors.isEmpty()) {
// 这里列出了全部错误参数,按正常逻辑,只需要第一条错误即可 // All incorrect parameters are listed here. According to normal logic, only the first error is needed
FieldError fieldError = (FieldError) errors.get(0); FieldError fieldError = (FieldError) errors.get(0);
if (StringUtils.isNotBlank(fieldError.getDefaultMessage())) { if (StringUtils.isNotBlank(fieldError.getDefaultMessage())) {
return Result.paramsError( return Result.paramsError(
......
...@@ -47,6 +47,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -47,6 +47,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import cn.dev33.satoken.annotation.SaCheckLogin;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -62,6 +63,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -62,6 +63,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "OpenAPI & Task API Controller") @Api(tags = "OpenAPI & Task API Controller")
@RequestMapping("/openapi") @RequestMapping("/openapi")
@RequiredArgsConstructor @RequiredArgsConstructor
@SaCheckLogin
public class APIController { public class APIController {
private final TaskService taskService; private final TaskService taskService;
...@@ -70,7 +72,7 @@ public class APIController { ...@@ -70,7 +72,7 @@ public class APIController {
@GetMapping("/version") @GetMapping("/version")
@ApiOperation(value = "Query Service Version", notes = "Query Dinky Service Version Number") @ApiOperation(value = "Query Service Version", notes = "Query Dinky Service Version Number")
public Result<String> getVersionInfo() { public Result<String> getVersionInfo() {
return Result.succeed(DinkyVersion.getVersion(), "Get success"); return Result.succeed(DinkyVersion.getVersion(), Status.QUERY_SUCCESS);
} }
@PostMapping("/submitTask") @PostMapping("/submitTask")
...@@ -200,6 +202,6 @@ public class APIController { ...@@ -200,6 +202,6 @@ public class APIController {
dataTypeClass = Integer.class) dataTypeClass = Integer.class)
public Result getTaskLineage(@RequestParam Integer id) { public Result getTaskLineage(@RequestParam Integer id) {
taskService.initTenantByTaskId(id); taskService.initTenantByTaskId(id);
return Result.succeed(taskService.getTaskLineage(id), "获取成功"); return Result.succeed(taskService.getTaskLineage(id), Status.QUERY_SUCCESS);
} }
} }
...@@ -27,6 +27,7 @@ import org.dinky.data.model.rbac.Tenant; ...@@ -27,6 +27,7 @@ import org.dinky.data.model.rbac.Tenant;
import org.dinky.data.result.Result; import org.dinky.data.result.Result;
import org.dinky.service.UserService; import org.dinky.service.UserService;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -35,7 +36,9 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -35,7 +36,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaIgnore; import cn.dev33.satoken.annotation.SaIgnore;
import cn.dev33.satoken.exception.NotLoginException;
import cn.dev33.satoken.stp.SaTokenInfo; import cn.dev33.satoken.stp.SaTokenInfo;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -92,8 +95,13 @@ public class AdminController { ...@@ -92,8 +95,13 @@ public class AdminController {
*/ */
@GetMapping("/current") @GetMapping("/current")
@ApiOperation(value = "Current User Info", notes = "Current User Info") @ApiOperation(value = "Current User Info", notes = "Current User Info")
public Result<UserDTO> getCurrentUserInfo() { @SaCheckLogin
return userService.queryCurrentUserInfo(); public Result<UserDTO> getCurrentUserInfo(@CookieValue(name = "tenantId") Integer tenantId) {
if (tenantId == null) {
throw NotLoginException.newInstance(
"LOCAL", NotLoginException.NOT_TOKEN, NotLoginException.NOT_TOKEN_MESSAGE, null);
}
return userService.queryCurrentUserInfo(tenantId);
} }
/** /**
...@@ -105,6 +113,7 @@ public class AdminController { ...@@ -105,6 +113,7 @@ public class AdminController {
@PostMapping("/chooseTenant") @PostMapping("/chooseTenant")
@ApiImplicitParam(name = "tenantId", value = "tenantId", required = true, dataTypeClass = Integer.class) @ApiImplicitParam(name = "tenantId", value = "tenantId", required = true, dataTypeClass = Integer.class)
@ApiOperation(value = "Choose Tenant To Login", notes = "Choose Tenant To Login") @ApiOperation(value = "Choose Tenant To Login", notes = "Choose Tenant To Login")
@SaCheckLogin
public Result<Tenant> switchingTenant(@RequestParam("tenantId") Integer tenantId) { public Result<Tenant> switchingTenant(@RequestParam("tenantId") Integer tenantId) {
return userService.chooseTenant(tenantId); return userService.chooseTenant(tenantId);
} }
...@@ -116,12 +125,14 @@ public class AdminController { ...@@ -116,12 +125,14 @@ public class AdminController {
*/ */
@GetMapping("/tokenInfo") @GetMapping("/tokenInfo")
@ApiOperation(value = "Query Current User Token Info", notes = "Query Current User Token Info") @ApiOperation(value = "Query Current User Token Info", notes = "Query Current User Token Info")
@SaCheckLogin
public Result<SaTokenInfo> getTokenInfo() { public Result<SaTokenInfo> getTokenInfo() {
return Result.succeed(StpUtil.getTokenInfo()); return Result.succeed(StpUtil.getTokenInfo());
} }
@GetMapping("/version") @GetMapping("/version")
@ApiOperation(value = "Query Service Version", notes = "Query Dinky Service Version Number") @ApiOperation(value = "Query Service Version", notes = "Query Dinky Service Version Number")
@SaCheckLogin
public Result<Object> getVersionInfo() { public Result<Object> getVersionInfo() {
return Result.succeed((Object) DinkyVersion.getVersion()); return Result.succeed((Object) DinkyVersion.getVersion());
} }
......
...@@ -37,6 +37,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -37,6 +37,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -51,6 +52,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -51,6 +52,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "Alert Group Controller") @Api(tags = "Alert Group Controller")
@RequestMapping("/api/alertGroup") @RequestMapping("/api/alertGroup")
@RequiredArgsConstructor @RequiredArgsConstructor
@SaCheckLogin
public class AlertGroupController { public class AlertGroupController {
private final AlertGroupService alertGroupService; private final AlertGroupService alertGroupService;
......
...@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -50,6 +51,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -50,6 +51,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "Alert History Controller") @Api(tags = "Alert History Controller")
@RequestMapping("/api/alertHistory") @RequestMapping("/api/alertHistory")
@RequiredArgsConstructor @RequiredArgsConstructor
@SaCheckLogin
public class AlertHistoryController { public class AlertHistoryController {
private final AlertHistoryService alertHistoryService; private final AlertHistoryService alertHistoryService;
......
...@@ -44,6 +44,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -44,6 +44,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter; import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters; import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -60,6 +61,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -60,6 +61,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "Alert Instance Controller") @Api(tags = "Alert Instance Controller")
@RequestMapping("/api/alertInstance") @RequestMapping("/api/alertInstance")
@RequiredArgsConstructor @RequiredArgsConstructor
@SaCheckLogin
public class AlertInstanceController { public class AlertInstanceController {
private final AlertInstanceService alertInstanceService; private final AlertInstanceService alertInstanceService;
......
...@@ -42,6 +42,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -42,6 +42,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -53,6 +54,7 @@ import lombok.RequiredArgsConstructor; ...@@ -53,6 +54,7 @@ import lombok.RequiredArgsConstructor;
@RestController @RestController
@RequestMapping("/api/alertRule") @RequestMapping("/api/alertRule")
@Api(tags = "Alert Rule Controller") @Api(tags = "Alert Rule Controller")
@SaCheckLogin
public class AlertRuleController { public class AlertRuleController {
private final AlertRuleService alertRuleService; private final AlertRuleService alertRuleService;
......
...@@ -37,6 +37,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -37,6 +37,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -48,6 +49,7 @@ import lombok.RequiredArgsConstructor; ...@@ -48,6 +49,7 @@ import lombok.RequiredArgsConstructor;
@RestController @RestController
@RequestMapping("/api/alertTemplate") @RequestMapping("/api/alertTemplate")
@Api(tags = "Alert Template Controller") @Api(tags = "Alert Template Controller")
@SaCheckLogin
public class AlertTemplateController { public class AlertTemplateController {
private final AlertTemplateService alertTemplateService; private final AlertTemplateService alertTemplateService;
......
...@@ -41,6 +41,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -41,6 +41,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ZipUtil; import cn.hutool.core.util.ZipUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -60,6 +61,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -60,6 +61,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "Catalogue Controller") @Api(tags = "Catalogue Controller")
@RequestMapping("/api/catalogue") @RequestMapping("/api/catalogue")
@RequiredArgsConstructor @RequiredArgsConstructor
@SaCheckLogin
public class CatalogueController { public class CatalogueController {
private final CatalogueService catalogueService; private final CatalogueService catalogueService;
......
...@@ -40,6 +40,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -40,6 +40,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -58,6 +59,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -58,6 +59,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "Cluster Config Controller") @Api(tags = "Cluster Config Controller")
@RequestMapping("/api/clusterConfiguration") @RequestMapping("/api/clusterConfiguration")
@RequiredArgsConstructor @RequiredArgsConstructor
@SaCheckLogin
public class ClusterConfigurationController { public class ClusterConfigurationController {
private final ClusterConfigurationService clusterConfigurationService; private final ClusterConfigurationService clusterConfigurationService;
......
...@@ -42,6 +42,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -42,6 +42,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -56,6 +57,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -56,6 +57,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "ClusterInstance Instance Controller") @Api(tags = "ClusterInstance Instance Controller")
@RequestMapping("/api/cluster") @RequestMapping("/api/cluster")
@RequiredArgsConstructor @RequiredArgsConstructor
@SaCheckLogin
public class ClusterInstanceController { public class ClusterInstanceController {
private final ClusterInstanceService clusterInstanceService; private final ClusterInstanceService clusterInstanceService;
......
...@@ -49,6 +49,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -49,6 +49,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -68,6 +69,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -68,6 +69,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "DataSource Controller") @Api(tags = "DataSource Controller")
@RequestMapping("/api/database") @RequestMapping("/api/database")
@RequiredArgsConstructor @RequiredArgsConstructor
@SaCheckLogin
public class DataSourceController { public class DataSourceController {
private final DataBaseService databaseService; private final DataBaseService databaseService;
......
...@@ -41,6 +41,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -41,6 +41,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -55,6 +56,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -55,6 +56,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "Document Controller") @Api(tags = "Document Controller")
@RequestMapping("/api/document") @RequestMapping("/api/document")
@RequiredArgsConstructor @RequiredArgsConstructor
@SaCheckLogin
public class DocumentController { public class DocumentController {
private final DocumentService documentService; private final DocumentService documentService;
......
...@@ -32,6 +32,7 @@ import org.springframework.web.bind.annotation.GetMapping; ...@@ -32,6 +32,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
...@@ -41,6 +42,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -41,6 +42,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j @Slf4j
@Api(tags = "Flink Conf Controller", hidden = true) @Api(tags = "Flink Conf Controller", hidden = true)
@RequestMapping("/api/flinkConf") @RequestMapping("/api/flinkConf")
@SaCheckLogin
@RequiredArgsConstructor @RequiredArgsConstructor
public class FlinkController { public class FlinkController {
......
...@@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil; import cn.hutool.core.util.URLUtil;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
...@@ -42,6 +43,7 @@ import lombok.SneakyThrows; ...@@ -42,6 +43,7 @@ import lombok.SneakyThrows;
@Controller @Controller
@Api(tags = "Flink Proxy Controller", hidden = true, description = "Flink Proxy API") @Api(tags = "Flink Proxy Controller", hidden = true, description = "Flink Proxy API")
@RequestMapping(FlinkProxyController.API) @RequestMapping(FlinkProxyController.API)
@SaCheckLogin
public class FlinkProxyController { public class FlinkProxyController {
public static final String API = "/api/flink/"; public static final String API = "/api/flink/";
......
...@@ -39,6 +39,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -39,6 +39,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -53,6 +54,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -53,6 +54,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "Fragment Controller") @Api(tags = "Fragment Controller")
@RequestMapping("/api/fragment") @RequestMapping("/api/fragment")
@RequiredArgsConstructor @RequiredArgsConstructor
@SaCheckLogin
public class FragmentController { public class FragmentController {
private final FragmentVariableService fragmentVariableService; private final FragmentVariableService fragmentVariableService;
......
...@@ -53,6 +53,7 @@ import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; ...@@ -53,6 +53,7 @@ import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
...@@ -71,6 +72,7 @@ import lombok.AllArgsConstructor; ...@@ -71,6 +72,7 @@ import lombok.AllArgsConstructor;
@Api(tags = "Git Project Controller") @Api(tags = "Git Project Controller")
@RequestMapping("/api/git") @RequestMapping("/api/git")
@AllArgsConstructor @AllArgsConstructor
@SaCheckLogin
public class GitController { public class GitController {
final GitProjectService gitProjectService; final GitProjectService gitProjectService;
......
...@@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckLogin;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -49,6 +50,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -49,6 +50,7 @@ import lombok.extern.slf4j.Slf4j;
@RestController @RestController
@RequestMapping("/api/history") @RequestMapping("/api/history")
@RequiredArgsConstructor @RequiredArgsConstructor
@SaCheckLogin
public class HistoryController { public class HistoryController {
private final HistoryService historyService; private final HistoryService historyService;
......
...@@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.GetMapping; ...@@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
...@@ -43,6 +44,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -43,6 +44,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "Home Controller") @Api(tags = "Home Controller")
@RequestMapping("/api/home") @RequestMapping("/api/home")
@RequiredArgsConstructor @RequiredArgsConstructor
@SaCheckLogin
public class HomeController { public class HomeController {
private final HomeService homeService; private final HomeService homeService;
......
...@@ -36,6 +36,7 @@ import org.springframework.web.bind.annotation.PostMapping; ...@@ -36,6 +36,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -52,6 +53,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -52,6 +53,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "Jar Controller") @Api(tags = "Jar Controller")
@RequestMapping("/api/jar") @RequestMapping("/api/jar")
@RequiredArgsConstructor @RequiredArgsConstructor
@SaCheckLogin
public class JarController { public class JarController {
private final TaskService taskService; private final TaskService taskService;
......
...@@ -49,6 +49,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -49,6 +49,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaIgnore; import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.lang.Dict; import cn.hutool.core.lang.Dict;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -68,6 +69,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -68,6 +69,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "Job Instance Controller") @Api(tags = "Job Instance Controller")
@RequestMapping("/api/jobInstance") @RequestMapping("/api/jobInstance")
@RequiredArgsConstructor @RequiredArgsConstructor
@SaCheckLogin
public class JobInstanceController { public class JobInstanceController {
private final JobInstanceService jobInstanceService; private final JobInstanceService jobInstanceService;
......
...@@ -42,6 +42,7 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -42,6 +42,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaIgnore; import cn.dev33.satoken.annotation.SaIgnore;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -71,6 +72,7 @@ public class LdapController { ...@@ -71,6 +72,7 @@ public class LdapController {
@GetMapping("/testConnection") @GetMapping("/testConnection")
@ApiOperation("Test connection to LDAP server") @ApiOperation("Test connection to LDAP server")
@SaCheckLogin
@Log(title = "Test connection to LDAP server", businessType = BusinessType.TEST) @Log(title = "Test connection to LDAP server", businessType = BusinessType.TEST)
public Result<Integer> testConnection() { public Result<Integer> testConnection() {
List<User> users = ldapService.listUsers(); List<User> users = ldapService.listUsers();
...@@ -83,6 +85,7 @@ public class LdapController { ...@@ -83,6 +85,7 @@ public class LdapController {
@GetMapping("/listUser") @GetMapping("/listUser")
@ApiOperation("List user from LDAP server") @ApiOperation("List user from LDAP server")
@SaCheckLogin
public Result<List<User>> listUser() { public Result<List<User>> listUser() {
List<User> users = ldapService.listUsers(); List<User> users = ldapService.listUsers();
List<User> localUsers = userService.list(); List<User> localUsers = userService.list();
...@@ -98,6 +101,7 @@ public class LdapController { ...@@ -98,6 +101,7 @@ public class LdapController {
@PostMapping("/importUsers") @PostMapping("/importUsers")
@ApiOperation("Import users from LDAP server") @ApiOperation("Import users from LDAP server")
@SaCheckLogin
@Log(title = "Import users from LDAP server", businessType = BusinessType.IMPORT) @Log(title = "Import users from LDAP server", businessType = BusinessType.IMPORT)
@ApiImplicitParam(name = "users", value = "User list", required = true, dataType = "List<User>") @ApiImplicitParam(name = "users", value = "User list", required = true, dataType = "List<User>")
public Result<Void> importUsers(@RequestBody List<User> users) { public Result<Void> importUsers(@RequestBody List<User> users) {
...@@ -115,6 +119,7 @@ public class LdapController { ...@@ -115,6 +119,7 @@ public class LdapController {
* @return {@link Result}{@link UserDTO} obtain the user's UserDTO * @return {@link Result}{@link UserDTO} obtain the user's UserDTO
*/ */
@PostMapping("/testLogin") @PostMapping("/testLogin")
@SaCheckLogin
@ApiOperation("Test login to LDAP server") @ApiOperation("Test login to LDAP server")
@Log(title = "Test login to LDAP server", businessType = BusinessType.TEST) @Log(title = "Test login to LDAP server", businessType = BusinessType.TEST)
@ApiImplicitParam(name = "loginDTO", value = "Login information", required = true, dataType = "LoginDTO") @ApiImplicitParam(name = "loginDTO", value = "Login information", required = true, dataType = "LoginDTO")
......
...@@ -37,6 +37,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -37,6 +37,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckLogin;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
...@@ -48,6 +49,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -48,6 +49,7 @@ import lombok.extern.slf4j.Slf4j;
@RestController @RestController
@Api(tags = "Log Controller") @Api(tags = "Log Controller")
@RequestMapping("/api/log") @RequestMapping("/api/log")
@SaCheckLogin
@RequiredArgsConstructor @RequiredArgsConstructor
public class LogController { public class LogController {
......
...@@ -40,6 +40,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -40,6 +40,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -53,6 +54,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -53,6 +54,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "Menu Controller") @Api(tags = "Menu Controller")
@RequestMapping("/api/menu") @RequestMapping("/api/menu")
@RequiredArgsConstructor @RequiredArgsConstructor
@SaCheckLogin
public class MenuController { public class MenuController {
private final MenuService menuService; private final MenuService menuService;
......
...@@ -44,6 +44,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -44,6 +44,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Opt; import cn.hutool.core.lang.Opt;
...@@ -59,6 +60,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -59,6 +60,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "Monitor Controller") @Api(tags = "Monitor Controller")
@RequestMapping("/api/monitor") @RequestMapping("/api/monitor")
@RequiredArgsConstructor @RequiredArgsConstructor
@SaCheckLogin
public class MonitorController { public class MonitorController {
private final MonitorService monitorService; private final MonitorService monitorService;
......
...@@ -32,6 +32,7 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -32,6 +32,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -41,6 +42,7 @@ import lombok.AllArgsConstructor; ...@@ -41,6 +42,7 @@ import lombok.AllArgsConstructor;
@Api(tags = "Print Table Controller") @Api(tags = "Print Table Controller")
@AllArgsConstructor @AllArgsConstructor
@RequestMapping("/api/printTable") @RequestMapping("/api/printTable")
@SaCheckLogin
public class PrintTableController { public class PrintTableController {
private final PrintTableService printTableService; private final PrintTableService printTableService;
......
...@@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -44,6 +45,7 @@ import lombok.RequiredArgsConstructor; ...@@ -44,6 +45,7 @@ import lombok.RequiredArgsConstructor;
@RestController @RestController
@Api(tags = "Process Controller") @Api(tags = "Process Controller")
@RequestMapping("/api/process") @RequestMapping("/api/process")
@SaCheckLogin
@RequiredArgsConstructor @RequiredArgsConstructor
public class ProcessController { public class ProcessController {
......
...@@ -40,6 +40,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -40,6 +40,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -53,6 +54,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -53,6 +54,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "Resource Controller") @Api(tags = "Resource Controller")
@RequestMapping("/api/resource") @RequestMapping("/api/resource")
@RequiredArgsConstructor @RequiredArgsConstructor
@SaCheckLogin
public class ResourceController { public class ResourceController {
private final ResourcesService resourcesService; private final ResourcesService resourcesService;
......
...@@ -45,6 +45,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -45,6 +45,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import cn.hutool.core.lang.Dict; import cn.hutool.core.lang.Dict;
...@@ -58,6 +59,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -58,6 +59,7 @@ import lombok.extern.slf4j.Slf4j;
@RestController @RestController
@Api(tags = "Role Controller") @Api(tags = "Role Controller")
@RequestMapping("/api/role") @RequestMapping("/api/role")
@SaCheckLogin
@RequiredArgsConstructor @RequiredArgsConstructor
public class RoleController { public class RoleController {
......
...@@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -42,6 +43,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -42,6 +43,7 @@ import lombok.extern.slf4j.Slf4j;
@RestController @RestController
@Api(tags = "Role Menu Controller") @Api(tags = "Role Menu Controller")
@RequestMapping("/api/roleMenu") @RequestMapping("/api/roleMenu")
@SaCheckLogin
@RequiredArgsConstructor @RequiredArgsConstructor
public class RoleMenuController { public class RoleMenuController {
......
...@@ -39,6 +39,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -39,6 +39,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -50,6 +51,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -50,6 +51,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "RowPermissions Controller") @Api(tags = "RowPermissions Controller")
@RestController @RestController
@RequestMapping("/api/rowPermissions") @RequestMapping("/api/rowPermissions")
@SaCheckLogin
public class RowPermissionsController { public class RowPermissionsController {
@Autowired @Autowired
......
...@@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckLogin;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -50,6 +51,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -50,6 +51,7 @@ import lombok.extern.slf4j.Slf4j;
@RestController @RestController
@Api(tags = "SavePoints Controller") @Api(tags = "SavePoints Controller")
@RequestMapping("/api/savepoints") @RequestMapping("/api/savepoints")
@SaCheckLogin
@RequiredArgsConstructor @RequiredArgsConstructor
public class SavePointsController { public class SavePointsController {
......
...@@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -44,6 +45,7 @@ import lombok.RequiredArgsConstructor; ...@@ -44,6 +45,7 @@ import lombok.RequiredArgsConstructor;
@RestController @RestController
@RequestMapping("/api/scheduler") @RequestMapping("/api/scheduler")
@Api(tags = "DolphinScheduler Controller") @Api(tags = "DolphinScheduler Controller")
@SaCheckLogin
@RequiredArgsConstructor @RequiredArgsConstructor
public class SchedulerController { public class SchedulerController {
......
...@@ -46,6 +46,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -46,6 +46,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckLogin;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
...@@ -62,6 +63,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -62,6 +63,7 @@ import lombok.extern.slf4j.Slf4j;
@RestController @RestController
@Api(tags = "Data Studio Controller") @Api(tags = "Data Studio Controller")
@RequestMapping("/api/studio") @RequestMapping("/api/studio")
@SaCheckLogin
@RequiredArgsConstructor @RequiredArgsConstructor
public class StudioController { public class StudioController {
......
...@@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -41,6 +42,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -41,6 +42,7 @@ import lombok.extern.slf4j.Slf4j;
@RestController @RestController
@Api(tags = "Suggestion Controller") @Api(tags = "Suggestion Controller")
@RequestMapping("/api/suggestion") @RequestMapping("/api/suggestion")
@SaCheckLogin
@RequiredArgsConstructor @RequiredArgsConstructor
public class SuggestionController { public class SuggestionController {
......
...@@ -37,6 +37,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -37,6 +37,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaIgnore; import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.lang.Dict; import cn.hutool.core.lang.Dict;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
...@@ -54,6 +55,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -54,6 +55,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j @Slf4j
@RestController @RestController
@Api(tags = "System Config Controller") @Api(tags = "System Config Controller")
@SaCheckLogin
@RequestMapping("/api/sysConfig") @RequestMapping("/api/sysConfig")
@RequiredArgsConstructor @RequiredArgsConstructor
public class SysConfigController { public class SysConfigController {
......
...@@ -44,6 +44,7 @@ import lombok.RequiredArgsConstructor; ...@@ -44,6 +44,7 @@ import lombok.RequiredArgsConstructor;
@RestController @RestController
@Api(tags = "System Controller") @Api(tags = "System Controller")
@RequestMapping("/api/system") @RequestMapping("/api/system")
@SaCheckLogin
@RequiredArgsConstructor @RequiredArgsConstructor
public class SystemController { public class SystemController {
......
...@@ -55,6 +55,7 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -55,6 +55,7 @@ import org.springframework.web.multipart.MultipartFile;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.hutool.core.lang.tree.Tree; import cn.hutool.core.lang.tree.Tree;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -66,6 +67,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -66,6 +67,7 @@ import lombok.extern.slf4j.Slf4j;
@RestController @RestController
@Api(tags = "Task Controller") @Api(tags = "Task Controller")
@RequestMapping("/api/task") @RequestMapping("/api/task")
@SaCheckLogin
@RequiredArgsConstructor @RequiredArgsConstructor
public class TaskController { public class TaskController {
......
...@@ -36,6 +36,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -36,6 +36,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -52,6 +53,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -52,6 +53,7 @@ import lombok.extern.slf4j.Slf4j;
@RestController @RestController
@Api(tags = "Task Version Controller") @Api(tags = "Task Version Controller")
@RequestMapping("/api/task/version") @RequestMapping("/api/task/version")
@SaCheckLogin
@RequiredArgsConstructor @RequiredArgsConstructor
public class TaskVersionController { public class TaskVersionController {
......
...@@ -43,6 +43,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -43,6 +43,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import cn.hutool.core.lang.Dict; import cn.hutool.core.lang.Dict;
...@@ -57,6 +58,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -57,6 +58,7 @@ import lombok.extern.slf4j.Slf4j;
@RestController @RestController
@Api(tags = "Tenant Controller") @Api(tags = "Tenant Controller")
@RequestMapping("/api/tenant") @RequestMapping("/api/tenant")
@SaCheckLogin
@RequiredArgsConstructor @RequiredArgsConstructor
public class TenantController { public class TenantController {
......
...@@ -40,6 +40,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -40,6 +40,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import cn.dev33.satoken.stp.StpLogic; import cn.dev33.satoken.stp.StpLogic;
...@@ -56,6 +57,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -56,6 +57,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "Token Controller") @Api(tags = "Token Controller")
@RestController @RestController
@RequestMapping("/api/token") @RequestMapping("/api/token")
@SaCheckLogin
@RequiredArgsConstructor @RequiredArgsConstructor
public class TokenController { public class TokenController {
......
...@@ -29,6 +29,7 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -29,6 +29,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -37,6 +38,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -37,6 +38,7 @@ import lombok.extern.slf4j.Slf4j;
@RestController @RestController
@Api(tags = "Tools Controller") @Api(tags = "Tools Controller")
@RequestMapping("/api/tools") @RequestMapping("/api/tools")
@SaCheckLogin
@RequiredArgsConstructor @RequiredArgsConstructor
public class ToolsController { public class ToolsController {
@PostMapping("/jsonToFlinkSql") @PostMapping("/jsonToFlinkSql")
......
...@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.annotation.SaCheckLogin;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -45,6 +46,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -45,6 +46,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "UDF Controller") @Api(tags = "UDF Controller")
@RestController @RestController
@RequestMapping("/api/udf") @RequestMapping("/api/udf")
@SaCheckLogin
@RequiredArgsConstructor @RequiredArgsConstructor
public class UDFController { public class UDFController {
private final UDFService udfService; private final UDFService udfService;
......
...@@ -46,6 +46,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -46,6 +46,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
...@@ -62,6 +63,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -62,6 +63,7 @@ import lombok.extern.slf4j.Slf4j;
@Api(tags = "UDF Controller") @Api(tags = "UDF Controller")
@RestController @RestController
@RequestMapping("/api/udf/template") @RequestMapping("/api/udf/template")
@SaCheckLogin
@RequiredArgsConstructor @RequiredArgsConstructor
public class UDFTemplateController { public class UDFTemplateController {
......
...@@ -45,6 +45,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -45,6 +45,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import cn.hutool.core.lang.Dict; import cn.hutool.core.lang.Dict;
...@@ -64,6 +65,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -64,6 +65,7 @@ import lombok.extern.slf4j.Slf4j;
@RestController @RestController
@Api(tags = "User Controller") @Api(tags = "User Controller")
@RequestMapping("/api/user") @RequestMapping("/api/user")
@SaCheckLogin
@RequiredArgsConstructor @RequiredArgsConstructor
public class UserController { public class UserController {
......
...@@ -109,7 +109,7 @@ public interface UserService extends ISuperService<User> { ...@@ -109,7 +109,7 @@ public interface UserService extends ISuperService<User> {
* *
* @return {@link Result}{@link UserDTO} obtain the current user's UserDTO * @return {@link Result}{@link UserDTO} obtain the current user's UserDTO
*/ */
Result<UserDTO> queryCurrentUserInfo(); Result<UserDTO> queryCurrentUserInfo(Integer tenantId);
/** /**
* user enable or disable * user enable or disable
......
...@@ -363,13 +363,18 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen ...@@ -363,13 +363,18 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
} }
@Override @Override
public Result<UserDTO> queryCurrentUserInfo() { public Result<UserDTO> queryCurrentUserInfo(Integer tenantId) {
UserDTO userInfo = UserInfoContextHolder.get(StpUtil.getLoginIdAsInt()); UserDTO userInfo = UserInfoContextHolder.get(StpUtil.getLoginIdAsInt());
chooseTenant(tenantId);
if (Asserts.isNotNull(userInfo)) { if (Asserts.isNotNull(userInfo)) {
UserDTO userInfoDto = buildUserInfo(userInfo.getUser().getId()); UserDTO userInfoDto = buildUserInfo(userInfo.getUser().getId());
if (userInfoDto != null) { if (userInfoDto != null) {
userInfoDto.setCurrentTenant(userInfo.getCurrentTenant()); Tenant currentTenant = userInfo.getCurrentTenant();
if (Asserts.isNull(currentTenant)) {
currentTenant = tenantService.getById(tenantId);
}
userInfoDto.setCurrentTenant(currentTenant);
} }
UserInfoContextHolder.refresh(StpUtil.getLoginIdAsInt(), userInfoDto); UserInfoContextHolder.refresh(StpUtil.getLoginIdAsInt(), userInfoDto);
return Result.succeed(userInfoDto); return Result.succeed(userInfoDto);
......
...@@ -299,6 +299,8 @@ export default { ...@@ -299,6 +299,8 @@ export default {
'login.result': '{msg}\t\t{time}', 'login.result': '{msg}\t\t{time}',
'login.username.placeholder': 'Username', 'login.username.placeholder': 'Username',
'login.username.required': 'Please input your username!', 'login.username.required': 'Please input your username!',
'login.token.error':
'Unable to get token information/session has expired, will jump to the login page, please re-login...',
/** /**
* *
* menu * menu
......
...@@ -287,6 +287,7 @@ export default { ...@@ -287,6 +287,7 @@ export default {
'login.result': '{msg}\t\t{time}', 'login.result': '{msg}\t\t{time}',
'login.username.placeholder': '用户名', 'login.username.placeholder': '用户名',
'login.username.required': '用户名是必填项!', 'login.username.required': '用户名是必填项!',
'login.token.error': '无法获取token信息/会话已过期,即将跳转到登录页,请重新登录...',
/** /**
* *
* menu * menu
......
...@@ -23,9 +23,11 @@ import { ...@@ -23,9 +23,11 @@ import {
setKeyToLocalStorage, setKeyToLocalStorage,
setLocalThemeToStorage setLocalThemeToStorage
} from '@/utils/function'; } from '@/utils/function';
import { l } from '@/utils/intl';
import { WarningMessageAsync } from '@/utils/messages';
import { history } from '@@/core/history'; import { history } from '@@/core/history';
/** 此方法会跳转到 redirect 参数所在的位置 */ /** This method will redirect to the location of the redirect parameter */
export const gotoRedirectUrl = () => { export const gotoRedirectUrl = () => {
if (!history) return; if (!history) return;
setTimeout(() => { setTimeout(() => {
...@@ -34,15 +36,16 @@ export const gotoRedirectUrl = () => { ...@@ -34,15 +36,16 @@ export const gotoRedirectUrl = () => {
}, 10); }, 10);
}; };
export const redirectToLogin = () => { export const redirectToLogin = async () => {
//TODO: 弹出确认框 //todo: 使用模态框提示, 但是目前会重复弹出,原因是接口每次都会调用,所以会出现重复弹出
await WarningMessageAsync(l('login.token.error'));
window.location.href = '/#/user/login'; window.location.href = '/#/user/login';
}; };
export const initSomeThing = () => { export const initSomeThing = () => {
// 初始化设置主题 // initialize setting theme
setLocalThemeToStorage(); setLocalThemeToStorage();
// 取出本地存储是否有启用消息提示的 key , 没有的话设置一下 // Retrieve the key for enabling message prompts from the local storage, and if not, set it accordingly
if (hasKeyofLocalStorage(ENABLE_MODEL_TIP)) { if (hasKeyofLocalStorage(ENABLE_MODEL_TIP)) {
setKeyToLocalStorage(ENABLE_MODEL_TIP, 'false'); setKeyToLocalStorage(ENABLE_MODEL_TIP, 'false');
} }
......
...@@ -137,7 +137,6 @@ const Login: React.FC = () => { ...@@ -137,7 +137,6 @@ const Login: React.FC = () => {
if (result.code === 0) { if (result.code === 0) {
// if login success then get token info and set it to local storage // if login success then get token info and set it to local storage
await queryDataByParams<SaTokenInfo>(API_CONSTANTS.TOKEN_INFO).then((res) => { await queryDataByParams<SaTokenInfo>(API_CONSTANTS.TOKEN_INFO).then((res) => {
console.log(res);
if (res) { if (res) {
setLocalStorageOfToken(JSON.stringify(res)); setLocalStorageOfToken(JSON.stringify(res));
} else { } else {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* *
*/ */
import Pop from '@/components/Animation/Pop'; import FadeIn from '@/components/Animation/FadeIn';
import { LogSvg } from '@/components/Icons/CodeLanguageIcon'; import { LogSvg } from '@/components/Icons/CodeLanguageIcon';
import { loginOut } from '@/components/RightContent/AvatarDropdown'; import { loginOut } from '@/components/RightContent/AvatarDropdown';
import PasswordForm from '@/pages/AuthCenter/User/components/PasswordModal/PasswordForm'; import PasswordForm from '@/pages/AuthCenter/User/components/PasswordModal/PasswordForm';
...@@ -169,7 +169,7 @@ const PersonCenter = () => { ...@@ -169,7 +169,7 @@ const PersonCenter = () => {
* render * render
*/ */
return ( return (
<Pop> <FadeIn>
<PageContainer title={false}> <PageContainer title={false}>
<ProCard ghost gutter={[16, 16]} hoverable loading={!loading && currentUser}> <ProCard ghost gutter={[16, 16]} hoverable loading={!loading && currentUser}>
<ProCard <ProCard
...@@ -208,7 +208,7 @@ const PersonCenter = () => { ...@@ -208,7 +208,7 @@ const PersonCenter = () => {
/> />
</ProCard> </ProCard>
</PageContainer> </PageContainer>
</Pop> </FadeIn>
); );
}; };
......
...@@ -17,16 +17,15 @@ ...@@ -17,16 +17,15 @@
* *
*/ */
import { redirectToLogin } from '@/pages/Other/Login/function';
import { ENABLE_MODEL_TIP } from '@/services/constants'; import { ENABLE_MODEL_TIP } from '@/services/constants';
import { API_CONSTANTS } from '@/services/endpoints';
import { getValueFromLocalStorage } from '@/utils/function'; import { getValueFromLocalStorage } from '@/utils/function';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { ErrorNotification, WarningNotification } from '@/utils/messages'; import { ErrorNotification, WarningNotification } from '@/utils/messages';
import { history } from '@@/core/history';
import type { RequestOptions } from '@@/plugin-request/request'; import type { RequestOptions } from '@@/plugin-request/request';
import type { RequestConfig } from '@umijs/max'; import type { RequestConfig } from '@umijs/max';
// 错误处理方案: 错误类型 // Error handling scheme: Error type
enum ErrorCode { enum ErrorCode {
SUCCESS = 0, SUCCESS = 0,
ERROR = 1, ERROR = 1,
...@@ -35,7 +34,7 @@ enum ErrorCode { ...@@ -35,7 +34,7 @@ enum ErrorCode {
AUTHORIZE_ERROR = 7 AUTHORIZE_ERROR = 7
} }
// 与后端约定的响应数据格式 // Response data format agreed upon with the backend
interface ResponseStructure { interface ResponseStructure {
success: boolean; success: boolean;
data?: any; data?: any;
...@@ -74,61 +73,61 @@ const handleBizError = (result: ResponseStructure) => { ...@@ -74,61 +73,61 @@ const handleBizError = (result: ResponseStructure) => {
* @doc https://umijs.org/docs/max/request#配置 * @doc https://umijs.org/docs/max/request#配置
*/ */
export const errorConfig: RequestConfig = { export const errorConfig: RequestConfig = {
// 错误处理: umi@3 的错误处理方案。 // Error handling: umi@3 Error handling plan for.
errorConfig: { errorConfig: {
// 错误抛出 // Error thrown
errorThrower: (res: ResponseStructure) => { errorThrower: (res: ResponseStructure) => {
const { success, data, msg, code } = res as ResponseStructure; const { success, data, msg, code } = res as ResponseStructure;
if (!success) { if (!success) {
const error: any = new Error(msg); const error: any = new Error(msg);
error.name = 'BizError'; error.name = 'BizError';
error.info = { msg, code, data }; error.info = { msg, code, data };
throw error; // 抛出自制的错误 throw error; // Throwing self-made errors
} }
}, },
// 错误接收及处理 // Error reception and handling
errorHandler: (error: any, opts: any) => { errorHandler: (error: any, opts: any) => {
if (opts?.skipErrorHandler) throw error; if (opts?.skipErrorHandler) throw error;
// 我们的 errorThrower 抛出的错误。 //The error thrown by our errorThrower.
if (error.name === 'BizError') { if (error.name === 'BizError') {
const errorInfo: ResponseStructure = error.info; const errorInfo: ResponseStructure = error.info;
if (errorInfo) { if (errorInfo) {
handleBizError(errorInfo); handleBizError(errorInfo);
} }
} else if (error.response) { } else if (error.response) {
// 请求成功发出且服务器也响应了状态码,但状态代码超出了 2xx 的范围 //The request was successfully sent and the server also responded with a status code, but the status code exceeded the range of 2xx
//认证错误,跳转登录页面 //Authentication error, redirect to login page
if (error.response.status === 401) { if (error.response.status === 401) {
history.push(API_CONSTANTS.LOGIN_PATH); redirectToLogin();
} else { } else {
if (getValueFromLocalStorage(ENABLE_MODEL_TIP) == 'true') { if (getValueFromLocalStorage(ENABLE_MODEL_TIP) == 'true') {
ErrorNotification(error.message, error.code); ErrorNotification(error.message, error.code);
} }
} }
} else if (error.request) { } else if (error.request) {
// 请求已经成功发起,但没有收到响应 //The request has been successfully initiated, but no response has been received
ErrorNotification(error.toString(), l('app.response.noresponse')); ErrorNotification(error.toString(), l('app.response.noresponse'));
} else { } else {
// 发送请求时出了点问题 // There was a problem sending the request
ErrorNotification(error.toString(), l('app.request.failed')); ErrorNotification(error.toString(), l('app.request.failed'));
} }
} }
}, },
// 请求拦截器 // request interceptor
requestInterceptors: [ requestInterceptors: [
(config: RequestOptions) => { (config: RequestOptions) => {
// 拦截请求配置,进行个性化处理。 // Intercept request configuration for personalized processing.
const url = config?.url; const url = config?.url;
return { ...config, url }; return { ...config, url };
} }
], ],
// 响应拦截器 // Response interceptor
responseInterceptors: [ responseInterceptors: [
(response) => { (response) => {
// 拦截响应数据,进行个性化处理 //Intercept response data for personalized processing
// 不再需要异步处理读取返回体内容,可直接在data中读出,部分字段可在 config 中找到 //No longer requires asynchronous processing to read the content of the return body, it can be directly read from data, and some fields can be found in config
const { data = {} as any, config } = response; const { data = {} as any, config } = response;
return response; return response;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment