1
zj
2025-08-24 4a79b4c9bc6f9f1c6c0f2d8b5edf755535ba2ad1
1
10 files modified
1 files added
622 ■■■■ changed files
ruoyi-admin/src/main/java/com/ruoyi/im/ImApiController.java 38 ●●●●● patch | view | raw | blame | history
ruoyi-admin/src/main/java/com/ruoyi/im/comm/Result.java 7 ●●●●● patch | view | raw | blame | history
ruoyi-admin/src/main/java/com/ruoyi/im/config/AppAuthConfig.java 2 ●●● patch | view | raw | blame | history
ruoyi-admin/src/main/java/com/ruoyi/im/config/CreateTeamRequest.java 4 ●●● patch | view | raw | blame | history
ruoyi-admin/src/main/java/com/ruoyi/im/service/impl/ImApiServcieImpl.java 118 ●●●●● patch | view | raw | blame | history
ruoyi-admin/src/main/java/com/ruoyi/im/service/impl/NeteaseTeamServiceImpl.java 62 ●●●● patch | view | raw | blame | history
ruoyi-admin/src/main/java/com/ruoyi/imenum/ErrorCodeEnum.java 355 ●●●●● patch | view | raw | blame | history
ruoyi-admin/src/main/java/com/ruoyi/web/controller/group/ImGroupController.java 10 ●●●● patch | view | raw | blame | history
ruoyi-admin/src/main/java/com/ruoyi/web/controller/user/UserController.java 23 ●●●● patch | view | raw | blame | history
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/UserAccountUpdateVo.java 1 ●●●● patch | view | raw | blame | history
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/UserAccountVo.java 2 ●●● patch | view | raw | blame | history
ruoyi-admin/src/main/java/com/ruoyi/im/ImApiController.java
@@ -1,6 +1,7 @@
package com.ruoyi.im;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.StringUtils;
@@ -9,9 +10,11 @@
import com.ruoyi.im.dto.UpdateUserBusinessDto;
import com.ruoyi.im.service.ImApiServcie;
import com.ruoyi.im.dto.RegisterDto;
import com.ruoyi.im.util.SymmetricCryptoUtil;
import com.ruoyi.system.domain.GroupWelcomeConfig;
import com.ruoyi.system.domain.IpBlacklist;
import com.ruoyi.system.domain.UserAccount;
import com.ruoyi.system.domain.vo.UserAccountUpdateVo;
import com.ruoyi.system.service.GroupWelcomeConfigService;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.service.IpBlacklistService;
@@ -34,6 +37,7 @@
import java.nio.file.Paths;
import java.nio.file.attribute.PosixFilePermission;
import java.nio.file.attribute.PosixFilePermissions;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
@@ -68,9 +72,37 @@
    public Result register(@Validated RegisterDto dto){
        try {
            return imApiServcie.register(dto);
        }catch (Exception e){
            log.error("注册报错:",e);
            return Result.error("注册失败,请稍后再试!");
        } catch (RuntimeException e) {
            // 从异常消息中解析Result对象
            return JSON.parseObject(e.getMessage(), Result.class);
        }
    }
    /**
     * 修改用户信息只有数据库
     * @return
     */
    @PostMapping("/updateUser")
    public Result updateUser(UserAccountUpdateVo vo){
        try {
            UserAccount userAccount = userAccountService.getOne(new LambdaQueryWrapper<UserAccount>().eq(UserAccount::getAccount,vo.getAccountId()));
            if (StringUtils.isNotBlank(vo.getNickname())) {
                userAccount.setNickname(vo.getNickname());
            }
            if (StringUtils.isNotBlank(vo.getSignature())) {
                userAccount.setSignature(vo.getSignature());
            }
            userAccount.setUpdateTime(new Date());
            userAccountService.updateById(userAccount);
            return Result.success();
        } catch (RuntimeException e) {
            e.printStackTrace();
            log.error("修改用户数据库信息失败");
            return Result.error("修改失败!");
        }
    }
ruoyi-admin/src/main/java/com/ruoyi/im/comm/Result.java
@@ -1,5 +1,7 @@
package com.ruoyi.im.comm;
import com.alibaba.fastjson2.JSON;
import java.io.Serializable;
/**
@@ -93,4 +95,9 @@
    public long getTimestamp() {
        return timestamp;
    }
    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }
}
ruoyi-admin/src/main/java/com/ruoyi/im/config/AppAuthConfig.java
@@ -5,7 +5,7 @@
    /**
     * 应用认证配置
     */
    DEFAULT_CONFIG("cd693c66bb6992a7cc2b13379e981d48", "720c0b98f7a3");
    DEFAULT_CONFIG("7767647313060a0e18b3197510aed6ad", "2090f22ebd8c");
    private final String appKey;
    private final String appSecret;
