mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2024-12-22 20:54:26 +08:00
feat:添加微信认证登陆
This commit is contained in:
parent
51ae6be207
commit
c20d27672a
@ -3,13 +3,13 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ylmall-ums</artifactId>
|
||||
<artifactId>mall-ums</artifactId>
|
||||
<groupId>com.youlai</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ylmall-ums-api</artifactId>
|
||||
<artifactId>mall-ums-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -0,0 +1,34 @@
|
||||
package com.youlai.mall.ums.api.entity;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
public class UmsMember {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
|
||||
private Integer gender;
|
||||
|
||||
private String nickname;
|
||||
|
||||
private String mobile;
|
||||
|
||||
private LocalDate birthday;
|
||||
|
||||
private String avatar;
|
||||
|
||||
private String openid;
|
||||
|
||||
private String sessionKey;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -9,11 +9,11 @@
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ylmall-ums</artifactId>
|
||||
<artifactId>mall-ums</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>ylmall-ums-api</module>
|
||||
<module>ylmall-ums-biz</module>
|
||||
<module>mall-ums-api</module>
|
||||
<module>mall-ums-biz</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
@ -2,6 +2,8 @@ package com.youlai.auth.controller;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
|
||||
import com.youlai.auth.domain.WxLoginInfo;
|
||||
import com.youlai.common.core.result.Result;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -26,11 +28,19 @@ public class WxAuthController {
|
||||
return Result.error();
|
||||
}
|
||||
WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(code);
|
||||
if(session==null){
|
||||
if (session == null) {
|
||||
return Result.error();
|
||||
}
|
||||
String openid = session.getOpenid();
|
||||
String secretKey = session.getSessionKey();
|
||||
String sessionKey = session.getSessionKey();
|
||||
|
||||
// 用户信息
|
||||
WxMaUserInfo userInfo = wxService.getUserService().getUserInfo(sessionKey, wxLoginInfo.getEncryptedData(), wxLoginInfo.getIv());
|
||||
|
||||
// 手机号码信息
|
||||
WxMaPhoneNumberInfo phoneNumberInfo = wxService.getUserService().getPhoneNoInfo(sessionKey, wxLoginInfo.getEncryptedData(), wxLoginInfo.getIv());
|
||||
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user