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 | 32 ++++++++++++++++++++++++++++++--
1 files changed, 30 insertions(+), 2 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 7c97c88..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
@@ -31,7 +31,7 @@
/**
* 绀句氦鐢ㄦ埛 Service 瀹炵幇绫�
*
- * @author 鑺嬮亾婧愮爜
+ * @author 瓒呯骇绠$悊鍛�
*/
@Service
@Validated
@@ -45,6 +45,24 @@
@Resource
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) {
@@ -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