From f0b384d73a21cb9ad1e6b75340358b5ec5caca4d Mon Sep 17 00:00:00 2001 From: Robin <7434053+warrior_of_light_robin@user.noreply.gitee.com> Date: Mon, 25 Nov 2024 15:40:22 +0800 Subject: [PATCH] 1 --- dbstruct/notification.go | 41 ++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/dbstruct/notification.go b/dbstruct/notification.go index 80da4928..e01c918f 100644 --- a/dbstruct/notification.go +++ b/dbstruct/notification.go @@ -5,22 +5,22 @@ import ( ) type Notification struct { - Id *int64 `json:"id" bson:"_id"` // 系统通知表id - SubMid *int64 `json:"sub_mid" bson:"sub_mid"` // 通知发送人mid - ObjType *int64 `json:"obj_type" bson:"obj_type"` // 通知接收人类型 - ObjMids []int64 `json:"obj_mids" bson:"obj_mids"` // 通知接收人mids - NType *int64 `json:"n_type" bson:"n_type"` // 消息类型 - NDesc *string `json:"n_desc" bson:"n_desc"` // 消息描述 - Message *string `json:"message" bson:"message"` // 消息内容 - Thumbnail *MediaComponent `json:"thumbnail" bson:"thumbnail"` // 缩略图 - LinkText *string `json:"link_text" bson:"link_text"` // 链接文案 - Action *string `json:"action" bson:"action"` // 行为 - Params *string `json:"params" bson:"params"` // 参数 - PushTime *int64 `json:"push_time" bson:"push_time"` // 推送时间 - Status *int64 `json:"status" bson:"status"` // 推送状态 - Ct *int64 `json:"ct" bson:"ct"` // 创建时间 - Ut *int64 `json:"ut" bson:"ut"` // 更新时间 - DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记 + Id *int64 `json:"id" bson:"_id"` // 系统通知表id + SubMid *int64 `json:"sub_mid" bson:"sub_mid"` // 通知发送人mid + ObjType *int64 `json:"obj_type" bson:"obj_type"` // 通知接收人类型 + ObjMids []int64 `json:"obj_mids" bson:"obj_mids"` // 通知接收人mids + NType *int64 `json:"n_type" bson:"n_type"` // 消息类型 + NDesc *string `json:"n_desc" bson:"n_desc"` // 消息描述 + Message *string `json:"message" bson:"message"` // 消息内容 + Title *string `json:"title" bson:"title"` // 主标题 + Thumbnail *MediaComponent `json:"thumbnail" bson:"thumbnail"` // 缩略图 + LinkText *string `json:"link_text" bson:"link_text"` // 链接文案 + HyperLinks []*NotifHyperlink `json:"hyperlinks" bson:"hyperlinks"` // 超链接数组 + PushTime *int64 `json:"push_time" bson:"push_time"` // 推送时间 + Status *int64 `json:"status" bson:"status"` // 推送状态 + Ct *int64 `json:"ct" bson:"ct"` // 创建时间 + Ut *int64 `json:"ut" bson:"ut"` // 更新时间 + DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记 } func (p *Notification) GetId() int64 { @@ -105,9 +105,14 @@ type NotifBuilder struct { ObjType int64 // 目标类型 LinkTextTemplateParams []any // 链接模板参数 Thumbnail *MediaComponent // 缩略图 - Action string // 行为 - Params string // 行为参数 + HyperLinks []*NotifHyperlink // 超链接数组 PushTime int64 // 推送时间 SetNid func(ctx *gin.Context, nid int64) error // nid存储函数,一般用于取消推送 GetNid func() int64 // nid访问器 } + +// 消息内超链接信息 +type NotifHyperlink struct { + Action *string `json:"action" bson:"action"` // 行为 + Params *string `json:"params" bson:"params"` // 参数 +}