service/dbstruct/notification.go

114 lines
4.7 KiB
Go
Raw Normal View History

2024-08-30 16:34:00 +08:00
package dbstruct
2024-11-07 17:05:13 +08:00
import (
"github.com/gin-gonic/gin"
)
2024-08-30 16:34:00 +08:00
type Notification struct {
Id *int64 `json:"id" bson:"_id"` // 系统通知表id
SubMid *int64 `json:"sub_mid" bson:"sub_mid"` // 通知发送人mid
2024-10-21 14:36:01 +08:00
ObjType *int64 `json:"obj_type" bson:"obj_type"` // 通知接收人类型
ObjMids []int64 `json:"obj_mids" bson:"obj_mids"` // 通知接收人mids
2024-08-30 16:34:00 +08:00
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"` // 链接文案
2024-09-11 15:44:49 +08:00
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"` // 推送状态
2024-08-30 16:34:00 +08:00
Ct *int64 `json:"ct" bson:"ct"` // 创建时间
Ut *int64 `json:"ut" bson:"ut"` // 更新时间
DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记
2024-09-02 12:52:49 +08:00
}
2024-08-30 16:34:00 +08:00
2024-10-21 14:36:01 +08:00
func (p *Notification) GetId() int64 {
if p != nil && p.Id != nil {
return *p.Id
}
return 0
2024-10-21 16:07:56 +08:00
}
func (p *Notification) GetObjType() int64 {
if p != nil && p.ObjType != nil {
return *p.ObjType
}
return 0
}
func (p *Notification) GetStatus() int64 {
if p != nil && p.Status != nil {
return *p.Status
}
return 0
2024-10-21 14:36:01 +08:00
}
func (p *Notification) GetPushTime() int64 {
if p != nil && p.PushTime != nil {
return *p.PushTime
}
return 0
}
2024-10-29 14:57:22 +08:00
func (p *Notification) GetNType() int64 {
if p != nil && p.NType != nil {
return *p.NType
}
return 0
}
2024-10-16 14:46:13 +08:00
type NotifBcst struct {
Id int64 `json:"id" bson:"_id"` // 通知广播表id
Nids []int64 `json:"nids" bson:"nids"` // 系统通知表ids
Vers int64 `json:"vers" bson:"vers"` // 通知广播表版本号
ObjType int64 `json:"obj_type" bson:"obj_type"` // 通知接收人类型0-所有主播1-所有个人
Ct int64 `json:"ct" bson:"ct"` // 创建时间
Ut int64 `json:"ut" bson:"ut"` // 更新时间
DelFlag int64 `json:"del_flag" bson:"del_flag"` // 删除标记
}
type NotifBcstVers struct {
Vers int64 `json:"vers" bson:"vers"` // 通知广播表版本号
}
type NotifBcstReceiveVers struct {
2024-10-16 15:32:12 +08:00
Vers int64 `json:"vers" bson:"vers"` // 通知广播接收表版本号
2024-10-16 14:46:13 +08:00
}
type NotifReceive struct {
Id int64 `json:"id" bson:"_id"` // 通知接收表id
ObjMid int64 `json:"obj_mid" bson:"obj_mid"` // 通知接收人mid
Nid int64 `json:"nid" bson:"nid"` // 系统通知表id
2024-10-29 14:57:22 +08:00
NType int64 `json:"n_type" bson:"n_type"` // 消息类型
2024-10-16 14:46:13 +08:00
Ct int64 `json:"ct" bson:"ct"` // 创建时间
Ut int64 `json:"ut" bson:"ut"` // 更新时间
DelFlag int64 `json:"del_flag" bson:"del_flag"` // 删除标记
2024-08-30 16:34:00 +08:00
}
2024-10-18 16:41:06 +08:00
type NotifReceivePull struct {
Id int64 `json:"id" bson:"_id"` // 通知接收拉取表id
ObjMid int64 `json:"obj_mid" bson:"obj_mid"` // 通知接收人mid
VersBefore int64 `json:"vers_before" bson:"vers_before"` // 此前版本号
VersAfter int64 `json:"vers_after" bson:"vers_after"` // 新版本号
Status int64 `json:"status" bson:"status"` // 状态
Desc string `json:"desc" bson:"desc"` // 描述
Ct int64 `json:"ct" bson:"ct"` // 创建时间
Ut int64 `json:"ut" bson:"ut"` // 更新时间
DelFlag int64 `json:"del_flag" bson:"del_flag"` // 删除标记
}
2024-11-04 18:26:51 +08:00
type NotifBuilder struct {
2024-11-07 17:05:13 +08:00
TemplateId int64 // 模板id
TemplateParams []any // 模板参数
ObjMids []int64 // 目标Mids
ObjType int64 // 目标类型
LinkTextTemplateParams []any // 链接模板参数
Thumbnail *MediaComponent // 缩略图
Action string // 行为
Params string // 行为参数
PushTime int64 // 推送时间
2024-11-08 11:17:47 +08:00
SetNid func(ctx *gin.Context, nid int64) error // nid存储函数一般用于取消推送
GetNid func() int64 // nid访问器
2024-11-04 18:26:51 +08:00
}