账号密码登录

This commit is contained in:
Vinjor 2024-09-24 19:41:52 +08:00
parent 97485e7546
commit 5429922982

View File

@ -2,16 +2,20 @@ package cn.iocoder.yudao.module.app.wechat.controller;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.app.wechat.service.WechatService; import cn.iocoder.yudao.module.app.wechat.service.WechatService;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginReqVO;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginRespVO;
import cn.iocoder.yudao.module.system.service.auth.AdminAuthService; import cn.iocoder.yudao.module.system.service.auth.AdminAuthService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import javax.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/** /**
* 微信登录控制层 * 微信登录控制层
@ -24,6 +28,8 @@ import javax.annotation.Resource;
public class WechatLoginController { public class WechatLoginController {
@Autowired @Autowired
private WechatService wechatService; private WechatService wechatService;
@Resource
private AdminAuthService authService;
/** /**
* 微信获取openId * 微信获取openId
@ -37,4 +43,10 @@ public class WechatLoginController {
return wechatService.loginByOpenId(code); return wechatService.loginByOpenId(code);
} }
@PostMapping("/login")
@PermitAll
@Operation(summary = "使用账号密码登录")
public CommonResult<AuthLoginRespVO> login(@RequestBody @Valid AuthLoginReqVO reqVO) {
return success(authService.login(reqVO));
}
} }