| | |
| | | // 注册云信账号(远程调用) |
| | | Map<String, String> paramMap = new HashMap<>(); |
| | | paramMap.put("accid", dto.getAccount()); |
| | | if(StringUtils.isNotEmpty(dto.getNikeName())){ |
| | | paramMap.put("name", dto.getNikeName()); |
| | | } |
| | | paramMap.put("token", dto.getPassword()); |
| | | |
| | | if (StringUtils.isNotEmpty(dto.getNikeName())) { |
| | | Map<String, String> userInfoMap = new HashMap<>(); |
| | | userInfoMap.put("name", dto.getNikeName()); |
| | | |
| | | // 使用 JSON 工具将 Map 转为 JSON 字符串 |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | String userInfoJson = objectMapper.writeValueAsString(userInfoMap); |
| | | paramMap.put("user_information", userInfoJson); |
| | | } |
| | | YunxinApiResponse response = yunxinClient.executeV1Api(YUNXIN_CREATE_PATH, paramMap); |
| | | |
| | | // 处理云信响应 |
| | |
| | | log.error("-----------注册账号异常:"+ErrorCodeEnum.getByCode(code).getComment()+"----im信息:"+ErrorCodeEnum.getByCode(code).getDesc()); |
| | | throw new RuntimeException(errorMsg); |
| | | } |
| | | //修改昵称 |
| | | UpdateUserBusinessDto userBusinessDto = new UpdateUserBusinessDto(); |
| | | userBusinessDto.setName(dto.getNikeName()); |
| | | updateUserAvatar(dto.getAccount(),userBusinessDto); |
| | | |
| | | //默认添加邀请人为好友 |
| | | if(ObjectUtil.isNotEmpty(user)){ |
| | | addFriends(userAccount.getAccount(),user.getAccount()); |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 生成校验和 |
| | | */ |
| | |
| | | if(null != vo.getStatus() && vo.getStatus() == 1){ |
| | | builder.setEnabled(false); |
| | | builder.setNeedKick(true); |
| | | }else if(StringUtils.isNotEmpty(vo.getPassword())){ |
| | | }else if(null != vo.getStatus() && vo.getStatus() == 0){ |
| | | builder.setEnabled(true); |
| | | } |
| | | if(StringUtils.isNotEmpty(vo.getPassword())){ |
| | | builder.setToken(vo.getPassword()); |
| | | } |
| | | // 只设置需要的字段 |