微信绑定实现
This commit is contained in:
parent
2ed61ba13c
commit
cdc2a65330
|
|
@ -1829,10 +1829,13 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||||
@Override
|
@Override
|
||||||
public Result bindWx(BindWxDTO bindWxDTO, Long userId) {
|
public Result bindWx(BindWxDTO bindWxDTO, Long userId) {
|
||||||
//微信appid
|
//微信appid
|
||||||
CommonInfo one = commonInfoService.findOne(5);
|
CommonInfo one = commonInfoService.findOne(937);
|
||||||
//微信秘钥
|
//微信秘钥
|
||||||
CommonInfo two = commonInfoService.findOne(21);
|
CommonInfo two = commonInfoService.findOne(936);
|
||||||
SnsToken snsToken = SnsAPI.oauth2AccessToken(one.getValue(), two.getValue(), bindWxDTO.getCode());
|
SnsToken snsToken = SnsAPI.oauth2AccessToken(one.getValue(), two.getValue(), bindWxDTO.getCode());
|
||||||
|
if (!snsToken.isSuccess()) {
|
||||||
|
return Result.error("获取失败");
|
||||||
|
}
|
||||||
String openid = snsToken.getOpenid();
|
String openid = snsToken.getOpenid();
|
||||||
int count = count(new LambdaQueryWrapper<UserEntity>().eq(UserEntity::getWxOpenId, openid));
|
int count = count(new LambdaQueryWrapper<UserEntity>().eq(UserEntity::getWxOpenId, openid));
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue