| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- package com.sckw.auth.controller;
- import com.sckw.auth.model.vo.req.LoginReqVo;
- 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.*;
- @RestController
- @RequestMapping("/auth")
- public class IndexController {
- @Autowired
- private RemoteUserFService remoteUserFService;
- @DubboReference(version = "2.0.0", group = "design", check = false)
- private RemoteUserService remoteUserService;
- @Autowired
- private IIndexService indexService;
- @GetMapping("/index")
- public String index() {
- //auth 服务 调用 system服务提供的feign接口
- return remoteUserFService.getUserInfo("312");
- }
- @GetMapping("/getUserInfo")
- public String getUserInfo(String account) {
- //auth 服务 调用example实现的dubbo接口
- return remoteUserService.getUserInfoV1(account);
- }
- /**
- * 登录
- */
- @PostMapping("/login")
- public HttpResult login(@RequestBody LoginReqVo reqVo) {
- return HttpResult.ok(indexService.login(reqVo));
- }
- /**
- * 注册
- */
- @PostMapping("/register")
- public HttpResult register(@RequestBody RegisterReqDto reqDto) {
- indexService.register(reqDto);
- return HttpResult.ok();
- }
- }
|