service/dbstruct/moment.go

41 lines
1.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package dbstruct
import "service/bizcommon/util"
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"` // 媒体组件
}
// 文字和媒体组件不能同时为空
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
}
func (p *Moment) GetMid() int64 {
if p != nil && p.Mid != nil {
return util.DerefInt64(p.Mid)
}
return 0
}
func (p *Moment) GetId() int64 {
if p != nil && p.Id != nil {
return util.DerefInt64(p.Id)
}
return 0
}