| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package com.sckw.auth.controller;
- import com.sckw.auth.model.vo.req.LoginReqVo;
- import com.sckw.auth.model.vo.req.RegisterReqVo;
- 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 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));
- }
- /**
- * @param reqDto 注册入参
- * @return HttpResult
- * @desc: 用户注册
- * @author: czh
- * @date: 2023/6/16
- */
- @PostMapping("/register")
- public HttpResult register(@RequestBody RegisterReqVo reqDto) {
- indexService.register(reqDto);
- return HttpResult.ok();
- }
- }
|