Merge pull request #295 from tobycroft/master

notice类消息,新增source字段
This commit is contained in:
白池 2024-03-15 00:34:42 +08:00 committed by GitHub
commit be58c368e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 45 additions and 30 deletions

View File

@ -21,6 +21,7 @@ import moe.fuqiuluo.shamrock.remote.service.data.push.MsgSubType
import moe.fuqiuluo.shamrock.remote.service.data.push.MsgType import moe.fuqiuluo.shamrock.remote.service.data.push.MsgType
import moe.fuqiuluo.shamrock.remote.service.data.push.PostType import moe.fuqiuluo.shamrock.remote.service.data.push.PostType
import moe.fuqiuluo.shamrock.remote.service.data.push.MessageEvent import moe.fuqiuluo.shamrock.remote.service.data.push.MessageEvent
import moe.fuqiuluo.shamrock.remote.service.data.push.MessageSource
import moe.fuqiuluo.shamrock.remote.service.data.push.MessageTempSource import moe.fuqiuluo.shamrock.remote.service.data.push.MessageTempSource
import moe.fuqiuluo.shamrock.remote.service.data.push.NoticeEvent import moe.fuqiuluo.shamrock.remote.service.data.push.NoticeEvent
import moe.fuqiuluo.shamrock.remote.service.data.push.NoticeSubType import moe.fuqiuluo.shamrock.remote.service.data.push.NoticeSubType
@ -235,7 +236,8 @@ internal object GlobalEventTransmitter: BaseSvc() {
url = url, url = url,
subId = fileSubId, subId = fileSubId,
expire = expireTime expire = expireTime
) ),
messageSource =MessageSource.Private
)) ))
return true return true
} }
@ -258,16 +260,17 @@ internal object GlobalEventTransmitter: BaseSvc() {
selfId = app.longAccountUin, selfId = app.longAccountUin,
postType = PostType.Notice, postType = PostType.Notice,
type = NoticeType.GroupUpload, type = NoticeType.GroupUpload,
groupId = groupId,
operatorId = userId, operatorId = userId,
userId = userId, userId = userId,
groupId = groupId,
file = GroupFileMsg( file = GroupFileMsg(
id = uuid, id = uuid,
name = fileName, name = fileName,
size = fileSize, size = fileSize,
busid = bizId.toLong(), busid = bizId.toLong(),
url = url url = url
) ),
messageSource =MessageSource.Private
)) ))
return true return true
} }
@ -284,13 +287,14 @@ internal object GlobalEventTransmitter: BaseSvc() {
postType = PostType.Notice, postType = PostType.Notice,
type = NoticeType.Notify, type = NoticeType.Notify,
subType = NoticeSubType.Sign, subType = NoticeSubType.Sign,
userId = target,
groupId = groupCode, groupId = groupCode,
userId = target,
target = target, target = target,
signDetail = SignDetail( signDetail = SignDetail(
rankImg = rankImg, rankImg = rankImg,
action = action action = action
) ),
messageSource =MessageSource.Group
)) ))
return true return true
} }
@ -306,6 +310,7 @@ internal object GlobalEventTransmitter: BaseSvc() {
userId = operation, userId = operation,
groupId = groupCode, groupId = groupCode,
target = target, target = target,
messageSource =MessageSource.Group,
pokeDetail = PokeDetail( pokeDetail = PokeDetail(
action = action, action = action,
suffix = suffix, suffix = suffix,
@ -331,14 +336,15 @@ internal object GlobalEventTransmitter: BaseSvc() {
postType = PostType.Notice, postType = PostType.Notice,
type = noticeType, type = noticeType,
subType = noticeSubType, subType = noticeSubType,
groupId = groupCode,
operatorId = operator, operatorId = operator,
operatorUid = operatorUid,
userId = target, userId = target,
userUid = targetUid,
senderId = operator, senderId = operator,
target = target, target = target,
groupId = groupCode,
targetUid = targetUid, targetUid = targetUid,
operatorUid = operatorUid, messageSource =MessageSource.Group,
userUid = targetUid
)) ))
return true return true
} }
@ -356,12 +362,13 @@ internal object GlobalEventTransmitter: BaseSvc() {
postType = PostType.Notice, postType = PostType.Notice,
type = NoticeType.GroupAdminChange, type = NoticeType.GroupAdminChange,
subType = if (setAdmin) NoticeSubType.Set else NoticeSubType.UnSet, subType = if (setAdmin) NoticeSubType.Set else NoticeSubType.UnSet,
groupId = groupCode,
operatorId = 0, operatorId = 0,
userId = target, userId = target,
userUid = targetUid, userUid = targetUid,
target = target, target = target,
targetUid = targetUid, targetUid = targetUid,
groupId = groupCode messageSource =MessageSource.Group,
)) ))
return true return true
} }
@ -382,14 +389,15 @@ internal object GlobalEventTransmitter: BaseSvc() {
postType = PostType.Notice, postType = PostType.Notice,
type = NoticeType.GroupBan, type = NoticeType.GroupBan,
subType = subType, subType = subType,
groupId = groupCode,
operatorId = operator, operatorId = operator,
operatorUid = operatorUid,
userId = target, userId = target,
senderId = operator, senderId = operator,
target = target,
groupId = groupCode,
duration = duration, duration = duration,
operatorUid = operatorUid, target = target,
targetUid = targetUid targetUid = targetUid,
messageSource =MessageSource.Group,
)) ))
return true return true
} }
@ -407,11 +415,12 @@ internal object GlobalEventTransmitter: BaseSvc() {
selfId = app.longAccountUin, selfId = app.longAccountUin,
postType = PostType.Notice, postType = PostType.Notice,
type = NoticeType.GroupRecall, type = NoticeType.GroupRecall,
groupId = groupCode,
operatorId = operator, operatorId = operator,
userId = target, userId = target,
msgId = msgHash, msgId = msgHash,
tip = tipText, tip = tipText,
groupId = groupCode messageSource =MessageSource.Group,
)) ))
return true return true
} }
@ -428,10 +437,11 @@ internal object GlobalEventTransmitter: BaseSvc() {
selfId = app.longAccountUin, selfId = app.longAccountUin,
postType = PostType.Notice, postType = PostType.Notice,
type = NoticeType.GroupCard, type = NoticeType.GroupCard,
groupId = groupId,
userId = targetId, userId = targetId,
cardNew = newCard, cardNew = newCard,
cardOld = oldCard, cardOld = oldCard,
groupId = groupId messageSource =MessageSource.Group,
)) ))
return true return true
} }
@ -447,10 +457,11 @@ internal object GlobalEventTransmitter: BaseSvc() {
selfId = app.longAccountUin, selfId = app.longAccountUin,
postType = PostType.Notice, postType = PostType.Notice,
type = NoticeType.Notify, type = NoticeType.Notify,
userId = targetId, subType = NoticeSubType.Title,
groupId = groupId, groupId = groupId,
userId = targetId,
title = title, title = title,
subType = NoticeSubType.Title messageSource =MessageSource.Group,
)) ))
return true return true
} }
@ -468,11 +479,12 @@ internal object GlobalEventTransmitter: BaseSvc() {
selfId = app.longAccountUin, selfId = app.longAccountUin,
postType = PostType.Notice, postType = PostType.Notice,
type = NoticeType.Essence, type = NoticeType.Essence,
senderId = senderUin, subType = subType,
groupId = groupId, groupId = groupId,
operatorId = operatorUin, operatorId = operatorUin,
senderId = senderUin,
msgId = msgId, msgId = msgId,
subType = subType messageSource =MessageSource.Group,
)) ))
return true return true
} }
@ -497,7 +509,8 @@ internal object GlobalEventTransmitter: BaseSvc() {
actionImg = actionImg, actionImg = actionImg,
action = action, action = action,
suffix = suffix suffix = suffix
) ),
messageSource =MessageSource.Private
)) ))
return true return true
} }
@ -511,7 +524,8 @@ internal object GlobalEventTransmitter: BaseSvc() {
operatorId = operation, operatorId = operation,
userId = operation, userId = operation,
msgId = msgHashId, msgId = msgHashId,
tip = tipText tip = tipText,
messageSource =MessageSource.Private,
)) ))
return true return true
} }

