登录部分

This commit is contained in:
2024-06-22 11:26:07 +08:00
parent 941c33ea7a
commit d86463155d
3 changed files with 29 additions and 9 deletions

View File

@@ -320,18 +320,21 @@ public class LoginContoller {
@PostMapping("/app/login")
public Result applogin(@RequestBody AuthUserDto authUserDto) {
boolean tf = false;
JSONObject SessionKeyOpenId = WechatUtil.getSessionKeyOrOpenId(authUserDto.getOpencode(), customAppId, customSecrete);
// 3.接收微信接口服务 获取返回的参数
String openid = SessionKeyOpenId.getString("openid");
if (ObjectUtil.isNull(authUserDto.getCode())) {
if (StringUtils.isBlank(authUserDto.getPassword())) {
return Result.fail("请输入密码,或使用验证码登录");
}
//验证密码
String mdPasswordString = MD5Utils.MD5Encode(authUserDto.getPassword(), "utf-8");
return loginService.appLogin(authUserDto.getUsername(), mdPasswordString);
return loginService.appLogin(authUserDto.getUsername(),openid, mdPasswordString);
} else {
// tf = true;
tf = loginService.validate(authUserDto.getCode(), authUserDto.getUsername());
if (tf) {
return loginService.appLogin(authUserDto.getUsername(), null);
return loginService.appLogin(authUserDto.getUsername(),openid, null);
} else {
return Result.fail("验证码输入有误");
}