first commit
This commit is contained in:
104
pkg/client/netease/MessageService.go
Normal file
104
pkg/client/netease/MessageService.go
Normal file
@ -0,0 +1,104 @@
|
||||
package Netease
|
||||
|
||||
const (
|
||||
// ChatroomCustomMessageTypePresentActivityMsg 聊天室打赏活动物品消息
|
||||
ChatroomCustomMessageTypePresentActivityMsg = "380"
|
||||
// ChatroomCustomMessageTypeFullScreenNoticeMsg 聊天室 全服通知动效
|
||||
ChatroomCustomMessageTypeFullScreenNoticeMsg = "381"
|
||||
)
|
||||
|
||||
const (
|
||||
//聊天室字体颜色 - 黄色
|
||||
CHATROOM_SYSTEM_MSG_COLOR_YELLOW = "#FFD700"
|
||||
//聊天室字体颜色 - 绿色
|
||||
CHATROOM_SYSTEM_MSG_COLOR_GREEN = "#8ADE4D"
|
||||
//聊天室字体颜色 - 系统栏
|
||||
CHATROOM_SYSTEM_MSG_COLOR_SYSTEM_BLUE = "#43EAE1"
|
||||
//聊天室字体颜色 - 紫色
|
||||
CHATROOM_SYSTEM_MSG_COLOR_PURPLE = "#E031FE"
|
||||
// 默认等级的背景颜色
|
||||
SKILL_LEVEL_DEFAULT_BG_COLOR = "#FFD700"
|
||||
//聊天室字体颜色 - 蓝色
|
||||
CHATROOM_SYSTEM_MSG_COLOR_BLUE = "#25C6FD"
|
||||
//聊天室字体颜色 - 青色
|
||||
CHATROOM_SYSTEM_MSG_COLOR_QING = "#00FFCC"
|
||||
//聊天室字体颜色 - 白色
|
||||
CHATROOM_SYSTEM_MSG_COLOR_WHITE = "#FFFFFF"
|
||||
)
|
||||
|
||||
type MessageService struct {
|
||||
}
|
||||
|
||||
type TextAndColor struct {
|
||||
Text string
|
||||
Color string
|
||||
}
|
||||
|
||||
// ChatroomFullScreenNoticeMsgBizData 聊天室活动全服飘屏通知
|
||||
type ChatroomFullScreenNoticeMsgBizData struct {
|
||||
ChatroomId string
|
||||
ContentIcon string
|
||||
ContentText string
|
||||
ContentTextColor string //内容字体颜色
|
||||
ContentBgColor string //背景颜色
|
||||
AnimationApngUrl string //加入播放礼物动效队列
|
||||
BgImgUrl string //背景图
|
||||
TextList []TextAndColor //文字颜色列表
|
||||
StayTime string //停留时长(秒)
|
||||
}
|
||||
|
||||
// ChatroomPresentActivityMsgBizData 聊天室打赏活动消息data数据结构
|
||||
type ChatroomPresentActivityMsgBizData struct {
|
||||
ChatroomId string
|
||||
FromUserId string
|
||||
FromNickName string
|
||||
FromAvatar string
|
||||
FromNickNameColor string //打赏人昵称颜色
|
||||
ActionText string //动作文本 :赠送一个盲盒给
|
||||
ActionTextColor string //动作文本颜色
|
||||
|
||||
ToNickName string
|
||||
ToNickNameColor string //被打赏人昵称颜色
|
||||
|
||||
PresentCount string //物品个数
|
||||
PresentGoodsName string
|
||||
PresentGoodsIcon string
|
||||
PresentGoodsNameColor string
|
||||
|
||||
ResultGoodsIcon string
|
||||
ComboHitCount string //连击次数
|
||||
AnimationApngUrl string //加入播放礼物动效队列 有的话显示播放动画
|
||||
AnimationFormat string //动画格式 SVGA APNG
|
||||
FillMode string //填充模式 1=左右 2=上下
|
||||
|
||||
IsViewFlyView string //是否显示飘屏view 有的话显示连击信息
|
||||
//显示到信息流
|
||||
TextList []TextAndColor //信息流文字颜色列表
|
||||
|
||||
}
|
||||
|
||||
// SendChatroomSystemMsgV2 发送聊天室系统消息 V2
|
||||
func (s *MessageService) SendChatroomSystemMsgV2(messageRoomId string, msgData ChatroomPresentActivityMsgBizData) (err error) {
|
||||
// 发打赏消息
|
||||
var service ImService
|
||||
attachModel := ChatRoomMsgAttach{}
|
||||
//消息类型
|
||||
typeCode := ChatroomCustomMessageTypePresentActivityMsg
|
||||
attachModel.TypeCode = typeCode
|
||||
attachModel.BizData = msgData
|
||||
err = service.SendCustomMsgToChatroomByChatroomManager(messageRoomId, attachModel)
|
||||
return
|
||||
}
|
||||
|
||||
// SendChatroomPresentActivityFullServiceMsg 发送聊天室活动全服
|
||||
func (s *MessageService) SendChatroomPresentActivityFullServiceMsg(messageRoomId string, msgData ChatroomFullScreenNoticeMsgBizData) (err error) {
|
||||
// 发打赏消息
|
||||
var service ImService
|
||||
attachModel := ChatRoomMsgAttach{}
|
||||
//消息类型
|
||||
typeCode := ChatroomCustomMessageTypeFullScreenNoticeMsg
|
||||
attachModel.TypeCode = typeCode
|
||||
attachModel.BizData = msgData
|
||||
err = service.SendCustomMsgToChatroomByChatroomManager(messageRoomId, attachModel)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user