From d0cf2cb2c352bdeb146aad2bb57ba7d39cef3bbd Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 03 十一月 2026 17:59:04 +0800
Subject: [PATCH] 完善会员审批及门户配置
---
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImpl.java | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImpl.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImpl.java
index 2ee215b..63efddb 100644
--- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImpl.java
+++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImpl.java
@@ -47,6 +47,24 @@
private SocialClientService socialClientService;
@Override
+ @Transactional(rollbackFor = Exception.class)
+ public void bindApprovedWxcpUser(String openid, Long userId) {
+ int type = 30;
+ int userType = cn.iocoder.yudao.framework.common.enums.UserTypeEnum.ADMIN.getValue();
+ SocialUserDO socialUser = socialUserMapper.selectByTypeAndOpenid(type, openid);
+ if (socialUser == null) throw new IllegalStateException("浼佷笟寰俊韬唤涓嶅瓨鍦紝璇烽噸鏂版壂鐮�");
+ SocialUserBindDO existing = socialUserBindMapper.selectByUserTypeAndSocialUserId(userType, socialUser.getId());
+ if (existing != null) {
+ if (!existing.getUserId().equals(userId)) throw new IllegalStateException("璇ヤ紒涓氬井淇¤韩浠藉凡缁戝畾鍏朵粬璐﹀彿");
+ return;
+ }
+ if (socialUserBindMapper.selectByUserIdAndUserTypeAndSocialType(userId, userType, type) != null)
+ throw new IllegalStateException("璇ヨ处鍙峰凡缁戝畾鍏朵粬浼佷笟寰俊韬唤");
+ socialUserBindMapper.insert(SocialUserBindDO.builder().userId(userId).userType(userType)
+ .socialUserId(socialUser.getId()).socialType(type).build());
+ }
+
+ @Override
public List<SocialUserDO> getSocialUserList(Long userId, Integer userType) {
// 鑾峰緱缁戝畾
List<SocialUserBindDO> socialUserBinds = socialUserBindMapper.selectListByUserIdAndUserType(userId, userType);
@@ -115,8 +133,18 @@
// 鑾峰緱缁戝畾鐢ㄦ埛
SocialUserBindDO socialUserBind = socialUserBindMapper.selectByUserTypeAndSocialUserId(userType,
socialUser.getId());
- return new SocialUserRespDTO(socialUser.getOpenid(), socialUser.getNickname(), socialUser.getAvatar(),
+ SocialUserRespDTO result = new SocialUserRespDTO(socialUser.getOpenid(), socialUser.getNickname(), socialUser.getAvatar(),
socialUserBind != null ? socialUserBind.getUserId() : null);
+ if (socialType == 30 && cn.hutool.core.util.StrUtil.isNotBlank(socialUser.getRawUserInfo())) {
+ try {
+ cn.hutool.json.JSONObject raw = cn.hutool.json.JSONUtil.parseObj(socialUser.getRawUserInfo());
+ result.setMobile(raw.getStr("mobile"));
+ if (cn.hutool.core.util.StrUtil.isBlank(result.getNickname())) result.setNickname(raw.getStr("name"));
+ } catch (Exception ignored) {
+ // 鏁忔劅淇℃伅涓嶅彲鐢ㄦ椂涓嶅奖鍝嶆壂鐮侊紝鐢宠浣跨敤闅忔満璐﹀彿鏂规銆�
+ }
+ }
+ return result;
}
/**
--
Gitblit v1.9.3