ruoyi-admin/src/main/java/com/ruoyi/im/config/CreateTeamRequest.java
@@ -10,7 +10,9 @@
@Data
public class CreateTeamRequest {
    private String groupId;
    private Integer id;
//    private String groupId;
    /**
ruoyi-admin/src/main/java/com/ruoyi/im/service/impl/ImApiServcieImpl.java
@@ -19,12 +19,14 @@
import com.ruoyi.im.config.*;
import com.ruoyi.im.dto.UpdateUserBusinessDto;
import com.ruoyi.im.service.NeteaseTeamService;
import com.ruoyi.imenum.ErrorCodeEnum;
import com.ruoyi.system.domain.GroupWelcomeConfig;
import com.ruoyi.system.domain.NeteaseTeam;
import com.ruoyi.system.domain.UserAccount;
import com.ruoyi.im.service.ImApiServcie;
import com.ruoyi.im.dto.RegisterDto;
import com.ruoyi.system.domain.vo.UserAccountUpdateVo;
import com.ruoyi.system.mapper.NeteaseTeamMapper;
import com.ruoyi.system.service.GroupWelcomeConfigService;
import com.ruoyi.system.service.UserAccountService;
import com.ruoyi.im.util.SymmetricCryptoUtil;
@@ -71,6 +73,8 @@
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private NeteaseTeamMapper neteaseTeamMapper;
    @Resource
    private final YunxinApiHttpClient yunxinClient;
@@ -105,30 +109,32 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Result register(RegisterDto dto) {
        // 验证手机号是否已存在
        List<UserAccount> accounts = userAccountService.list(
                new LambdaQueryWrapper<>(UserAccount.class)
                        .eq(UserAccount::getAccount, dto.getAccount())
        );
        if (!CollectionUtils.isEmpty(accounts)) {
            return Result.error("账号已被注册!");
        }
        // 创建本地用户账户记录
        UserAccount userAccount = new UserAccount();
        userAccount.setAccount(dto.getAccount());
        userAccount.setPhoneNumber(dto.getAccount());
        userAccount.setCloudMessageAccount(dto.getAccount());
        userAccount.setPassword(SymmetricCryptoUtil.encryptPassword(dto.getPassword()));
        userAccount.setCreateTime(new Date());
        userAccount.setNickname(dto.getNickname());
        userAccount.setCreateTime(new Date());
        userAccount.setUpdateTime(new Date());
        if (!userAccountService.save(userAccount)) {
            throw new RuntimeException("保存用户账户失败");
        }
        try {
            // 验证手机号是否已存在
            List<UserAccount> accounts = userAccountService.list(
                    new LambdaQueryWrapper<>(UserAccount.class)
                            .eq(UserAccount::getAccount, dto.getAccount())
            );
            if (!CollectionUtils.isEmpty(accounts)) {
                return Result.error("账号已被注册!");
            }
            // 创建本地用户账户记录
            UserAccount userAccount = new UserAccount();
            userAccount.setAccount(dto.getAccount());
            userAccount.setPhoneNumber(dto.getAccount());
            userAccount.setCloudMessageAccount(dto.getAccount());
            userAccount.setPassword(SymmetricCryptoUtil.encryptPassword(dto.getPassword()));
            userAccount.setCreateTime(new Date());
            userAccount.setNickname(dto.getNickname());
            if (!userAccountService.save(userAccount)) {
                throw new RuntimeException("保存用户账户失败"); // 改为抛出异常
            }
            // 注册云信账号(远程调用)
            Map<String, String> paramMap = new HashMap<>();
            paramMap.put("accid", dto.getAccount());
@@ -144,30 +150,35 @@
            JSONObject json = JSONObject.parseObject(data);
            int code = json.getIntValue("code");
            if (code == 200) {
                GroupWelcomeConfig groupWelcomeConfig = groupWelcomeConfigService.getOne(new LambdaQueryWrapper<>(GroupWelcomeConfig.class)
                        .eq(GroupWelcomeConfig::getConfigurationName, "IM-BASICS").last(" limit 1"));
                if(ObjectUtil.isNotEmpty(groupWelcomeConfig)){
                    //添加默认好友
                    addFriends(userAccount.getAccount(),groupWelcomeConfig.getUserAccid());
                    //加入默认群聊
                    List<String> accountList = new ArrayList<>();
                    accountList.add(userAccount.getAccount());
                    AddTeamMembersRequest request = new AddTeamMembersRequest();
                    request.setInviteAccountIds(accountList);
                    request.setOperatorId(groupWelcomeConfig.getUserAccid());
                    neteaseTeamService.inviteTeamMembers(request);
            if (code != 200) {
                String errorMsg = "";
                if(code == 102405){
                    errorMsg = "用户已存在";
                }
                return Result.success("注册成功");
            } else {
                // 所有非200状态码都抛出异常触发回滚
                throw new RuntimeException("云信注册失败,错误码: " + code + ", 响应: " + data);
                log.error("-----------注册账号异常:"+ErrorCodeEnum.getByCode(code).getComment()+"----im信息:"+ErrorCodeEnum.getByCode(code).getDesc());
                throw new RuntimeException(errorMsg);
            }
            // 注册成功后的其他操作
            GroupWelcomeConfig groupWelcomeConfig = groupWelcomeConfigService.getOne(new LambdaQueryWrapper<>(GroupWelcomeConfig.class)
                    .eq(GroupWelcomeConfig::getConfigurationName, "IM-BASICS").last(" limit 1"));
            NeteaseTeam neteaseTeam = neteaseTeamMapper.selectOne(new LambdaQueryWrapper<NeteaseTeam>().eq(NeteaseTeam::getTid,groupWelcomeConfig.getGroupId()));
            if(ObjectUtil.isNotEmpty(groupWelcomeConfig) || ObjectUtil.isNotEmpty(neteaseTeam)){
                addFriends(userAccount.getAccount(),groupWelcomeConfig.getUserAccid());
                List<String> accountList = new ArrayList<>();
                accountList.add(userAccount.getAccount());
                AddTeamMembersRequest request = new AddTeamMembersRequest();
                request.setInviteAccountIds(accountList);
                request.setGroupId(neteaseTeam.getId().toString());
                neteaseTeamService.inviteTeamMembers(request);
            }
            return Result.success("注册成功");
        } catch (Exception e) {
            // 记录异常日志
            log.error("注册过程发生异常", e);
            // 重新抛出异常以确保事务回滚
            throw new RuntimeException("注册失败: " + e.getMessage(), e);
            // 将异常包装为Result并抛出RuntimeException触发回滚
            throw new RuntimeException(Result.error("注册失败: " + e.getMessage()).toString(), e);
        }
    }
@@ -474,7 +485,7 @@
                return yunxinResult;
            }
            return Result.success("成功批量注册 " + count + " 个账号");
            return Result.success("成功批量注册 " + count + " 个账号",yunxinResult.getData());
        } catch (Exception e) {
            // 其他异常,触发回滚
@@ -566,21 +577,22 @@
                .map(CompletableFuture::join)
                .collect(Collectors.toList());
        List<String> acccountList = new ArrayList<>();
        // 检查所有响应结果
        for (YunxinApiResponse response : responses) {
            String data = response.getData();
            JSONObject json = JSONObject.parseObject(data);
            int code = json.getIntValue("code");
            if (code != 200) {
                // 记录具体的错误信息
                String errorAccid = json.getString("accid"); // 如果返回了accid
                log.error("云信账号注册失败,accid: {}, 响应: {}, traceId: {}", errorAccid, data, response.getTraceId());
                // 返回第一个遇到的错误
                return Result.error("云信注册失败,错误码: " + code + (errorAccid != null ? ", 账号: " + errorAccid : ""));
            }
        }
            JSONObject info = json.getJSONObject("info");
            String accid = info.getString("accid");
        return Result.success("所有云信账号注册成功");
            if (code != 200) {
                log.error("-----------云信账号注册失败:"+ ErrorCodeEnum.getByCode(code).getComment()+"----im信息:"+ErrorCodeEnum.getByCode(code).getDesc());
                return Result.error("云信注册失败:"+ErrorCodeEnum.getByCode(code).getComment());
            }
            acccountList.add(accid);
        }
        return Result.success(acccountList);
    }
ruoyi-admin/src/main/java/com/ruoyi/im/service/impl/NeteaseTeamServiceImpl.java
@@ -14,11 +14,14 @@
import com.netease.nim.server.sdk.im.v2.team.TeamV2UrlContext;
import com.netease.nim.server.sdk.im.v2.team_member.TeamMemberV2UrlContext;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.im.comm.Result;
import com.ruoyi.im.config.AddTeamMembersRequest;
import com.ruoyi.im.config.CreateTeamRequest;
import com.ruoyi.im.config.AssignmentRequest;
import com.ruoyi.im.service.NeteaseTeamService;
import com.ruoyi.imenum.ErrorCodeEnum;
import com.ruoyi.system.domain.GroupWelcomeConfig;
import com.ruoyi.system.domain.NeteaseTeam;
import com.ruoyi.system.mapper.NeteaseTeamMapper;
@@ -29,13 +32,19 @@
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class NeteaseTeamServiceImpl extends ServiceImpl<NeteaseTeamMapper, NeteaseTeam> implements NeteaseTeamService {
    @Resource
    private final YunxinApiHttpClient yunxinClient;
    @Autowired
    ImApiServcieImpl imApiServcie;
    // 使用构造函数注入(推荐)
    @Autowired
@@ -77,8 +86,8 @@
            int code = json.getIntValue("code");
            if (code != 200) {
                log.error("网易云信创建群组失败,响应:");
                return AjaxResult.error("创建群组失败");
                log.error("-----------网易云信创建群组失败:"+ ErrorCodeEnum.getByCode(code).getComment()+"----im信息:"+ErrorCodeEnum.getByCode(code).getDesc());
                return AjaxResult.error("创建群组失败:"+ErrorCodeEnum.getByCode(code).getComment());
            }
            // 5. 解析响应获取群组ID
@@ -118,7 +127,7 @@
            // 2. 将Map转换为JSON字符串
            String jsonBody = JSON.toJSONString(paramMap);
            NeteaseTeam neteaseTeam = neteaseTeamMapper.selectById(request.getGroupId());
            NeteaseTeam neteaseTeam = neteaseTeamMapper.selectById(request.getId());
            if(ObjectUtil.isEmpty(neteaseTeam)){
                return AjaxResult.error("群不存在!");
            }
@@ -138,8 +147,8 @@
            int code = json.getIntValue("code");
            if (code != 200) {
                log.error("网易云信修改群组失败,响应:");
                return AjaxResult.error("修改群组失败");
                log.error("-----------网易云信修改群组失败:"+ ErrorCodeEnum.getByCode(code).getComment()+"----im信息:"+ErrorCodeEnum.getByCode(code).getDesc());
                return AjaxResult.error("修改群组失败:"+ErrorCodeEnum.getByCode(code).getComment());
            }
            // 5. 解析响应获取群组ID
@@ -266,18 +275,34 @@
            if(ObjectUtil.isEmpty(neteaseTeam)){
                return AjaxResult.error("群不存在!");
            }
            GroupWelcomeConfig groupWelcomeConfig = groupWelcomeConfigService.getOne(new LambdaQueryWrapper<>(GroupWelcomeConfig.class)
                    .eq(GroupWelcomeConfig::getConfigurationName, "IM-BASICS").last(" limit 1"));
            String operatorId;
            if(StringUtils.isNotEmpty(request.getOperatorId())){
                operatorId = request.getOperatorId();
            }else{
                operatorId = neteaseTeam.getOwnerAccountId();
            }
            List<String> inviteAccountIds = new ArrayList<>();
            if(ObjectUtil.isNotEmpty(request.getNumber()) && request.getNumber() > 0){
                Result result = imApiServcie.batchRegister(request.getNumber());
                if(result.getCode() != 200){
                    return AjaxResult.error("生成账号错误!");
                }
                List<String> accountList = (List<String>) result.getData();
                inviteAccountIds = accountList;
            }else{
                inviteAccountIds = request.getInviteAccountIds();
            }
            AddTeamMembersRequest build = AddTeamMembersRequest.builder()
                    .inviteAccountIds(request.getInviteAccountIds())
                    .operatorId(groupWelcomeConfig.getUserAccid())
                    .inviteAccountIds(inviteAccountIds)
                    .operatorId(operatorId)
                    .msg(request.getMsg())
                    .teamId(Long.valueOf(neteaseTeam.getTid()))
                    .teamType(neteaseTeam.getTeamType())
                    .build();
// 方法1:使用 Jackson ObjectMapper
            ObjectMapper objectMapper = new ObjectMapper();
            String jsonBody = objectMapper.writeValueAsString(build);
@@ -295,9 +320,10 @@
            int code = json.getIntValue("code");
            if (code != 200) {
                log.error("网易云信拉人入群失败,响应:");
                return AjaxResult.error("拉人入群失败");
                log.error("-----------网易云信拉人入群失败:"+ ErrorCodeEnum.getByCode(code).getComment()+"----im信息:"+ErrorCodeEnum.getByCode(code).getDesc());
                return AjaxResult.error("拉人入群失败:"+ErrorCodeEnum.getByCode(code).getComment());
            }
            return AjaxResult.success();
        } catch (YunxinSdkException e) {
            // 云信调用异常时回滚事务
@@ -346,9 +372,11 @@
            int code = json.getIntValue("code");
            if (code != 200) {
                log.error("网易云信转让群主失败,响应:");
                return AjaxResult.error("转让群主失败");
                log.error("-----------网易云信转让群主失败:"+ ErrorCodeEnum.getByCode(code).getComment()+"----im信息:"+ErrorCodeEnum.getByCode(code).getDesc());
                return AjaxResult.error("转让群主失败:"+ErrorCodeEnum.getByCode(code).getComment());
            }
            neteaseTeam.setOwnerAccountId(request.getNew_owner_account_id());
            neteaseTeamMapper.updateById(neteaseTeam);
            return AjaxResult.success();
        } catch (YunxinSdkException e) {
            // 云信调用异常时回滚事务
@@ -389,9 +417,11 @@
            int code = json.getIntValue("code");
            if (code != 200) {
                log.error("网易云信解散群失败,响应:");
                return AjaxResult.error("解散群失败");
                log.error("-----------网易云信解散群失败:"+ ErrorCodeEnum.getByCode(code).getComment()+"----im信息:"+ErrorCodeEnum.getByCode(code).getDesc());
                return AjaxResult.error("解散群失败:"+ErrorCodeEnum.getByCode(code).getComment());
            }
            neteaseTeam.setStatus(1);
            neteaseTeamMapper.updateById(neteaseTeam);
            return AjaxResult.success();
ruoyi-admin/src/main/java/com/ruoyi/imenum/ErrorCodeEnum.java
New file
@@ -0,0 +1,355 @@
package com.ruoyi.imenum;
public enum ErrorCodeEnum {
    // 成功状态
    SUCCESS(200, "请求成功", "请求成功"),
    // 系统错误
    INTERNAL_ERROR(190001, "internal error", "内部错误"),
    ILLEGAL_STATE(190002, "illegal state", "非法状态"),
    MISUSE(191001, "misuse", "使用姿势错误"),
    CANCELLED(191002, "cancelled", "操作取消"),
    CALLBACK_FAILED(191003, "callback failed", "回调失败"),
    INVALID_PARAMETER(191004, "invalid parameter", "参数错误"),
    TIMEOUT(191005, "timeout", "请求超时"),
    RESOURCE_NOT_EXIST(191006, "resource not exist", "资源不存在"),
    RESOURCE_ALREADY_EXIST(191007, "resource already exist", "资源已存在"),
    CONNECT_FAILED(192001, "connect failed", "连接错误"),
    CONNECT_TIMEOUT(192002, "connect timeout", "连接超时"),
    DISCONNECTED(192003, "disconnected", "连接断开"),
    PROTOCOL_TIMEOUT(192004, "protocol timeout", "协议超时"),
    PROTOCOL_SEND_FAILED(192005, "protocol send failed", "协议发送失败"),
    REQUEST_FAILED(192006, "request failed", "请求失败"),
    DATABASE_OPEN_FAILED(193001, "database open failed", "数据库打开失败"),
    DATABASE_UPGRADE_FAILED(193002, "database upgrade failed", "数据库升级失败"),
    DATABASE_WRITE_FAILED(193003, "database write failed", "数据库写入失败"),
    DATABASE_READ_FAILED(193004, "database read failed", "数据库读取失败"),
    FILE_NOT_FOUND(194001, "file not found", "文件找不到"),
    FILE_CREATE_FAILED(194002, "file create failed", "文件创建失败"),
    FILE_OPEN_FAILED(194003, "file open failed", "文件打开失败"),
    FILE_WRITE_FAILED(194004, "file write failed", "文件写入失败"),
    FILE_READ_FAILED(194005, "file read failed", "文件读取失败"),
    FILE_UPLOAD_FAILED(194006, "file upload failed", "文件上传失败"),
    FILE_DOWNLOAD_FAILED(194007, "file download failed", "文件下载失败"),
    // IM服务错误
    IM_DISABLED(101301, "IM disabled", "IM 未开通。请前往 网易云信控制台开通 IM 服务"),
    SERVICE_ADDRESS_INVALID(101302, "service address invalid", "服务地址非法"),
    APPKEY_NOT_EXIST(101303, "appkey not exist", "App Key 不存在"),
    BUNDLEID_CHECK_FAILED(101304, "bundleid check failed", "Bundle ID 校验失败"),
    ILLEGAL_AUTH_TYPE(101305, "illegal auth type", "非法的鉴权方式"),
    // 网络和安全错误
    HANDSHAKE_ERROR(201, "handshake error", "握手错误"),
    ASYMMETRIC_ENCRYPTION_ERROR(202, "asymmetric encryption algorithm error", "非对称加密算法错误"),
    SYMMETRIC_ENCRYPTION_ERROR(203, "symmetric encryption algorithm error", "对称加密算法错误"),
    HANDSHAKE_PROTOCOL_FALLBACK(204, "handshake protocol version need fallback", "握手协议版本需降级"),
    REQUEST_TEMPORARY_FORBIDDEN(398, "request temporary forbidden", "请求被服务器暂时禁止"),
    SERVER_UNIT_ERROR(399, "server unit error", "服务器单元错误"),
    FORBIDDEN(403, "forbidden", "没有权限"),
    NOT_FOUND(404, "not found", "资源不存在"),
    PARAMETER_ERROR(414, "parameter error", "参数错误"),
    RATE_LIMIT_EXCEEDED(416, "rate limit exceeded", "频率超限"),
    MULTI_LOGIN_FORBIDDEN(417, "multi login forbidden", "多端登录被禁止"),
    NEED_RETRY(449, "need retry", "请求需要重试"),
    CALLBACK_FORBIDDEN(463, "callback forbidden", "第三方回调被拒绝"),
    INTERNAL_SERVER_ERROR(500, "internal server error", "服务器内部错误"),
    SERVER_BUSY(503, "server busy", "服务器繁忙"),
    APP_SERVER_UNREACHABLE(511, "app server unreachable", "app 服务不可达"),
    SERVICE_UNAVAILABLE(514, "service unavailable", "服务不可用"),
    PROTOCOL_FILTERED(599, "protocol filtered by blackhole rule", "协议被黑洞规则过滤"),
    NO_PROTOCOL_PERMISSION(997, "appid has no permission to call the protocol", "appid 没有权限调用该协议"),
    UNPACK_ERROR(998, "unpack error", "解包错误"),
    PACK_ERROR(999, "pack error", "打包错误"),
    // HTTP相关错误
    AUTH_HEADER_MISSING(403, "request header for authentication missing", "缺少鉴权请求头"),
    INVALID_APPKEY(403, "invalid AppKey", "非法的 App Key"),
    CURTIME_GREATER(403, "CurTime five minutes greater than server time", "curtime 大于当前时间 5 分钟以上"),
    CURTIME_LESS(403, "CurTime five minutes less than server time", "curtime 小于当前时间 5 分钟以上"),
    AUTHENTICATION_FAILED(403, "authentication failed", "checksum 鉴权失败"),
    ACCESS_FORBIDDEN(403, "access forbidden", "拒绝访问"),
    INCORRECT_REQUEST_METHOD(400, "incorrect request method", "HTTP 请求方式错误"),
    INVALID_REQUEST_BODY(414, "invalid request body", "请求体格式不正确"),
    INVALID_PATH_OR_PARAM(414, "invalid path or request parameter", "路径参数或者请求参数不合法"),
    // 用户相关错误
    INVALID_TOKEN(102302, "invalid token", "无效 Token"),
    ROBOT_NOT_ALLOWED(102303, "robot not allowed", "机器人账号不得登录"),
    USER_NOT_EXIST(102404, "account not exist", "用户不存在"),
    ACCOUNT_BANNED(102422, "account banned", "用户被禁用"),
    ACCOUNT_IN_BLOCK_LIST(102426, "account in block list", "用户被拉黑"),
    ACCOUNT_CHAT_BANNED(102421, "account chat banned", "用户被禁言"),
    LIMIT_OF_ACCOUNTS_EXCEEDED(102434, "limit of accounts exceeded", "超过最大用户数"),
    ACCOUNT_OPERATION_NEED_RETRY(102449, "account operation need retry", "账号请求需要重试"),
    ACCOUNT_ALREADY_EXISTS(102405, "account already exists", "用户已存在"),
    LOGIN_RECORD_NOT_FOUND(102301, "login record not found", "找不到设备登录记录"),
    // 会话相关错误
    CONVERSATION_ACCOUNTS_NOT_UNIQUE(110301, "accounts for conversations not unique", "会话所属账号不唯一"),
    CONVERSATION_ACCOUNT_MISMATCH(110302, "conversation and account mismatch", "会话和账号不匹配"),
    CONVERSATION_STICK_TOP_LIMIT(110303, "conversation stick top limit", "会话置顶数量超限"),
    CONVERSATION_GROUP_LIMIT(110304, "conversation belonged group limit", "会话所属的会话分组数量超限"),
    CONVERSATION_NOT_EXIST(110404, "conversation not exist", "该会话不存在"),
    CONVERSATION_OPERATION_NEED_RETRY(110449, "conversation operation need retry", "会话请求需要重试"),
    CONVERSATION_GROUP_NOT_EXIST(116404, "conversation group not exist", "该会话分组不存在"),
    CONVERSATION_GROUP_LIMIT_EXCEEDED(116435, "conversation group limit", "会话分组数量超限"),
    CONVERSATIONS_IN_GROUP_LIMIT(116437, "conversations in group limit", "会话分组中的会话数量超限"),
    // AI相关错误
    LLM_REQUEST_FAILED(189308, "Failed request to the LLM", "请求大语言模型失败"),
    AI_REQUEST_ANTISPAM(189451, "AI request hit antispam", "AI 请求命中反垃圾"),
    AI_MESSAGES_DISABLED(107337, "AI messages function disabled", "AI 消息功能未开通"),
    NOT_AI_ACCOUNT(102304, "It's not an AI account", "不是数字人账号"),
    // 好友相关错误
    FRIEND_NOT_EXIST(104404, "friend not exist", "好友不存在"),
    FRIEND_ALREADY_EXIST(104405, "friend already exist", "好友已存在"),
    SELF_FRIEND_OPERATION_NOT_ALLOWED(104429, "self friend operation not allowed", "不允许对自己进行好友操作"),
    FRIEND_ACCOUNTS_LIMIT_EXCEEDED(104435, "friend accounts limit exceeded", "好友数量超限"),
    FRIEND_OPERATION_RATE_LIMIT_EXCEEDED(104449, "friend operation rate limit exceeded", "好友操作频率超限"),
    FRIEND_ANTISPAM(104451, "friend hit antispam", "好友操作命中反垃圾"),
    PEER_FRIEND_LIMIT_EXCEEDED(104301, "peer friend limit exceeded", "对方好友数量超限"),
    FRIEND_APPLICATION_NOT_EXIST(103451, "friend application not exist", "好友申请不存在"),
    // 消息相关错误
    MESSAGING_FUNCTION_DISABLED(107410, "messaging function disabled", "该 app 未开启发消息功能"),
    MESSAGE_ANTISPAM(107451, "message hit antispam", "消息发送命中反垃圾"),
    MESSAGE_NOT_EXIST(107404, "message not exist", "消息不存在"),
    REVOKE_MESSAGE_TO_SELF_NOT_ALLOWED(107429, "revoke message to self not allowed", "不允许撤回发给自己的消息"),
    INVALID_TIME_RANGE(107439, "invalid time range", "无效的时间范围"),
    REVOKE_THIRD_PARTY_MESSAGE_NOT_ALLOWED(107301, "revoke third party message not allowed", "不允许撤回第三方业务消息"),
    SENDING_MESSAGE_FAILED(107302, "sending message failed for marking message read failed for too many team members", "由于群成员过多导致标记已读失败,消息发送失败"),
    ONLY_SENDER_OR_MANAGER_CAN_REVOKE(107303, "only sender or manager can revoke message", "仅允许发送者或管理员撤回消息"),
    RATE_LIMIT_HIGH_PRIORITY_EXCEEDED(107304, "rate limit of high-priority messages exceeded", "高优消息发送超过频控限制"),
    ACK_MESSAGE_SHOULD_BE_HIGH_PRIORITY(107305, "ack message should be high-priority", "ACK 消息必须是高优消息"),
    DUPLICATE_CLIENT_MESSAGE_ID(107306, "duplicate client message ID", "消息客户端 ID 重复"),
    SHORT_TO_LONG_URL_FAILED(107307, "short to long URL failed", "短链转长链失败"),
    URL_INVALID(107308, "URL invalid", "无效 URL"),
    DURATION_OUT_OF_RANGE(107309, "duration out of range", "duration 超出范围"),
    GET_FILE_META_INFO_FAILED(107310, "get file meta info failed", "获取文件 meta 信息失败"),
    AUDIO_FILE_SIZE_LIMIT_EXCEEDED(107311, "audio file size limit exceeded", "音频文件大小超限"),
    VOICE_TO_TEXT_TIMEOUT(107312, "voice to text timeout", "语音转文字超时"),
    VOICE_TO_TEXT_FAILED(107313, "voice to text failed", "语音转文字失败"),
    REVOKE_MESSAGE_EXCEEDED_TIME_LIMIT(107314, "revoke message exceeded time limit", "撤回消息超过时间限制"),
    REVOKE_SPECIFIED_MESSAGE_NOT_ALLOWED(107315, "revoke specified message not allowed", "仅允许发送者或管理员撤回消息"),
    FORCE_PUSH_LIST_LIMIT_EXCEEDED(107316, "force push list limit exceeded", "群消息强推用户列表超过上限"),
    TEAM_MESSAGE_RECEIPT_RATE_LIMIT_EXCEEDED(107317, "team message receipt rate limit exceeded", "群消息已读操作频率超限"),
    SNAPSHOT_NOT_EXIST(107318, "snapshot not exist", "快照不存在"),
    PIN_LIMIT_EXCEEDED(107319, "PIN limit exceeded", "PIN 消息数量超限"),
    PIN_NOT_EXIST(107320, "PIN not exist", "PIN 消息不存在"),
    QUICK_COMMENT_LIMIT_EXCEEDED(107321, "quick comment limit exceeded", "快捷评论数量超限"),
    PIN_ALREADY_EXIST(107322, "PIN already exist", "PIN 消息已存在"),
    RATE_LIMIT_FOR_MESSAGING_EXCEEDED(107323, "rate limit for messaging exceeded", "消息操作超过频控"),
    READ_RECEIPT_FOR_P2P_MESSAGES_DISABLED(107325, "read receipt for p2p messages function disabled", "未开启单聊消息已读功能"),
    QUICK_COMMENT_FUNCTION_DISABLED(107326, "quick comment function disabled", "未开启快捷评论功能"),
    PIN_FUNCTION_DISABLED(107327, "PIN function disabled", "未开启消息 PIN 功能"),
    DELETE_SELF_MESSAGE_NOT_ALLOWED(107328, "delete self message not allowed", "不允许删除发送给自己的消息"),
    NOT_CHATBOT_ACCOUNT(107329, "%s is not chatbot account", "非机器人账号"),
    SENDER_OR_RECEIVER_MUST_SENSE_MESSAGE(107330, "sender or receiver must sense message", "发送方和接收方必须有一方有感知"),
    READ_RECEIPT_FOR_TEAM_MESSAGES_DISABLED(107331, "read receipt for team messages function disabled", "未开启群消息已读功能"),
    READ_RECEIPT_RECORD_NOT_FOUND(107332, "read receipt record for the team message not found", "群消息已读记录未找到"),
    VOICE_TO_TEXT_FUNCTION_DISABLED(107333, "voice to text function disabled", "语音转文字功能未开通"),
    SERVER_SEARCH_FUNCTION_DISABLED(107334, "server search function disabled", "云端搜索功能未开通"),
    ONE_WAY_DELETE_FUNCTION_DISABLED(107335, "one-way delete function disabled", "单向删除功能未开通"),
    MODIFY_MSG_FUNCTION_DISABLED(107341, "modify msg function disabled", "更新消息功能未开通"),
    MODIFY_MSG_TYPE_DISABLED(107342, "modify msg type disabled", "该消息类型不允许更新"),
    MODIFY_MSG_PARAM_DISABLED(107343, "modify msg param disabled", "该消息参数不允许更新"),
    NOT_ALLOWED_TO_MODIFY_MESSAGES(107344, "not allowed to modify messages", "不允许更新消息"),
    ONE_WAY_DELETION_NOT_ALLOWED(107338, "One-way deletion is not allowed for target messages", "定向消息不允许单向删除"),
    SENDER_CANNOT_BE_IN_RECEIVER_ACCOUNT_IDS(107339, "The message sender cannot be included in the receiver_account_ids", "定向列表不能包含消息发送者"),
    TARGETING_MESSAGES_FOR_GROUP_CHAT_DISABLED(108318, "Targeting messages for group chat is disabled", "群定向消息功能未开启"),
    INCLUSIVE_FALSE_NOT_ALLOWED(108319, "Setting 'inclusive' to false for super teams is not allowed", "超大群定向消息不支持反选"),
    CANNOT_MAKE_SUPER_TEAM_TARGETED_MESSAGES_VISIBLE(108320, "Cannot make super team targeted messages visible to new members", "超大群定向消息不支持新成员可见"),
    CANNOT_ALLOW_TARGETED_MESSAGES_INCLUSIVE(108321, "Cannot allow targeted messages inclusive to new members", "定向消息成员正选不支持新成员可见"),
    FORCED_PUSH_LIST_INCLUDES_NON_TARGETED_ACCOUNTS(109318, "The forced push list includes non-targeted accounts", "强推列表不能包含非定向成员"),
    ROBOT_CAN_NOT_SEND_TARGET_MESSAGE(107340, "robot can not send target message", "机器人消息不能是定向消息"),
    PIN_TARGET_MESSAGE_NOT_ALLOWED(107345, "pin target message is not allowed", "不支持 PIN 定向消息"),
    TARGET_MESSAGE_NOT_ALLOWED_REPLY(107346, "Target message not allowed reply", "定向消息不支持回复"),
    TARGET_MESSAGE_NOT_ALLOWED_QUICK_COMMENT(107347, "target message not allowed quick comment", "定向消息不支持快捷评论"),
    RESENT_MESSAGE_NOT_EXIST(111301, "resent message not exist", "重发消息不存在"),
    // 收藏相关错误
    COLLECTION_LIMIT_EXCEEDED(189301, "collection limit exceeded", "收藏数量超限"),
    COLLECTION_NOT_EXIST(189302, "collection not exist", "收藏不存在"),
    COLLECTION_CONCURRENT_OPERATION_FAILED(189449, "collection concurrent operation failed", "并发操作收藏失败"),
    // 群组相关错误
    TEAM_MEMBER_NOT_EXIST(109404, "team member not exist", "群成员不存在"),
    TEAM_NORMAL_MEMBER_CHAT_BANNED(108306, "team normal member chat banned", "群普通成员禁言"),
    TEAM_MEMBER_CHAT_BANNED(109424, "team member chat banned", "群成员被禁言"),
    CANNOT_BLOCKLIST_AI_ACCOUNT(106403, "You cannot blocklist an AI account", "不允许对数字人进行黑名单操作"),
    TEAM_NOT_EXIST(108404, "team not exist", "该群组不存在"),
    GET_ONLINE_USERS_COUNT_DISABLED(108406, "get online users count disabled", "高级群获取在线人数功能未开启"),
    ALL_TEAM_MEMBERS_CHAT_BANNED(108423, "all team members chat banned", "群全体成员禁言"),
    ASSIGN_TEAM_OWNER_MANAGER_ROLE_NOT_ALLOWED(108430, "assign team owner manager role not allowed", "不允许添加群主为管理员"),
    EXTENDED_SUPER_TEAM_LIMIT(108434, "extended super team limit", "大容量超大群数量超限"),
    CREATED_TEAM_LIMIT(108435, "created team limit", "创建的群组数量超过上限"),
    TEAM_INVITATION_LIMIT(108437, "team invitation limit", "群组内人数超过上限"),
    TEAM_ANTISPAM(108451, "team hit antispam", "群组命中反垃圾"),
    TEAM_OPERATION_NEED_RETRY(108449, "team operation need retry", "群组请求需要重试"),
    NOT_ADVANCED_TEAM(108302, "not advanced team", "非高级群"),
    TEAM_MANAGER_LIMIT_EXCEEDED(108303, "team manager limit exceeded", "群组管理员数量超限"),
    EXTENDED_SUPER_TEAM_LIMIT_NOT_CONFIGURED(108304, "extended super team limit not configured", "未配置大容量超大群的数量"),
    JOINED_TEAM_LIMIT_EXCEEDED(108305, "joined team limit exceeded", "加入群组数量超过上限"),
    INVITED_ACCOUNT_NOT_FRIEND(108307, "invited account not friend", "被邀请者非好友关系"),
    REJECT_ALL_TEAM_APPLICATIONS(108308, "reject all team applications", "拒绝所有入群申请"),
    CREATE_TEAM_WITH_MORE_THAN_USERS_NOT_ALLOWED(108309, "create team with more than %s users not allowed", "不允许创建超出 %s 人的群"),
    OPERATOR_IS_ALREADY_TEAM_OWNER(108310, "operator is already team owner", "当前操作者已是群主"),
    SUPER_TEAM_SERVICE_DISABLED(108311, "super team service disabled", "超大群服务未开通"),
    CREATE_EXTENDED_SUPER_TEAM_NOT_ALLOWED(108313, "create extended super team not allowed", "不允许创建大容量超大群"),
    TEAM_LIMIT_PER_QUERY_EXCEEDED(108314, "team limit per query exceeded", "查询群的数量超限"),
    LIST_OF_CHAT_BANNED_USERS_CONTAINS_NON_TEAM_MEMBERS(109301, "list of chat banned users contains non team members", "禁言列表包含非群成员"),
    LIST_OF_CHAT_BANNED_USERS_CONTAINS_THE_OPERATOR(109303, "list of chat banned users contains the operator", "禁言列表包含操作人"),
    LIST_OF_CHAT_BANNED_USERS_CONTAINS_THE_TEAM_OWNER(109304, "list of chat banned users contains the team owner", "禁言列表包含群主"),
    OPERATION_ON_TEAM_MANAGER_NOT_ALLOWED(109305, "operation on team manager not allowed", "不允许操作管理员"),
    NO_TEAM_INVITE_PERMISSION(109306, "no team invite permission", "没有群邀请权限"),
    TEAM_OWNER_QUIT_NOT_ALLOWED(109307, "team owner quit not allowed", "群主不允许退群"),
    LIST_OF_KICKED_USER_CONTAINS_THE_TEAM_OWNER(109308, "list of kicked user contains the team owner", "群被踢列表包含群主"),
    INVITE_ROBOT_ACCOUNT_NOT_ALLOWED(109309, "invite robot account not allowed", "不允许邀请机器人账号进群"),
    KICK_OPERATOR_NOT_ALLOWED(109310, "kick operator not allowed", "被踢的群成员列表中包含操作者"),
    TEAM_MEMBER_ALREADY_EXIST(109311, "team member already exist", "群成员已存在"),
    OPERATION_ON_SELF_NOT_ALLOWED(109312, "operation on self not allowed", "不允许操作本人"),
    TEAM_INVITATION_OR_APPLICATION_NOT_EXIST(109313, "team invitation or application not exist", "群邀请或申请入群记录不存在"),
    OPERATION_ON_TEAM_OWNER_NOT_ALLOWED(109314, "operation on team owner not allowed", "不允许操作群主"),
    TEAM_OWNER_OPERATION_PERMISSION_REQUIRED(109427, "team owner operation permission required", "仅允许群主操作"),
    TEAM_OWNER_OR_MANAGER_OPERATION_PERMISSION_REQUIRED(109432, "team owner or manager operation permission required", "仅允许群主或管理员操作"),
    TEAM_MEMBER_CONCURRENT_OPERATION_FAILED(109449, "team member concurrent operation failed", "并发操作群成员失败"),
    TEAM_MEMBER_ANTISPAM(109451, "team member hit antispam", "群成员操作命中反垃圾"),
    // 广播通知相关错误
    BROADCASTING_NOTIFICATION_SERVICE_DISABLED(111410, "broadcasting notification service disabled", "广播通知功能未开启"),
    BROADCASTING_NOTIFICATION_NOT_EXIST(111404, "broadcasting notification not exist", "该广播通知不存在"),
    BROADCASTING_NOTIFICATION_ANTISPAM(111451, "hit antispam", "命中反垃圾"),
    BROADCASTING_NOTIFICATION_ANTISPAM_2(113309, "broadcasting notification hit antispam", "广播通知命中反垃圾"),
    BROADCASTING_NOTIFICATION_SERVICE_DISABLED_2(113310, "broadcasting notification service disabled", "广播通知服务未开启"),
    // 聊天室相关错误
    FAILED_TO_GET_CHATROOM_LINK(113304, "failed to get chatroom link", "获取有效的聊天室连接地址失败"),
    IM_CONNECTION_ABNORMAL(113305, "IM connection abnormal", "IM 连接状态异常"),
    CHATROOM_NOT_EXIST(113404, "chatroom not exist", "聊天室不存在"),
    CHATROOM_CLOSED(113406, "chatroom closed", "聊天室已关闭"),
    OPERATION_ON_CHATROOM_REPEATED(113409, "operation on chatroom repeated", "聊天室重复操作"),
    CHATROOM_SERVICE_DISABLED(113410, "chatroom service disabled", "聊天室服务未开通"),
    ALL_CHATROOM_MEMBERS_CHAT_BANNED(113423, "all chatroom members chat banned", "聊天室全体成员禁言"),
    CHATROOM_INFO_ANTISPAM(113451, "chatroom info hit antispam", "聊天室信息命中反垃圾"),
    CHATROOM_ILLEGAL_AUTH_TYPE(113306, "chatroom illegal auth type", "非法的聊天室鉴权方式"),
    IDENTICAL_FIELD_VALUES(113307, "identical field values", "参数与现有聊天室属性一致,无需更新"),
    CHATROOM_MANAGER_OPERATION_PERMISSION_REQUIRED(113428, "chatroom manager operation permission required", "仅允许聊天室管理员操作"),
    CHATROOM_COUNT_LIMIT_EXCEEDED(113434, "chatroom count limit exceeded", "聊天室数量超过限制"),
    NOTIFICATION_FOR_JOINING_OR_LEAVING_CHATROOMS_DISABLED(113308, "notification for joining or leaving chatrooms disabled", "聊天室成员进出通知功能未开启"),
    CHATROOM_TEMPORARILY_CHAT_BANNED(113301, "chatroom temporarily chat banned", "聊天室被临时禁言"),
    CHATROOM_TAGGED_MEMBERS_CHAT_BANNED(113302, "chatroom tagged members chat banned", "聊天室标签成员被禁言"),
    CHAT_ROOM_CLOSING_REOPEN_NOT_ALLOWED(113303, "chat room closing, reopen not allowed", "聊天室关闭,不允许重新打开"),
    CHATROOM_MEMBER_NOT_EXIST(114404, "chatroom member not exist", "聊天室成员不存在"),
    CHATROOM_MEMBER_REPEATED_OPERATION(114405, "chatroom member repeated operation", "聊天室成员重复操作"),
    CHATROOM_MEMBER_CHAT_BANNED(114421, "chatroom member chat banned", "聊天室成员禁言"),
    ACCOUNT_IN_CHATROOM_BLOCK_LIST(114426, "account in chatroom block list", "账号在聊天室黑名单中"),
    CHATROOM_OWNER_OPERATION_PERMISSION_REQUIRED(114427, "chatroom owner operation permission required", "仅允许聊天室所有者操作"),
    OPERATOR_IN_CHATROOM_MEMBER_OPERATION_LIST(114429, "operator in chatroom member operation list", "聊天室成员操作列表包含操作者"),
    CHATROOM_OWNER_OR_MANAGER_OPERATION_PERMISSION_REQUIRED(114432, "chatroom owner or manager operation permission required", "仅允许聊天室所有者或管理员操作"),
    CHATROOM_MEMBER_LIMIT(114437, "chatroom member limit", "聊天室成员数量超限"),
    CHATROOM_MEMBER_CONCURRENT_OPERATION_FAILED(114449, "chatroom member concurrent operation failed", "并发操作聊天室成员失败"),
    CHATROOM_MEMBER_INFO_ANTISPAM(114451, "chatroom member info hit antispam", "聊天室成员命中反垃圾"),
    MEMBER_ALREADY_DELETED(114408, "Member: %s was already deleted", "聊天室成员已删除"),
    TARGET_ACCOUNT_IN_BLOCKLIST_OR_CHAT_BANNED_LIST(114301, "target account in blocklist or chat banned list of chatroom", "目标账号在禁言或黑名单列表中"),
    ANONYMOUS_MEMBER_OPERATION_FORBIDDEN(114304, "anonymous member operation forbidden", "匿名成员禁止操作"),
    TARGET_CHATROOM_MEMBER_OFFLINE(114304, "Target chatroom member offline", "目标成员账号不在线"),
    // 订阅服务相关错误
    SUBSCRIPTION_SERVICE_DISABLED(119410, "Subscription service disabled", "订阅服务未开通"),
    SUBSCRIPTION_EVENT_LIMIT_REACHED(119434, "Subscription event limit reached", "订阅事件超限"),
    ACCOUNT_ID_LIST_NOT_SUBSCRIBED(119301, "account ID list is not subscribed", "账号列表均未订阅"),
    REPEATED_SUBSCRIPTION(119302, "Repeated subscription", "重复订阅"),
    SUBSCRIPTION_FAILED(119303, "Subscription failed", "订阅失败"),
    // 反垃圾相关错误
    CLIENT_ANTI_SPAM(195001, "client anti-spam", "命中客户端反垃圾"),
    SERVER_ANTI_SPAM(195002, "server anti-spam", "命中云端反垃圾"),
    // 用户资料相关错误
    USER_PROFILE_NOT_EXIST(103404, "user profile not exist", "用户资料不存在"),
    USER_PROFILE_ANTISPAM(103451, "user profile hit antispam", "用户资料命中反垃圾"),
    // 免打扰相关错误
    MUTE_LIST_LIMIT_EXCEEDED(105435, "mute list limit exceeded", "免打扰用户列表超限"),
    SELF_MUTE_OPERATION_NOT_ALLOWED(105429, "self mute operation not allowed", "不允许在设置单聊消息免打扰时传入本人账号"),
    // 黑名单相关错误
    BLOCKLIST_LIMIT_EXCEEDED(106435, "blocklist limit exceeded", "黑名单用户数量超限"),
    SELF_BLOCKLIST_OPERATION_NOT_ALLOWED(106429, "self blocklist operation not allowed", "不允许将本人账号加入黑名单"),
    // 默认未知错误
    UNKNOWN_ERROR(-1, "unknown error", "未知错误");
    private final int code;
    private final String desc;
    private final String comment;
    ErrorCodeEnum(int code, String desc, String comment) {
        this.code = code;
        this.desc = desc;
        this.comment = comment;
    }
    public int getCode() {
        return code;
    }
    public String getDesc() {
        return desc;
    }
    public String getComment() {
        return comment;
    }
    /**
     * 根据错误码获取枚举实例
     * @param code 错误码
     * @return 对应的枚举实例,如果未找到则返回UNKNOWN_ERROR
     */
    public static ErrorCodeEnum getByCode(int code) {
        for (ErrorCodeEnum errorCode : values()) {
            if (errorCode.code == code) {
                return errorCode;
            }
        }
        return UNKNOWN_ERROR;
    }
    /**
     * 检查给定的错误码是否存在
     * @param code 错误码
     * @return 存在返回true,否则返回false
     */
    public static boolean contains(int code) {
        return getByCode(code) != UNKNOWN_ERROR;
    }
    @Override
    public String toString() {
        return "ErrorCode{" +
                "code=" + code +
                ", desc='" + desc + '\'' +
                ", comment='" + comment + '\'' +
                '}';
    }
    /**
     * 获取完整的错误信息
     * @return 格式化的错误信息
     */
    public String getFullMessage() {
        return String.format("错误码: %d, 描述: %s, 说明: %s", code, desc, comment);
    }
    /**
     * 获取简化的错误信息
     * @return 格式化的简化错误信息
     */
    public String getSimpleMessage() {
        return String.format("%d: %s", code, comment);
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/group/ImGroupController.java
@@ -54,19 +54,19 @@
     */
//    @PreAuthorize("@ss.hasPermi('im:group:list')")
    @GetMapping("/list")
    public TableDataInfo list(@PathVariable(value = "keyword", required = false) String keyword)
    public TableDataInfo list(@PathVariable(value = "keywords", required = false) String keywords)
    {
        // 创建查询条件包装器
        LambdaQueryWrapper<NeteaseTeam> queryWrapper = new LambdaQueryWrapper<>();
        // 只有当 keyword 不为空时才添加 OR 条件
        if (ObjectUtil.isNotEmpty(keyword)) {
        if (ObjectUtil.isNotEmpty(keywords)) {
            queryWrapper.and(wrapper -> wrapper
                    .eq(NeteaseTeam::getTid, keyword)
                    .eq(NeteaseTeam::getTid, keywords)
                    .or()
                    .eq(NeteaseTeam::getOwnerAccountId, keyword)
                    .eq(NeteaseTeam::getOwnerAccountId, keywords)
                    .or()
                    .eq(NeteaseTeam::getName,keyword)
                    .eq(NeteaseTeam::getName,keywords)
            );
        }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/user/UserController.java
@@ -2,6 +2,8 @@
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
@@ -52,15 +54,15 @@
        LambdaQueryWrapper<UserAccount> queryWrapper = new LambdaQueryWrapper<>();
        // 只有当 keyword 不为空时才添加 OR 条件
        if (ObjectUtil.isNotEmpty(vo.getKeyword())) {
        if (ObjectUtil.isNotEmpty(vo.getKeywords())) {
            queryWrapper.and(wrapper -> wrapper
                    .eq(UserAccount::getId, vo.getKeyword())
                    .eq(UserAccount::getId, vo.getKeywords())
                    .or()
                    .eq(UserAccount::getPhoneNumber, vo.getKeyword())
                    .like(UserAccount::getPhoneNumber, vo.getKeywords())
                    .or()
                    .eq(UserAccount::getAccount, vo.getKeyword())
                    .like(UserAccount::getAccount, vo.getKeywords())
                    .or()
                    .eq(UserAccount::getNickname, vo.getKeyword())
                    .like(UserAccount::getNickname, vo.getKeywords())
            );
        }
@@ -75,8 +77,17 @@
        queryWrapper.orderByDesc(UserAccount::getCreateTime);
        startPage();
        List<UserAccount> list = userAccountService.list(queryWrapper);
        PageInfo<UserAccount> pageInfo = new PageInfo<>(list);
        List<UserAccountOut> toList = ConverterUtil.convertToList(list, UserAccountOut.class);
        return getDataTable(toList);
        TableDataInfo rspData = new TableDataInfo();
        rspData.setCode(HttpStatus.SUCCESS);
        rspData.setMsg("查询成功");
        rspData.setRows(toList);
        rspData.setTotal(pageInfo.getTotal());
        return rspData;
    }
    /**
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/UserAccountUpdateVo.java
@@ -20,7 +20,6 @@
    // 自增ID主键
    @TableId(type = IdType.AUTO) // 主键自增
    private Integer id;
    // 云信账号
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/UserAccountVo.java
@@ -13,7 +13,7 @@
@Data
public class UserAccountVo {
    private String keyword;
    private String keywords;
    // 自增ID主键
    private Integer id;