微信绑定实现

This commit is contained in:
张松 2025-03-27 11:42:53 +08:00
parent 2ed61ba13c
commit cdc2a65330
1 changed files with 5 additions and 2 deletions

View File

@ -1829,10 +1829,13 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
@Override
public Result bindWx(BindWxDTO bindWxDTO, Long userId) {
//微信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());
if (!snsToken.isSuccess()) {
return Result.error("获取失败");
}
String openid = snsToken.getOpenid();
int count = count(new LambdaQueryWrapper<UserEntity>().eq(UserEntity::getWxOpenId, openid));
if (count > 0) {