85 lines
3.2 KiB
Go
85 lines
3.2 KiB
Go
package consts
|
|
|
|
import (
|
|
"hotgo/internal/library/dict"
|
|
"hotgo/internal/model"
|
|
)
|
|
|
|
const (
|
|
ImMessageContentText = "text"
|
|
ImMessageContentImage = "image"
|
|
ImMessageContentVideo = "video"
|
|
ImMessageContentAudio = "audio"
|
|
ImMessageContentVoice = "voice"
|
|
ImMessageContentFile = "file"
|
|
ImMessageContentCard = "card"
|
|
ImMessageContentSystem = "system"
|
|
|
|
ImMessageStatusNormal = "normal"
|
|
ImMessageStatusDeleted = "deleted"
|
|
ImMessageStatusRecalled = "recalled"
|
|
ImMessageStatusBlocked = "blocked"
|
|
ImMessageStatusHidden = "hidden"
|
|
)
|
|
|
|
var ImMessageContentTypeOptions = []*model.Option{
|
|
dict.GenInfoOption(ImMessageContentText, "文本"),
|
|
dict.GenPrimaryOption(ImMessageContentImage, "图片"),
|
|
dict.GenPrimaryOption(ImMessageContentVideo, "视频"),
|
|
dict.GenPrimaryOption(ImMessageContentAudio, "语音"),
|
|
dict.GenPrimaryOption(ImMessageContentVoice, "语音"),
|
|
dict.GenDefaultOption(ImMessageContentFile, "文件"),
|
|
dict.GenDefaultOption(ImMessageContentCard, "名片"),
|
|
dict.GenWarningOption(ImMessageContentSystem, "系统"),
|
|
}
|
|
|
|
var ImMessageStatusOptions = []*model.Option{
|
|
dict.GenSuccessOption(ImMessageStatusNormal, "正常"),
|
|
dict.GenErrorOption(ImMessageStatusDeleted, "后台删除"),
|
|
dict.GenWarningOption(ImMessageStatusRecalled, "用户撤回"),
|
|
dict.GenErrorOption(ImMessageStatusBlocked, "风控拦截"),
|
|
dict.GenWarningOption(ImMessageStatusHidden, "已隐藏"),
|
|
}
|
|
|
|
var ImLoginTypeOptions = []*model.Option{
|
|
dict.GenPrimaryOption("password", "密码"),
|
|
dict.GenPrimaryOption("sms_code", "短信验证码"),
|
|
dict.GenInfoOption("sso", "单点登录"),
|
|
dict.GenInfoOption("qr_code", "二维码"),
|
|
dict.GenDefaultOption("token_refresh", "令牌刷新"),
|
|
}
|
|
|
|
var ImLoginEventTypeOptions = []*model.Option{
|
|
dict.GenSuccessOption("login", "登录"),
|
|
dict.GenInfoOption("refresh", "刷新会话"),
|
|
dict.GenDefaultOption("logout", "主动退出"),
|
|
dict.GenWarningOption("kicked", "被踢下线"),
|
|
dict.GenWarningOption("session_expired", "会话过期"),
|
|
}
|
|
|
|
var ImClientPlatformOptions = []*model.Option{
|
|
dict.GenPrimaryOption("ios", "iOS"),
|
|
dict.GenSuccessOption("android", "Android"),
|
|
dict.GenInfoOption("web", "Web"),
|
|
dict.GenDefaultOption("desktop", "桌面端"),
|
|
dict.GenDefaultOption("unknown", "未知"),
|
|
}
|
|
|
|
var ImLoginFailureTypeOptions = []*model.Option{
|
|
dict.GenErrorOption("password_error", "密码错误"),
|
|
dict.GenErrorOption("code_error", "验证码错误"),
|
|
dict.GenWarningOption("account_not_found", "账号不存在"),
|
|
dict.GenErrorOption("account_disabled", "账号已禁用"),
|
|
dict.GenWarningOption("rate_limited", "访问频率受限"),
|
|
dict.GenErrorOption("risk_blocked", "风控拦截"),
|
|
}
|
|
|
|
func init() {
|
|
dict.RegisterEnums("ImMessageContentTypeOptions", "IM消息内容类型选项", ImMessageContentTypeOptions)
|
|
dict.RegisterEnums("ImMessageStatusOptions", "IM消息状态选项", ImMessageStatusOptions)
|
|
dict.RegisterEnums("ImLoginTypeOptions", "IM登录方式选项", ImLoginTypeOptions)
|
|
dict.RegisterEnums("ImLoginEventTypeOptions", "IM登录事件选项", ImLoginEventTypeOptions)
|
|
dict.RegisterEnums("ImClientPlatformOptions", "IM客户端平台选项", ImClientPlatformOptions)
|
|
dict.RegisterEnums("ImLoginFailureTypeOptions", "IM登录失败类型选项", ImLoginFailureTypeOptions)
|
|
}
|