IndexController.java 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package com.sckw.auth.controller;
  2. import com.sckw.auth.model.vo.req.LoginReqVo;
  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. @RestController
  12. @RequestMapping("/auth")
  13. public class IndexController {
  14. @Autowired
  15. private RemoteUserFService remoteUserFService;
  16. @DubboReference(version = "2.0.0", group = "design", check = false)
  17. private RemoteUserService remoteUserService;
  18. @Autowired
  19. private IIndexService indexService;
  20. @GetMapping("/index")
  21. public String index() {
  22. //auth 服务 调用 system服务提供的feign接口
  23. return remoteUserFService.getUserInfo("312");
  24. }
  25. @GetMapping("/getUserInfo")
  26. public String getUserInfo(String account) {
  27. //auth 服务 调用example实现的dubbo接口
  28. return remoteUserService.getUserInfoV1(account);
  29. }
  30. /**
  31. * 登录
  32. */
  33. @PostMapping("/login")
  34. public HttpResult login(@RequestBody LoginReqVo reqVo) {
  35. return HttpResult.ok(indexService.login(reqVo));
  36. }
  37. /**
  38. * 注册
  39. */
  40. @PostMapping("/register")
  41. public HttpResult register(@RequestBody RegisterReqDto reqDto) {
  42. indexService.register(reqDto);
  43. return HttpResult.ok();
  44. }
  45. }