OpenIMApiClient 替换
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.tailbet.common.constant;
|
||||
|
||||
import com.tailbet.common.enums.PlatformEnum;
|
||||
|
||||
/**
|
||||
* OpenIM 协议相关常量
|
||||
* <p>
|
||||
@@ -117,13 +119,13 @@ public final class OpenImConstants {
|
||||
* 服务端代操作使用的平台 ID(Web)。
|
||||
* 与 App 端 iOS/Android 平台隔离,避免顶掉用户已登录 session。
|
||||
*/
|
||||
public static final int PLATFORM_ID_SERVER_WEB = 5;
|
||||
public static final int PLATFORM_ID_SERVER_WEB = PlatformEnum.WEB.getCode();
|
||||
|
||||
/** App 端 iOS 平台 ID */
|
||||
public static final int PLATFORM_ID_IOS = 1;
|
||||
public static final int PLATFORM_ID_IOS = PlatformEnum.IOS.getCode();
|
||||
|
||||
/** App 端 Android 平台 ID */
|
||||
public static final int PLATFORM_ID_ANDROID = 2;
|
||||
public static final int PLATFORM_ID_ANDROID = PlatformEnum.ANDROID.getCode();
|
||||
|
||||
// ==================== 会话摘要 / 未读 ====================
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.tailbet.common.enums;
|
||||
|
||||
/**
|
||||
* OpenIM 平台 ID 枚举
|
||||
* <p>
|
||||
* 表示用户连接所在的终端平台。
|
||||
* </p>
|
||||
*
|
||||
* @author socialapp团队
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public enum PlatformEnum {
|
||||
|
||||
IOS(1, "iOS"),
|
||||
ANDROID(2, "Android"),
|
||||
WINDOWS(3, "Windows"),
|
||||
OSX(4, "macOS"),
|
||||
WEB(5, "Web"),
|
||||
MINI_WEB(6, "小程序或轻量 Web"),
|
||||
LINUX(7, "Linux"),
|
||||
APAD(8, "Android 平板"),
|
||||
IPAD(9, "iPad"),
|
||||
ADMIN(10, "管理端"),
|
||||
HARMONYOS(11, "HarmonyOS"),
|
||||
BOT(12, "Bot");
|
||||
|
||||
/**
|
||||
* 平台 ID
|
||||
*/
|
||||
private final int code;
|
||||
|
||||
/**
|
||||
* 平台名称
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
PlatformEnum(int code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 code 获取枚举
|
||||
*
|
||||
* @param code 平台 ID
|
||||
* @return 对应的枚举值,未找到返回 null
|
||||
*/
|
||||
public static PlatformEnum fromCode(int code) {
|
||||
for (PlatformEnum platform : values()) {
|
||||
if (platform.code == code) {
|
||||
return platform;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user