View File

@ -27,27 +27,20 @@ internal enum class RequestType {
@Serializable @Serializable
internal enum class NoticeSubType { internal enum class NoticeSubType {
@SerialName("none") None, @SerialName("none") None,
@SerialName("ban") Ban, @SerialName("ban") Ban,
@SerialName("lift_ban") LiftBan, @SerialName("lift_ban") LiftBan,
@SerialName("set") Set, @SerialName("set") Set,
@SerialName("unset") UnSet, @SerialName("unset") UnSet,
@SerialName("add") Add, @SerialName("add") Add,
@SerialName("invite") Invite, @SerialName("invite") Invite,
@SerialName("approve") Approve, @SerialName("approve") Approve,
@SerialName("leave") Leave, @SerialName("leave") Leave,
@SerialName("kick") Kick, @SerialName("kick") Kick,
@SerialName("kick_me") KickMe, @SerialName("kick_me") KickMe,
@SerialName("poke") Poke, @SerialName("poke") Poke,
@SerialName("sign") Sign, @SerialName("sign") Sign,
@SerialName("title") Title, @SerialName("title") Title,
@SerialName("delete") Delete, @SerialName("delete") Delete,
} }
@Serializable @Serializable
@ -57,6 +50,13 @@ internal enum class RequestSubType {
@SerialName("invite") Invite, @SerialName("invite") Invite,
} }
@Serializable
internal enum class MessageSource {
@SerialName("group") Group,
@SerialName("private") Private,
}
/** /**
* 不要使用继承的方式实现通用字段那样会很难维护 * 不要使用继承的方式实现通用字段那样会很难维护
*/ */
@ -97,6 +97,7 @@ internal data class NoticeEvent(
// 群打卡 // 群打卡
@SerialName("sign_detail") val signDetail: SignDetail? = null, @SerialName("sign_detail") val signDetail: SignDetail? = null,
@SerialName("source") val messageSource: MessageSource? = null,
) )
@ -138,7 +139,7 @@ internal data class PrivateFileMsg(
) )
@Serializable @Serializable
internal data class PokeDetail ( internal data class PokeDetail(
val action: String? = "戳了戳", val action: String? = "戳了戳",
val suffix: String? = "", val suffix: String? = "",
@SerialName("action_img_url") @SerialName("action_img_url")
@ -146,7 +147,7 @@ internal data class PokeDetail (
) )
@Serializable @Serializable
internal data class SignDetail ( internal data class SignDetail(
val action: String? = "今日第1个打卡", val action: String? = "今日第1个打卡",
@SerialName("rank_img") @SerialName("rank_img")
val rankImg: String? = "", val rankImg: String? = "",