chat.go 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. package msg
  2. import "leafstalk/covenant/model"
  3. // GetChatInfo 获取聊天数据
  4. type GetChatInfo struct {
  5. PlayerId int64 `json:"userId"`
  6. }
  7. type ResponseGetChatInfo struct {
  8. ErrCode int `json:"errCode"`
  9. Msg string `json:"msg,omitempty"`
  10. Data *GetChatInfoData `json:"data"`
  11. }
  12. type GetChatInfoData struct {
  13. ChatFrames map[int64]struct{} `json:"chatFrams"` // 聊天框
  14. WearFrame int64 `json:"wearFrame"` //当前聊天框Id
  15. }
  16. // // EmojiUnlock 表情解锁
  17. // type EmojiUnlock struct {
  18. // PlayerId int64 `json:"userId"`
  19. // EmojiId int64 `json:"emojiId"` //表情Id
  20. // }
  21. // type EmojiUnlockData struct {
  22. // EmojiId int64 `json:"emojiId"` //表情Id
  23. // Cost map[int64]int64 `json:"cost"` //消耗
  24. // }
  25. // type ResponseEmojiUnlock struct {
  26. // ErrCode int `json:"errCode"`
  27. // Msg string `json:"msg,omitempty"`
  28. // Data *EmojiUnlockData `json:"data"`
  29. // }
  30. // // 材料消耗
  31. // type EmojiUnlockIs struct {
  32. // PlayerId int64 `json:"playerId"`
  33. // Cost map[int64]int64 `json:"cost"` //消耗
  34. // }
  35. // SendChat 发送聊天
  36. type SendChat struct {
  37. PlayerId int64 `json:"userId"`
  38. ChatInfo *model.ChatContent `json:"sendChatInfo"` //新聊天信息
  39. }
  40. // 聊天数据
  41. // type SendChatData struct {
  42. // NewChat *model.ChatContent `json:"newChat"` // 一条新的聊天内容
  43. // }
  44. type ResponseSendChat struct {
  45. ErrCode int `json:"errCode"`
  46. Msg string `json:"msg,omitempty"`
  47. Data *model.ChatContent `json:"data"`
  48. }
  49. type NewChatNotify struct {
  50. ErrCode int `json:"errCode"`
  51. Msg string `json:"msg,omitempty"`
  52. Data *model.ChatContent `json:"data"`
  53. }
  54. // GetChatChannel 获取频道聊天
  55. type GetChatChannel struct {
  56. PlayerId int64 `json:"userId"`
  57. ChatType string `json:"chatType"` // 聊天类型
  58. ReceiverId int64 `json:"receiverId"` // 接收者Id(私聊)
  59. CreateTime int64 `json:"createTime"` // 0: 表示全部; 大于0:表示最后一条消息时间(毫秒)
  60. }
  61. // type ChannelInfoShow struct {
  62. // ChatType string `json:"chatType"` // 聊天类型
  63. // Content []*model.ChatContent `json:"content"` // 频道内容
  64. // }
  65. type ResponseGetChatChannel struct {
  66. ErrCode int `json:"errCode"`
  67. Msg string `json:"msg,omitempty"`
  68. Data *ChatChannelData `json:"data"`
  69. }
  70. type ChatChannelData struct {
  71. ChatType string `json:"chatType"` // 聊天类型
  72. ReceiverId int64 `json:"receiverId"` // 接收者Id(私聊)
  73. Contents []*model.ChatContent `json:"content"` // 频道内容
  74. }
  75. // DelPrivateChannel 删除私聊
  76. type DelPrivateChannel struct {
  77. PlayerId int64 `json:"userId"`
  78. ReceiverId int64 `json:"receiverId"`
  79. }
  80. type ResponseDelPrivateChannel struct {
  81. ErrCode int `json:"errCode"`
  82. Msg string `json:"msg,omitempty"`
  83. Data int64 `json:"data"`
  84. }
  85. // GetChatFriends 获取私聊好友列表
  86. type GetChatFriends struct {
  87. PlayerId int64 `json:"userId"`
  88. }
  89. type ResponseGetChatFriends struct {
  90. ErrCode int `json:"errCode"`
  91. Msg string `json:"msg,omitempty"`
  92. Data map[int64]*ChatFriend `json:"data"`
  93. }
  94. type ChatFriend struct {
  95. PlayerId int64 `json:"userId"`
  96. Name string `json:"name"`
  97. HeadId int64 `json:"headId"`
  98. FrameId int64 `json:"frameId"`
  99. Level int64 `json:"level"`
  100. LastMsgTime int64 `json:"lastMsgTime"` // 最后一条消息的产生时间
  101. }
  102. type ChatFriendList []*ChatFriend
  103. func (m ChatFriendList) Len() int { return len(m) }
  104. func (m ChatFriendList) Swap(i, j int) { m[i], m[j] = m[j], m[i] }
  105. func (m ChatFriendList) Less(i, j int) bool { return m[i].LastMsgTime > m[j].LastMsgTime }
  106. // 选择聊天框
  107. type SelectChatFrame struct {
  108. PlayerId int64 `json:"userId"`
  109. FrameId int64 `json:"frameId"` //聊天框Id
  110. }
  111. type ResponseSelectChatFrame struct {
  112. ErrCode int `json:"errCode"`
  113. Msg string `json:"msg,omitempty"`
  114. Data int64 `json:"data"`
  115. }