|
@@ -6,17 +6,23 @@
|
|
|
package org.eco.vip.auth.controller.auth;
|
|
|
|
|
|
|
|
|
+import jakarta.annotation.Resource;
|
|
|
import jakarta.annotation.security.PermitAll;
|
|
|
import jakarta.validation.Valid;
|
|
|
import org.eco.vip.auth.domain.auth.vo.AuthParam;
|
|
|
-import org.eco.vip.orm.exception.BusinessException;
|
|
|
+import org.eco.vip.auth.domain.auth.vo.AuthResponse;
|
|
|
+import org.eco.vip.auth.service.auth.IAdminAuthService;
|
|
|
import org.eco.vip.orm.pojo.CommonResult;
|
|
|
+import org.eco.vip.orm.utils.JsonUtil;
|
|
|
+import org.eco.vip.orm.utils.ValidatorUtils;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
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 java.io.IOException;
|
|
|
+
|
|
|
import static org.eco.vip.orm.pojo.CommonResult.success;
|
|
|
|
|
|
/**
|
|
@@ -30,9 +36,15 @@ import static org.eco.vip.orm.pojo.CommonResult.success;
|
|
|
@Validated
|
|
|
public class AuthController {
|
|
|
|
|
|
+ @Resource
|
|
|
+ private IAdminAuthService adminAuthService;
|
|
|
+
|
|
|
@PostMapping("/login")
|
|
|
@PermitAll
|
|
|
- public CommonResult<String> login(@RequestBody @Valid AuthParam authParam) {
|
|
|
- return success("登录成功");
|
|
|
+ public CommonResult<AuthResponse> login(@RequestBody String body) {
|
|
|
+ AuthParam authParamBody = JsonUtil.parseObject(body, AuthParam.class);
|
|
|
+ // 校验参数
|
|
|
+ ValidatorUtils.validate(authParamBody);
|
|
|
+ return success(adminAuthService.login(authParamBody));
|
|
|
}
|
|
|
}
|