IndexController.java 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package com.sckw.auth.controller;
  2. import com.sckw.system.api.model.dto.req.LoginReqDto;
  3. import com.sckw.auth.service.IIndexService;
  4. import com.sckw.core.web.response.HttpResult;
  5. import com.sckw.system.api.RemoteUserService;
  6. import com.sckw.system.api.feign.RemoteUserFService;
  7. import com.sckw.system.api.model.dto.req.RegisterReqDto;
  8. import org.apache.dubbo.config.annotation.DubboReference;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.web.bind.annotation.*;
  11. //@Slf4j
  12. @RestController
  13. @RequestMapping("/auth")
  14. public class IndexController {
  15. @Autowired
  16. private RemoteUserFService remoteUserFService;
  17. @DubboReference(version = "2.0.0", group = "design", check = false)
  18. private RemoteUserService remoteUserService;
  19. @Autowired
  20. private IIndexService indexService;
  21. @GetMapping("index")
  22. public String index() {
  23. //auth 服务 调用 system服务提供的feign接口
  24. return remoteUserFService.getUserInfo("312");
  25. }
  26. @GetMapping("getUserInfo")
  27. public String getUserInfo(String account) {
  28. //auth 服务 调用example实现的dubbo接口
  29. return remoteUserService.getUserInfoV1(account);
  30. }
  31. /**
  32. * 登录
  33. */
  34. @PostMapping("/login")
  35. public HttpResult login(@RequestBody LoginReqDto reqDto) {
  36. return HttpResult.ok(indexService.login(reqDto));
  37. }
  38. /**
  39. * 注册
  40. */
  41. @PostMapping("/register")
  42. public HttpResult register(@RequestBody RegisterReqDto reqDto) {
  43. indexService.register(reqDto);
  44. return HttpResult.ok();
  45. }
  46. }