83 lines
3.4 KiB
Go
83 lines
3.4 KiB
Go
package cmtmod
|
|
|
|
import (
|
|
"91porn-server/models/commod"
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
"time"
|
|
)
|
|
|
|
type WebCmtRespList struct {
|
|
ID ObjectID `json:"id"` // 全局唯一ID
|
|
ObjID ObjectID `json:"objID"` // 评论对象的ID
|
|
UserID uint64 `json:"userID"` // 发表评论的 用户ID
|
|
LikeCount int `json:"likeCount"` // 点赞数
|
|
Content string `json:"content"` // 评论内容
|
|
Level int `json:"level"` // 评论层级 1:一级评论 2:二级评论
|
|
Status int `json:"status"` // 评论状态 1:通过审核 2:未审核 3:被自动过滤
|
|
IsDelete bool `json:"isDelete"` // true:已删除 false:未删除
|
|
IsBaned bool `json:"isBaned"` // true:已禁言 false:未禁言
|
|
IsGodComment bool `json:"isGodComment"` // 是否是神评论
|
|
IsRobot bool `bson:"isRobot"` // 是否是机器人
|
|
Portrait string `json:"portrait"` // 用户头像
|
|
Name string `json:"name"` // 用户昵称
|
|
LinkStr string `json:"linkStr"` // 跳转配置
|
|
CreatedAt time.Time `json:"createdAt"` // 评论发表时间
|
|
HasLocked bool `json:"hasLocked"` // 用户是否封禁
|
|
IsAdvertiser bool `json:"isAdvertiser"` // 是否是打广告用户
|
|
Image string `json:"image"` // 评论图片
|
|
}
|
|
|
|
type WebCmtListReqInfo struct {
|
|
VidID string `form:"vidID" json:"vidID" binding:"omitempty"` // 视频id
|
|
UID uint64 `form:"uid" json:"uid" binding:"omitempty"` // 用户id
|
|
Content string `form:"content" json:"content" binding:"omitempty"` // 搜索内容
|
|
IsRobot *bool `form:"isRobot" json:"isRobot"` // 是否机器人
|
|
IsAdvertiser *bool `form:"isAdvertiser" json:"isAdvertiser"` // 是否是打广告用户
|
|
Status *int `form:"status" bson:"status"` // 评论状态 1:通过审核 2:未审核 3:被自动过滤
|
|
Page commod.Page
|
|
}
|
|
|
|
type WebCmtDeleteReqInfo struct {
|
|
IDS []ObjectID `form:"ids" json:"ids" binding:"omitempty"`
|
|
UID uint64 `form:"uid" json:"uid" binding:"omitempty"`
|
|
Content string `form:"content" json:"content" binding:"omitempty"`
|
|
}
|
|
|
|
type WebCmtReqInfo struct {
|
|
ID ObjectID `form:"id" json:"id"`
|
|
}
|
|
|
|
type BatchPassReqInfo struct {
|
|
IDS []ObjectID `form:"ids" json:"ids"` // 评论IDS
|
|
Status int `form:"status" json:"status" binding:"required"` // 状态
|
|
}
|
|
|
|
type EditCond struct {
|
|
ID ObjectID `form:"id" json:"id"` // 评论ID
|
|
IsGodComment *bool `form:"isGodComment" json:"isGodComment"` // 是否神评论
|
|
LinkStr *string `form:"linkStr" json:"linkStr"` // 评论跳转链接
|
|
GodCommentAward bool `json:"-" form:"-"` // 是否需要给神评奖励
|
|
LikeCount *int `json:"likeCount" form:"likeCount"` // 点赞数
|
|
}
|
|
|
|
func (receiver *EditCond) Filter() bson.M {
|
|
return bson.M{"_id": receiver.ID}
|
|
}
|
|
|
|
func (receiver *EditCond) Update() bson.M {
|
|
var update = bson.M{}
|
|
if receiver.IsGodComment != nil {
|
|
update["isGodComment"] = receiver.IsGodComment
|
|
}
|
|
if receiver.GodCommentAward == true {
|
|
update["godCommentAward"] = true
|
|
}
|
|
if receiver.LinkStr != nil {
|
|
update["linkStr"] = receiver.LinkStr
|
|
}
|
|
if receiver.LikeCount != nil {
|
|
update["likeCount"] = receiver.LikeCount
|
|
}
|
|
return bson.M{"$set": update}
|
|
}
|