consts

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CHANNEL_LOGIN          = "login"
	CHANNEL_REGISTER       = "register"
	CHANNEL_FORGET_ACCOUNT = "forget_account"
	CHANNEL_CHANGE_MOBILE  = "change_mobile"
	CHANNEL_CHANGE_EMAIL   = "change_email"
)
View Source
const (
	ContactStatusNormal = 1
	ContactStatusDelete = 0
)
View Source
const (
	GroupApplyStatusWait   = 1 // 待处理
	GroupApplyStatusPass   = 2 // 通过
	GroupApplyStatusRefuse = 3 // 拒绝
)
View Source
const (
	GroupMemberQuitStatusYes = 1
	GroupMemberQuitStatusNo  = 0

	GroupMemberMuteStatusYes = 1
	GroupMemberMuteStatusNo  = 0
)
View Source
const (
	RootStatusDeleted = -1
	RootStatusNormal  = 0
	RootStatusDisable = 1
)
View Source
const (
	TalkRecordTalkTypePrivate = 1
	TalkRecordTalkTypeGroup   = 2
)
View Source
const (
	VoteAnswerModeSingleChoice   = 0
	VoteAnswerModeMultipleChoice = 1
)
View Source
const (
	LOCK_LOGIN           = "lock:login:account:%s"
	LOCK_CHANGE_PASSWORD = "lock:change_password:user:%d"
	LOCK_CODE            = "lock:code:%s"
)
View Source
const (
	MediaFileImage = 1 // 图片文件
	MediaFileVideo = 2 // 视频文件
	MediaFileAudio = 3 // 音频文件
	MediaFileOther = 4 // 其它文件
)
View Source
const (
	FileDriveLocal = 1
	FileDriveCos   = 2
)

文件系统相关

View Source
const (
	// 默认渠道消息订阅
	ImTopicChat        = "im:message:chat:all"
	ImTopicChatPrivate = "im:message:chat:%s"
)
View Source
const (
	MsgTypeText     = "text"     // 文本消息
	MsgTypeCode     = "code"     // 代码消息
	MsgTypeImage    = "image"    // 图片文件
	MsgTypeVoice    = "voice"    // 语音文件
	MsgTypeVideo    = "video"    // 视频文件
	MsgTypeFile     = "file"     // 其它文件
	MsgTypeForward  = "forward"  // 转发消息
	MsgTypeVote     = "vote"     // 投票消息
	MsgTypeMixed    = "mixed"    // 图文消息
	MsgTypeEmoticon = "emoticon" // 表情消息
	MsgTypeCard     = "card"     // 名片消息
	MsgTypeLocation = "location" // 位置消息
)
View Source
const (
	MsgSysText                   = "sys_text"                      // 系统文本消息
	MsgSysGroupCreate            = "sys_group_create"              // 创建群聊消息
	MsgSysGroupMemberJoin        = "sys_group_member_join"         // 加入群聊消息
	MsgSysGroupMemberQuit        = "sys_group_member_quit"         // 群成员退出群消息
	MsgSysGroupMemberKicked      = "sys_group_member_kicked"       // 踢出群成员消息
	MsgSysGroupMessageRevoke     = "sys_group_message_revoke"      // 管理员撤回成员消息
	MsgSysGroupDismissed         = "sys_group_dismissed"           // 群解散
	MsgSysGroupMuted             = "sys_group_muted"               // 群禁言
	MsgSysGroupCancelMuted       = "sys_group_cancel_muted"        // 群解除禁言
	MsgSysGroupMemberMuted       = "sys_group_member_muted"        // 群成员禁言
	MsgSysGroupMemberCancelMuted = "sys_group_member_cancel_muted" // 群成员解除禁言
	MsgSysGroupNotice            = "sys_group_notice"              // 编辑群公告
	MsgSysGroupTransfer          = "sys_group_transfer"            // 变更群主
)
View Source
const (
	ChatPrivateMode = 1 // 私聊模式
	ChatGroupMode   = 2 // 群聊模式
)

聊天模式

