|
|
@@ -1,16 +1,18 @@
|
|
|
package com.sckw.auth.controller;
|
|
|
|
|
|
+import com.sckw.system.api.model.dto.req.LoginReqDto;
|
|
|
+import com.sckw.auth.service.IIndexService;
|
|
|
+import com.sckw.core.web.response.HttpResult;
|
|
|
import com.sckw.system.api.RemoteUserService;
|
|
|
import com.sckw.system.api.feign.RemoteUserFService;
|
|
|
+import com.sckw.system.api.model.dto.req.RegisterReqDto;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
//@Slf4j
|
|
|
@RestController
|
|
|
-@RequestMapping("/")
|
|
|
+@RequestMapping("/auth")
|
|
|
public class IndexController {
|
|
|
@Autowired
|
|
|
private RemoteUserFService remoteUserFService;
|
|
|
@@ -18,6 +20,9 @@ public class IndexController {
|
|
|
@DubboReference(version = "2.0.0", group = "design", check = false)
|
|
|
private RemoteUserService remoteUserService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IIndexService indexService;
|
|
|
+
|
|
|
@GetMapping("index")
|
|
|
public String index() {
|
|
|
//auth 服务 调用 system服务提供的feign接口
|
|
|
@@ -29,4 +34,23 @@ public class IndexController {
|
|
|
//auth 服务 调用example实现的dubbo接口
|
|
|
return remoteUserService.getUserInfoV1(account);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 登录
|
|
|
+ */
|
|
|
+ @PostMapping("/login")
|
|
|
+ public HttpResult login(@RequestBody LoginReqDto reqDto) {
|
|
|
+ return HttpResult.ok(indexService.login(reqDto));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 注册
|
|
|
+ */
|
|
|
+ @PostMapping("/register")
|
|
|
+ public HttpResult register(@RequestBody RegisterReqDto reqDto) {
|
|
|
+ indexService.register(reqDto);
|
|
|
+ return HttpResult.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|