From 5429922982baaf6c19a2260c5e908836e3354867 Mon Sep 17 00:00:00 2001 From: Vinjor Date: Tue, 24 Sep 2024 19:41:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E5=AF=86=E7=A0=81=E7=99=BB?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WechatLoginController.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/wechat/controller/WechatLoginController.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/wechat/controller/WechatLoginController.java index 26535eaf..350f77e1 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/wechat/controller/WechatLoginController.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/wechat/controller/WechatLoginController.java @@ -2,16 +2,20 @@ package cn.iocoder.yudao.module.app.wechat.controller; import cn.iocoder.yudao.framework.common.pojo.CommonResult; 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 io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; 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 { @Autowired private WechatService wechatService; + @Resource + private AdminAuthService authService; /** * 微信获取openId @@ -37,4 +43,10 @@ public class WechatLoginController { return wechatService.loginByOpenId(code); } + @PostMapping("/login") + @PermitAll + @Operation(summary = "使用账号密码登录") + public CommonResult login(@RequestBody @Valid AuthLoginReqVO reqVO) { + return success(authService.login(reqVO)); + } } \ No newline at end of file