View Source
const (
	SubEventImMessage         = "sub.im.message"          // 对话消息通知
	SubEventImMessageKeyboard = "sub.im.message.keyboard" // 键盘输入事件通知
	SubEventImMessageRevoke   = "sub.im.message.revoke"   // 聊天消息撤销通知
	SubEventImMessageRead     = "sub.im.message.read"     // 对话消息读事件
	SubEventContactStatus     = "sub.im.contact.status"   // 用户在线状态通知
	SubEventContactApply      = "sub.im.contact.apply"    // 好友申请消息通知
	SubEventGroupJoin         = "sub.im.group.join"       // 邀请加入群聊通知
	SubEventGroupApply        = "sub.im.group.apply"      // 入群申请通知

	PushEventImMessage         = "im.message"          // 对话消息推送
	PushEventImMessageKeyboard = "im.message.keyboard" // 键盘输入事件推送
	PushEventImMessageRead     = "im.message.read"     // 对话消息读事件推送
	PushEventImMessageRevoke   = "im.message.revoke"   // 聊天消息撤销推送
	PushEventContactApply      = "im.contact.apply"    // 好友申请消息推送
	PushEventContactStatus     = "im.contact.status"   // 用户在线状态推送
	PushEventGroupApply        = "im.group.apply"      // 用户在线状态推送
)
View Source
const (
	ChatMsgTypeText     = 1  // 文本消息
	ChatMsgTypeCode     = 2  // 代码消息
	ChatMsgTypeImage    = 3  // 图片文件
	ChatMsgTypeAudio    = 4  // 语音文件
	ChatMsgTypeVideo    = 5  // 视频文件
	ChatMsgTypeFile     = 6  // 其它文件
	ChatMsgTypeLocation = 7  // 位置消息
	ChatMsgTypeCard     = 8  // 名片消息
	ChatMsgTypeForward  = 9  // 转发消息
	ChatMsgTypeLogin    = 10 // 登录消息
	ChatMsgTypeVote     = 11 // 投票消息
	ChatMsgTypeMixed    = 12 // 图文消息

	ChatMsgSysText                   = 1000 // 系统文本消息
	ChatMsgSysGroupCreate            = 1101 // 创建群聊消息
	ChatMsgSysGroupMemberJoin        = 1102 // 加入群聊消息
	ChatMsgSysGroupMemberQuit        = 1103 // 群成员退出群消息
	ChatMsgSysGroupMemberKicked      = 1104 // 踢出群成员消息
	ChatMsgSysGroupMessageRevoke     = 1105 // 管理员撤回成员消息
	ChatMsgSysGroupDismissed         = 1106 // 群解散
	ChatMsgSysGroupMuted             = 1107 // 群禁言
	ChatMsgSysGroupCancelMuted       = 1108 // 群解除禁言
	ChatMsgSysGroupMemberMuted       = 1109 // 群成员禁言
	ChatMsgSysGroupMemberCancelMuted = 1110 // 群成员解除禁言
	ChatMsgSysGroupNotice            = 1111 // 编辑群公告
	ChatMsgSysGroupTransfer          = 1113 // 变更群主
)

IM消息类型 1-999 自定义消息类型 1000-1999 系统消息类型

View Source
const (
	EventChatTalkMessage    = 101001 // IM对话消息事件
	EventChatTalkKeyboard   = 101002 // IM键盘输入消息事件
	EventChatTalkRevoke     = 101002 // IM消息撤回事件
	EventChatOnlineStatus   = 101003 // IM在线状态事件
	EventChatContactApply   = 101004 // IM好友申请事件
	EventChatGroupJoinApply = 101005 // IM群加入申请事件
)
View Source
const (
	USER_TIME_LOGIN_KEY = "user:time:login:%s:%d"
	FIRST_TIME_FIELD    = "first_time"
	LAST_TIME_FIELD     = "last_time"
)
View Source
const (
	UID_USAGE_KEY      = "api:%d:usage:%s"
	USAGE_COUNT_FIELD  = "usage_count"
	USED_TOKENS_FIELD  = "used_tokens"
	TOTAL_TOKENS_FIELD = "total_tokens"

	INVITE_CODE_COOKIE = "invite_code"
)
View Source
const (
	GroupMemberMaxNum = 200 // 最大成员数量
)
View Source
const (
	// 默认分组
	ImChannelChat = "chat"
)

IM 渠道分组(用于业务划分, 业务间相互隔离)

View Source
const (
	MsgNoticeLogin = "login" // 登录消息
)

Variables

View Source
var CHANNEL_MAP = map[string]string{
	CHANNEL_LOGIN:          "登录",
	CHANNEL_REGISTER:       "注册",
	CHANNEL_FORGET_ACCOUNT: "找回密码",
	CHANNEL_CHANGE_EMAIL:   "换绑邮箱",
	CHANNEL_CHANGE_MOBILE:  "换绑手机号",
}
View Source
var ChatMsgTypeMapping = map[int]string{
	ChatMsgTypeImage:                 "[图片消息]",
	ChatMsgTypeAudio:                 "[语音消息]",
	ChatMsgTypeVideo:                 "[视频消息]",
	ChatMsgTypeFile:                  "[文件消息]",
	ChatMsgTypeLocation:              "[位置消息]",
	ChatMsgTypeCard:                  "[名片消息]",
	ChatMsgTypeForward:               "[转发消息]",
	ChatMsgTypeLogin:                 "[登录消息]",
	ChatMsgTypeVote:                  "[投票消息]",
	ChatMsgTypeCode:                  "[代码消息]",
	ChatMsgTypeMixed:                 "[图文消息]",
	ChatMsgSysText:                   "[系统消息]",
	ChatMsgSysGroupCreate:            "[创建群消息]",
	ChatMsgSysGroupMemberJoin:        "[加入群消息]",
	ChatMsgSysGroupMemberQuit:        "[退出群消息]",
	ChatMsgSysGroupMemberKicked:      "[踢出群消息]",
	ChatMsgSysGroupMessageRevoke:     "[撤回消息]",
	ChatMsgSysGroupDismissed:         "[群解散消息]",
	ChatMsgSysGroupMuted:             "[群禁言消息]",
	ChatMsgSysGroupCancelMuted:       "[群解除禁言消息]",
	ChatMsgSysGroupMemberMuted:       "[群成员禁言消息]",
	ChatMsgSysGroupMemberCancelMuted: "[群成员解除禁言消息]",
	ChatMsgSysGroupNotice:            "[群公告]",
	ChatMsgSysGroupTransfer:          "[群主变更]",
}

Functions

func FileDriveMode

func FileDriveMode(drive string) int

func GetMediaType

func GetMediaType(ext string) int

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL