Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #295 from tobycroft/master
Browse files Browse the repository at this point in the history
notice类消息,新增source字段
  • Loading branch information
whitechi73 authored Mar 14, 2024
2 parents 1d035fa + d38777d commit be58c36
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.PostType
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.NoticeEvent
import moe.fuqiuluo.shamrock.remote.service.data.push.NoticeSubType
Expand Down Expand Up @@ -235,7 +236,8 @@ internal object GlobalEventTransmitter: BaseSvc() {
url = url,
subId = fileSubId,
expire = expireTime
)
),
messageSource =MessageSource.Private
))
return true
}
Expand All @@ -258,16 +260,17 @@ internal object GlobalEventTransmitter: BaseSvc() {
selfId = app.longAccountUin,
postType = PostType.Notice,
type = NoticeType.GroupUpload,
groupId = groupId,
operatorId = userId,
userId = userId,
groupId = groupId,
file = GroupFileMsg(
id = uuid,
name = fileName,
size = fileSize,
busid = bizId.toLong(),
url = url
)
),
messageSource =MessageSource.Private
))
return true
}
Expand All @@ -284,13 +287,14 @@ internal object GlobalEventTransmitter: BaseSvc() {
postType = PostType.Notice,
type = NoticeType.Notify,
subType = NoticeSubType.Sign,
userId = target,
groupId = groupCode,
userId = target,
target = target,
signDetail = SignDetail(
rankImg = rankImg,
action = action
)
),
messageSource =MessageSource.Group
))
return true
}
Expand All @@ -306,6 +310,7 @@ internal object GlobalEventTransmitter: BaseSvc() {
userId = operation,
groupId = groupCode,
target = target,
messageSource =MessageSource.Group,
pokeDetail = PokeDetail(
action = action,
suffix = suffix,
Expand All @@ -331,14 +336,15 @@ internal object GlobalEventTransmitter: BaseSvc() {
postType = PostType.Notice,
type = noticeType,
subType = noticeSubType,
groupId = groupCode,
operatorId = operator,
operatorUid = operatorUid,
userId = target,
userUid = targetUid,
senderId = operator,
target = target,
groupId = groupCode,
targetUid = targetUid,
operatorUid = operatorUid,
userUid = targetUid
messageSource =MessageSource.Group,
))
return true
}
Expand All @@ -356,12 +362,13 @@ internal object GlobalEventTransmitter: BaseSvc() {
postType = PostType.Notice,
type = NoticeType.GroupAdminChange,
subType = if (setAdmin) NoticeSubType.Set else NoticeSubType.UnSet,
groupId = groupCode,
operatorId = 0,
userId = target,
userUid = targetUid,
target = target,
targetUid = targetUid,
groupId = groupCode
messageSource =MessageSource.Group,
))
return true
}
Expand All @@ -382,14 +389,15 @@ internal object GlobalEventTransmitter: BaseSvc() {
postType = PostType.Notice,
type = NoticeType.GroupBan,
subType = subType,
groupId = groupCode,
operatorId = operator,
operatorUid = operatorUid,
userId = target,
senderId = operator,
target = target,
groupId = groupCode,
duration = duration,
operatorUid = operatorUid,
targetUid = targetUid
target = target,
targetUid = targetUid,
messageSource =MessageSource.Group,
))
return true
}
Expand All @@ -407,11 +415,12 @@ internal object GlobalEventTransmitter: BaseSvc() {
selfId = app.longAccountUin,
postType = PostType.Notice,
type = NoticeType.GroupRecall,
groupId = groupCode,
operatorId = operator,
userId = target,
msgId = msgHash,
tip = tipText,
groupId = groupCode
messageSource =MessageSource.Group,
))
return true
}
Expand All @@ -428,10 +437,11 @@ internal object GlobalEventTransmitter: BaseSvc() {
selfId = app.longAccountUin,
postType = PostType.Notice,
type = NoticeType.GroupCard,
groupId = groupId,
userId = targetId,
cardNew = newCard,
cardOld = oldCard,
groupId = groupId
messageSource =MessageSource.Group,
))
return true
}
Expand All @@ -447,10 +457,11 @@ internal object GlobalEventTransmitter: BaseSvc() {
selfId = app.longAccountUin,
postType = PostType.Notice,
type = NoticeType.Notify,
userId = targetId,
subType = NoticeSubType.Title,
groupId = groupId,
userId = targetId,
title = title,
subType = NoticeSubType.Title
messageSource =MessageSource.Group,
))
return true
}
Expand All @@ -468,11 +479,12 @@ internal object GlobalEventTransmitter: BaseSvc() {
selfId = app.longAccountUin,
postType = PostType.Notice,
type = NoticeType.Essence,
senderId = senderUin,
subType = subType,
groupId = groupId,
operatorId = operatorUin,
senderId = senderUin,
msgId = msgId,
subType = subType
messageSource =MessageSource.Group,
))
return true
}
Expand All @@ -497,7 +509,8 @@ internal object GlobalEventTransmitter: BaseSvc() {
actionImg = actionImg,
action = action,
suffix = suffix
)
),
messageSource =MessageSource.Private
))
return true
}
Expand All @@ -511,7 +524,8 @@ internal object GlobalEventTransmitter: BaseSvc() {
operatorId = operation,
userId = operation,
msgId = msgHashId,
tip = tipText
tip = tipText,
messageSource =MessageSource.Private,
))
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,20 @@ internal enum class RequestType {
@Serializable
internal enum class NoticeSubType {
@SerialName("none") None,

@SerialName("ban") Ban,
@SerialName("lift_ban") LiftBan,

@SerialName("set") Set,
@SerialName("unset") UnSet,

@SerialName("add") Add,
@SerialName("invite") Invite,
@SerialName("approve") Approve,
@SerialName("leave") Leave,
@SerialName("kick") Kick,
@SerialName("kick_me") KickMe,

@SerialName("poke") Poke,
@SerialName("sign") Sign,


@SerialName("title") Title,
@SerialName("delete") Delete,

}

@Serializable
Expand All @@ -57,6 +50,13 @@ internal enum class RequestSubType {
@SerialName("invite") Invite,
}

@Serializable
internal enum class MessageSource {
@SerialName("group") Group,

@SerialName("private") Private,
}

/**
* 不要使用继承的方式实现通用字段,那样会很难维护!
*/
Expand Down Expand Up @@ -97,6 +97,7 @@ internal data class NoticeEvent(

// 群打卡
@SerialName("sign_detail") val signDetail: SignDetail? = null,
@SerialName("source") val messageSource: MessageSource? = null,

)

Expand Down Expand Up @@ -138,15 +139,15 @@ internal data class PrivateFileMsg(
)

@Serializable
internal data class PokeDetail (
internal data class PokeDetail(
val action: String? = "戳了戳",
val suffix: String? = "",
@SerialName("action_img_url")
val actionImg: String? = "https://tianquan.gtimg.cn/nudgeaction/item/0/expression.jpg",
)

@Serializable
internal data class SignDetail (
internal data class SignDetail(
val action: String? = "今日第1个打卡",
@SerialName("rank_img")
val rankImg: String? = "",
Expand Down

0 comments on commit be58c36

Please sign in to comment.