@@ -0,0 +1,149 @@
|
||||
package cmtmod
|
||||
|
||||
type ComicsTitlePullReq struct {
|
||||
PageNum int64 `form:"pageNum" json:"pageNum"`
|
||||
PageSize int64 `form:"pageSize" json:"pageSize"`
|
||||
TagId string `form:"tagId" json:"tagId"`
|
||||
}
|
||||
|
||||
type ComicsTitlePullResp struct {
|
||||
List []ComicsTitleInfo `json:"list"`
|
||||
}
|
||||
|
||||
type ComicsTitleInfo struct {
|
||||
Id string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
}
|
||||
|
||||
type ComicsTitlePushReq struct {
|
||||
TagId string `json:"tagId"`
|
||||
List []ComicsTitlePushInfo `json:"list"`
|
||||
}
|
||||
|
||||
type ComicsTitlePushInfo struct {
|
||||
Id string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
}
|
||||
|
||||
type ComicsTitlePushRes struct{}
|
||||
|
||||
type PullReq struct {
|
||||
AppId string `form:"appId" json:"appId" binding:"required"` //应用标识,与平台配置一致
|
||||
Sign string `form:"sign" json:"sign" binding:"required"` //签名
|
||||
Limit int `form:"limit" json:"limit" binding:"omitempty"` //单次拉取数量,默认 20,最大 100
|
||||
Status string `form:"status" json:"status" binding:"omitempty"` //评论状态,固定传 "pending"
|
||||
}
|
||||
|
||||
type PullResp struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data []PullComment `json:"data"`
|
||||
}
|
||||
|
||||
type PullComment struct {
|
||||
Id string `json:"id"` //评论唯一 ID
|
||||
UserId string `json:"user_id"` //发布者用户 ID
|
||||
Nickname string `json:"nickname"` //发布者昵称
|
||||
Content string `json:"content"` //评论正文
|
||||
CreatedAt string `json:"created_at"` //发布时间,ISO 8601 格式
|
||||
Ip string `json:"ip"` //发布者 IP
|
||||
Context Context `json:"context"` //评论正文
|
||||
}
|
||||
|
||||
type Context struct {
|
||||
ContentType int `json:"content_type"` //帖子类型 1=帖子 2=视频 3=漫画
|
||||
ContentId string `json:"content_id"` //所属内容业务 ID
|
||||
ContentTitle string `json:"content_title"` //所属内容标题
|
||||
}
|
||||
|
||||
type ApproveReq struct {
|
||||
Reviews []Review `json:"reviews"`
|
||||
}
|
||||
|
||||
type AppIdJson struct {
|
||||
AppId string `form:"appId" json:"appId"`
|
||||
}
|
||||
|
||||
type Review struct {
|
||||
CommentId string `form:"comment_id" json:"comment_id" binding:"omitempty"` //评论 ID,与拉取接口返回的 id 一致
|
||||
Action string `form:"action" json:"action" binding:"omitempty" ` //审核动作:approve 通过,reject 拒绝
|
||||
Category string `form:"category" json:"category" binding:"omitempty"` //拒绝原因简述
|
||||
Reason string `form:"reason" json:"reason" binding:"omitempty"` //违规类别:abuse/politics/ad/spam/competitor/foreign/link/complaint/minor
|
||||
}
|
||||
|
||||
type RepliesReq struct {
|
||||
Replies []ReplyReq `json:"replies"`
|
||||
}
|
||||
|
||||
type ReplyReq struct {
|
||||
CommentId string `form:"comment_id" json:"comment_id" binding:"omitempty"` //被回复评论的id
|
||||
Content string `form:"content" json:"content" binding:"omitempty"` // 被回复评论的内容
|
||||
}
|
||||
|
||||
type ReplyResp struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
type SignBody struct {
|
||||
AppID string `json:"appId" binding:"required"`
|
||||
Sign string `json:"sign" binding:"required"`
|
||||
}
|
||||
|
||||
type VideoCommentSubmitReq struct {
|
||||
AppID string `json:"appId" binding:"required"`
|
||||
Sign string `json:"sign" binding:"required"`
|
||||
Videos []VideoCommentItem `json:"videos" binding:"required"`
|
||||
}
|
||||
|
||||
type VideoCommentItem struct {
|
||||
VideoID string `json:"videoId" binding:"required"`
|
||||
Title string `json:"title" binding:"required"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Subtitle string `json:"subtitle,omitempty"`
|
||||
CommentCount int `json:"commentCount" binding:"required"`
|
||||
}
|
||||
|
||||
type VideoCommentSubmitResp struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data VideoCommentSubmitRespData `json:"data"`
|
||||
}
|
||||
|
||||
type VideoCommentSubmitRespData struct {
|
||||
Results []VideoCommentSubmitResult `json:"results"`
|
||||
}
|
||||
|
||||
type VideoCommentSubmitResult struct {
|
||||
ID string `json:"id"`
|
||||
VideoID string `json:"videoId"`
|
||||
}
|
||||
|
||||
type VideoCommentResultReq struct {
|
||||
AppID string `json:"appId" binding:"required"`
|
||||
Sign string `json:"sign" binding:"required"`
|
||||
IDs []string `json:"ids" binding:"required"`
|
||||
}
|
||||
|
||||
type VideoCommentResultResp struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data VideoCommentResultRespData `json:"data"`
|
||||
}
|
||||
|
||||
type VideoCommentResultRespData struct {
|
||||
Results []VideoCommentResultItem `json:"results"`
|
||||
}
|
||||
|
||||
type VideoCommentResultItem struct {
|
||||
ID string `json:"id"`
|
||||
VideoID string `json:"videoId"`
|
||||
Comments []GeneratedVideoComment `json:"comments"`
|
||||
ErrorMsg string `json:"errorMsg,omitempty"`
|
||||
}
|
||||
|
||||
type GeneratedVideoComment struct {
|
||||
Type string `json:"type"`
|
||||
Text string `json:"text"`
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package cmtmod
|
||||
|
||||
import (
|
||||
"91porn-server/models/v/usermod"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ParentRespList 列表响应信息(父评论)
|
||||
type ParentRespList struct {
|
||||
//全局唯一评论ID
|
||||
ID string `form:"id" json:"id"`
|
||||
//评论对象的ID
|
||||
ObjID string `form:"objID" json:"objID"`
|
||||
//发表评论的 用户ID
|
||||
UserID uint64 `form:"userID" json:"userID"`
|
||||
//发表评论的 用户昵称
|
||||
UserName string `form:"userName" json:"userName"`
|
||||
//头像 URL
|
||||
UserPortrait string `form:"userPortrait" json:"userPortrait" `
|
||||
//评论内容
|
||||
Content string `form:"content" json:"content"`
|
||||
Image string `form:"image" json:"image"`
|
||||
LinkStr string `form:"linkStr" json:"linkStr" bson:"linkStr"` //跳转配置
|
||||
LinkType int `form:"linkType" json:"linkType"` //1:内链,2:外链
|
||||
SearchKeyword string `form:"searchKeyword" json:"searchKeyword"` //搜索关键字
|
||||
//此评论点赞次数
|
||||
LikeCount int `form:"likeCount" json:"likeCount"`
|
||||
//此评论的评论数
|
||||
CommCount int `form:"commCount" json:"commCount"`
|
||||
//此评论的评论数,冗余
|
||||
CommCountBurden int `form:"commCountBurden" json:"commCountBurden"`
|
||||
//是否是作者
|
||||
IsAuthor bool `form:"isAuthor" json:"isAuthor" `
|
||||
//是否点过赞
|
||||
IsLike bool `form:"isLike" json:"isLike"`
|
||||
//评论者是否已关注
|
||||
IsFollow bool `form:"isFollow" json:"isFollow"`
|
||||
//是否已删除
|
||||
IsDelete bool `form:"isDelete" json:"isDelete"`
|
||||
IsGodComment bool `form:"isGodComment" json:"isGodComment"` //是否是神评论
|
||||
//性别
|
||||
Gender string `form:"gender" json:"gender"`
|
||||
//此评论的状态
|
||||
Status int `form:"status" json:"status"`
|
||||
//评论地点
|
||||
City string `form:"city" json:"city"`
|
||||
//评论时间
|
||||
CreatedAt time.Time `form:"createdAt" json:"createdAt"`
|
||||
//年龄
|
||||
Age int `json:"age"`
|
||||
// 引用类型 vid视频 col用户播单 sec官方播单 cover图集
|
||||
QuoteType string `json:"quoteType"`
|
||||
// 引用id
|
||||
QuoteID ObjectID `json:"quoteID"`
|
||||
// 引用资源图片
|
||||
QuoteImg string `json:"quoteImg"`
|
||||
// 引用资源标题
|
||||
QuoteTitle string `json:"quoteTitle"`
|
||||
//用户vip等级
|
||||
Level int `json:"level"`
|
||||
VipLevel int `json:"vipLevel"`
|
||||
Awards []int `json:"awards"` //用户奖章
|
||||
AwardsExpire []usermod.AwardsExpireResp `json:"awardsExpire" bson:"awardsExpire"` //奖章是否有效
|
||||
SuperUser bool `json:"superUser" bson:"superUser"` //是否大V
|
||||
VipExpireDate time.Time `json:"vipExpireDate" bson:"vipExpireDate"`
|
||||
Info []ChildRespList
|
||||
}
|
||||
|
||||
// ChildRespList 列表响应信息(子评论)
|
||||
type ChildRespList struct {
|
||||
ID string `form:"id" json:"id"` //全局唯一评论ID
|
||||
ObjID string `form:"objID" json:"objID"` //评论对象的ID
|
||||
CID string `form:"cid" json:"cid"` //评论的id
|
||||
UserID uint64 `form:"userID" json:"userID"` //发表评论的 用户ID
|
||||
UserName string `form:"userName" json:"userName"` //发表评论的 用户昵称
|
||||
UserPortrait string `form:"userPortrait" json:"userPortrait"` //头像 URL
|
||||
ToUserID uint64 `form:"toUserID" json:"toUserID"` //对某用户回复评论 用户ID
|
||||
ToUserName string `form:"toUserName" json:"toUserName"` //对某用户回复评论 用户昵称
|
||||
Content string `form:"content" json:"content"` //评论内容
|
||||
Image string `form:"image" json:"image"`
|
||||
LinkStr string `form:"linkStr" json:"linkStr" bson:"linkStr"` //跳转配置
|
||||
LikeCount int `form:"likeCount" json:"likeCount"` //此评论点赞次数
|
||||
IsLike bool `form:"isLike" json:"isLike"` //是否点过赞
|
||||
IsAuthor bool `form:"isAuthor" json:"isAuthor"` //是否是作者
|
||||
IsFollow bool `form:"isFollow" json:"isFollow"` //评论者是否已关注
|
||||
IsDelete bool `form:"isDelete" json:"isDelete"` //是否已删除
|
||||
Gender string `form:"gender" json:"gender"` //性别
|
||||
Status int `form:"status" json:"status"` //此评论的状态
|
||||
City string `form:"city" json:"city"` //评论地点
|
||||
QuoteType string `json:"quoteType"` // 引用类型 vid视频 col用户播单 sec官方播单
|
||||
QuoteID ObjectID `json:"quoteID"` // 引用id
|
||||
QuoteImg string `json:"quoteImg"` // 引用资源图片
|
||||
QuoteTitle string `json:"quoteTitle"` // 引用资源标题
|
||||
CreatedAt time.Time `form:"createdAt" json:"createdAt"` //评论时间
|
||||
Age int `json:"age"` //年龄
|
||||
Level int `json:"level"` //用户评论层级 1:一级评论 2:二级评论
|
||||
VipLevel int `json:"vipLevel"` //用户vip等级
|
||||
Awards []int `json:"awards"` //用户奖章
|
||||
AwardsExpire []usermod.AwardsExpireResp `json:"awardsExpire" bson:"awardsExpire"` //奖章是否有效
|
||||
SuperUser bool `json:"superUser" bson:"superUser"` //是否大V
|
||||
VipExpireDate time.Time `json:"vipExpireDate" bson:"vipExpireDate"`
|
||||
}
|
||||
|
||||
type PublishReqInfo struct {
|
||||
ObjID ObjectID `form:"objID" json:"objID"` // 评论对象的ID
|
||||
ObjType string `form:"objType" json:"objType"` // 评论对象类型 video:视频(默认) cartoon:动漫 AiPlaza:ai广场
|
||||
CID string `form:"cid" json:"cid"` // 此评论是对某条评论的评论或回复,如果为空,则为对该视频的评论
|
||||
RID string `form:"rid" json:"rid"` // 被回复评论的id
|
||||
ToUserID uint64 `form:"toUserID" json:"toUserID"` // 对某用户回复评论 用户ID
|
||||
Content string `form:"content" json:"content"` // 评论内容
|
||||
Level int `form:"level" json:"level"` // 评论层级 1:一级评论 2:二级评论
|
||||
Image string `json:"image" form:"image"` // 图片
|
||||
QuoteType string `form:"quoteType" json:"quoteType"` // 引用类型 vid视频 col用户播单 sec官方播单 cover图集
|
||||
QuoteID ObjectID `form:"quoteID" json:"quoteID"` // 引用id
|
||||
QuoteImg string `form:"quoteImg" json:"quoteImg"` // 引用资源图片
|
||||
QuoteTitle string `form:"quoteTitle" json:"quoteTitle"` // 引用资源标题
|
||||
}
|
||||
|
||||
// CmtRespList 列表响应信息
|
||||
type CmtRespList struct {
|
||||
//全局唯一评论ID
|
||||
ID ObjectID `form:"id" json:"id" bson:"_id"`
|
||||
//评论对象的ID
|
||||
ObjID string `form:"objID" json:"objID"`
|
||||
CID string `form:"cid json:"cid"` //二级评论时,为被评论的评论id
|
||||
//发表评论的 用户ID
|
||||
UserID uint64 `form:"userID" json:"userID"`
|
||||
//发表评论的 用户昵称
|
||||
UserName string `form:"userName" json:"userName"`
|
||||
//头像 URL
|
||||
UserPortrait string `form:"userPortrait" json:"userPortrait" `
|
||||
//是否认证
|
||||
SuperUser int `form:"superUser" json:"superUser"`
|
||||
//评论内容
|
||||
Content string `form:"content" json:"content"`
|
||||
//此评论点赞次数
|
||||
LikeCount int `form:"likeCount" json:"likeCount"`
|
||||
//是否点过赞
|
||||
IsLike bool `form:"isLike" json:"isLike"`
|
||||
VipExpireDate time.Time `json:"vipExpireDate" bson:"vipExpireDate"`
|
||||
//评论时间
|
||||
CreatedAt time.Time `form:"createdAt" json:"createdAt"`
|
||||
//用户vip等级
|
||||
Level int `json:"level"`
|
||||
VipLevel int `json:"vipLevel" bson:"vipLevel"`
|
||||
Info []CmtRespList
|
||||
}
|
||||
|
||||
// MyCmtResp 列表响应信息(父评论)
|
||||
type MyCmtResp struct {
|
||||
List []MyCmt `json:"list"`
|
||||
HasNext bool `json:"hasNext"`
|
||||
}
|
||||
|
||||
type MyCmt struct {
|
||||
// 全局唯一评论ID
|
||||
ID primitive.ObjectID `bson:"_id" json:"id"`
|
||||
// 评论对象的ID 帖子id
|
||||
ObjID primitive.ObjectID `bson:"objID" json:"objID"`
|
||||
// 评论内容
|
||||
Content string `bson:"content" json:"content"`
|
||||
// 此评论点赞次数
|
||||
LikeCount int `bson:"likeCount" json:"likeCount"`
|
||||
// 是否是神评论
|
||||
IsGodComment bool `bson:"isGodComment" json:"isGodComment"`
|
||||
// 帖子标题
|
||||
VidTitle string `json:"vidTitle"`
|
||||
// 帖子封面
|
||||
VidCover string `json:"vidCover"`
|
||||
//评论时间
|
||||
CreatedAt time.Time `bson:"createdAt" json:"createdAt"`
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,63 @@
|
||||
package cmtmod
|
||||
|
||||
import (
|
||||
"91porn-server/common/pageopt"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Matcher = pageopt.Matcher
|
||||
|
||||
// ToUserIDMatch
|
||||
type ToUserIDMatch struct {
|
||||
ToUserID *uint64
|
||||
}
|
||||
|
||||
func (t *ToUserIDMatch) New() Matcher {
|
||||
return pageopt.NewAssignMatch("toUserID", t.ToUserID)
|
||||
}
|
||||
|
||||
// PublisherIDMatch
|
||||
type PublisherIDMatch struct {
|
||||
PublisherID *uint64
|
||||
}
|
||||
|
||||
func (t *PublisherIDMatch) New() Matcher {
|
||||
return pageopt.NewAssignMatch("publisherID", t.PublisherID)
|
||||
}
|
||||
|
||||
type CreatedAtGTEMatch struct {
|
||||
GTE *time.Time
|
||||
}
|
||||
|
||||
func (c *CreatedAtGTEMatch) New() Matcher {
|
||||
return pageopt.NewGTEMatch("createdAt", c.GTE)
|
||||
}
|
||||
|
||||
// List
|
||||
func List(sort bson.D, skip, limit int64, matchers ...Matcher) ([]Comment, error) {
|
||||
filter := pageopt.MergeM(matchers)
|
||||
opt := &options.FindOptions{}
|
||||
if len(sort) != 0 {
|
||||
opt.SetSort(sort)
|
||||
}
|
||||
opt.SetSkip(skip)
|
||||
opt.SetLimit(limit)
|
||||
list := make([]Comment, 0, limit)
|
||||
err := coll(nil).Find(&list, filter, opt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return list, nil
|
||||
}
|
||||
|
||||
// Count
|
||||
func Count(matchers ...Matcher) (int64, error) {
|
||||
filter := pageopt.MergeM(matchers)
|
||||
count, err := coll(nil).Count(filter)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package cmtmod
|
||||
|
||||
import (
|
||||
"91porn-server/common/db"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
type ObjectID = primitive.ObjectID
|
||||
|
||||
func Init() {
|
||||
mdb = db.Init(table)
|
||||
initIndex()
|
||||
}
|
||||
|
||||
type CmtType string
|
||||
|
||||
const (
|
||||
CmtTypeVideo CmtType = "VIDEO"
|
||||
CmtTypeComment CmtType = "CMET"
|
||||
CmtTypeReply CmtType = "REPLY"
|
||||
CmtAt CmtType = "AT"
|
||||
CmtNoVideo CmtType = "NOVIDEO"
|
||||
)
|
||||
|
||||
type OType = string
|
||||
|
||||
const (
|
||||
OTypeVideo OType = "video" //视频
|
||||
OTypeCartoon OType = "cartoon" //漫画
|
||||
OTypeDrama OType = "drama" //短剧
|
||||
OTypeAiPlaza OType = "AiPlaza" //ai广场
|
||||
)
|
||||
|
||||
// Comment 评论
|
||||
type Comment struct {
|
||||
ID ObjectID `bson:"_id,omitempty"` // 全局唯一ID
|
||||
ObjID ObjectID `bson:"objID"` // 评论对象的ID
|
||||
ObjType OType `bson:"objType"` // 评论对象类型 video:视频 cartoon:动漫
|
||||
Title string `bson:"title"` // 如果是视频/动漫 填充对应标题
|
||||
CID ObjectID `bson:"cid,omitempty"` // 评论id
|
||||
RID ObjectID `bson:"rid,omitempty"` // 被回复的评论id
|
||||
GID ObjectID `bson:"gid,omitempty"` // 二级评论的主评论id,用于分组聚集评论的回复
|
||||
Type CmtType `bson:"type"` // 评论类型 video:对视频发表评论 comment:对评论发表评论 reply:对子评论的回复 noVideo:非视频帖子评论
|
||||
PublisherID uint64 `bson:"publisherID"` // 字段Type指定资源的发布者
|
||||
AuthorMark bool `bson:"authorMark"` // 如果是做的评论,其跟随回复全部置为true,便于获取作者的评论及其回复
|
||||
SortCnt int64 `bson:"sortCnt,omitempty"` // 热门排序标记,同组的值一致,用于排序热门评论,存主评论的点赞数,点赞时更新数据
|
||||
UserID uint64 `bson:"userID"` // 发表评论的 用户ID
|
||||
ToUserID uint64 `bson:"toUserID,omitempty"` // 对某用户回复评论 用户ID
|
||||
ToUserName string `form:"toUserName" json:"toUserName"` // 对某用户回复评论 用户昵称
|
||||
LikeCount int `bson:"likeCount"` // 点赞数
|
||||
CommentCount int `bson:"commentCount"` // 评论数
|
||||
IsGodComment bool `bson:"isGodComment"` // 是否是神评论
|
||||
GodCommentAward bool `bson:"godCommentAward,omitempty"` // 是否已经发放过神评奖励
|
||||
IsAuthor bool `bson:"isAuthor"` // 是否是作者
|
||||
IsRobot bool `bson:"isRobot"` // 是否是机器人
|
||||
QuoteType string `json:"quoteType" bson:"quoteType"` // 引用类型 vid视频 col用户播单 sec官方播单 cover图集
|
||||
QuoteID primitive.ObjectID `json:"quoteID" bson:"quoteID"` // 引用id
|
||||
QuoteImg string `json:"quoteImg" bson:"quoteImg"` // 引用资源图片
|
||||
QuoteTitle string `json:"quoteTitle" bson:"quoteTitle"` // 引用资源标题
|
||||
Content string `bson:"content"` // 评论内容
|
||||
OrgContent string `bson:"orgContent"` // 评论原文
|
||||
Image string `bson:"image"` // 评论图片
|
||||
Level int `bson:"level"` // 评论层级 1:一级评论 2:二级评论
|
||||
IPAddr string `bson:"ipAddr"` // 发表评论的ip地址
|
||||
Status int `bson:"status"` // 评论状态 1:通过审核 2:未审核 3:被自动过滤 4:审核未通过
|
||||
Reason string `bson:"reason"` // 评论未通过原因
|
||||
Desc string `bson:"desc" json:"desc"` // 备注
|
||||
City string `bson:"city"` // 发表评论的城市
|
||||
LinkStr string `json:"linkStr" bson:"linkStr"` // 跳转配置
|
||||
IsAdvertiser bool `json:"isAdvertiser" bson:"isAdvertiser"` // 是否是打广告用户
|
||||
IsDelete bool `bson:"isDelete"` // true:已删除 false:未删除
|
||||
CreatedAt time.Time `bson:"createdAt,omitempty"` // 评论发表时间
|
||||
DeletedAt time.Time `bson:"deletedAt"` // 评论发表时间
|
||||
}
|
||||
|
||||
// FstCmt 获取一级评论的第一条评论
|
||||
type FstCmt struct {
|
||||
ID ObjectID `bson:"_id"`
|
||||
Data Comment
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
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}
|
||||
}
|
||||
Reference in New Issue
Block a user