PC hace 2 años
padre
commit
318a1ae227

+ 28 - 4
sckw-auth/src/main/java/com/sckw/auth/controller/IndexController.java

@@ -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();
+    }
+
+
 }

+ 0 - 2
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/SysDictService.java

@@ -1,7 +1,6 @@
 package com.sckw.system.service;
 
 import com.sckw.core.model.constant.Global;
-import com.sckw.core.utils.IdWorker;
 import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.system.dao.SysDictDao;
@@ -10,7 +9,6 @@ import com.sckw.system.model.SysDict;
 import com.sckw.system.model.SysDictType;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import java.util.Date;
 import java.util.List;
 import java.util.Map;