service/dbstruct/moment.go

27 lines
1.2 KiB
Go
Raw Normal View History

2023-12-21 22:17:40 +08:00
package dbstruct
2024-01-13 00:32:19 +08:00
import "service/bizcommon/util"
2023-12-21 22:17:40 +08:00
type Moment struct {
Id *int64 `json:"id" bson:"_id"` // 用户动态表id
Mid *int64 `json:"mid" bson:"mid"` // 用户id
Status *int64 `json:"status" bson:"status"` // 动态状态0-仅自己可见1-仅朋友圈可见2-公开
Text *string `json:"text" bson:"text"` // 动态文字内容
ThumbsUpNum *int64 `json:"thumbs_up_num" bson:"thumbs_up_num"` // 点赞次数
Ct *int64 `json:"ct" bson:"ct"` // 创建时间
Ut *int64 `json:"ut" bson:"ut"` // 更新时间
DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记
MediaComp *MediaComponent `json:"media_component" bson:"media_component"` // 媒体组件
}
2024-01-13 00:32:19 +08:00
// 文字和媒体组件不能同时为空
func (p *Moment) IsEmpty() bool {
if p == nil {
return true
}
if p.Mid == nil || p.Status == nil {
return true
}
return (p.Text == nil || util.DerefString(p.Text) == "") && p.MediaComp == nil
}