package mediamod import ( "91porn-server/models/commod" "time" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" ) type ObjectID = primitive.ObjectID type AppMediaBase struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` // 文档id SortCode int `json:"sortCode" bson:"sortCode"` // 排序 Status int `json:"status" bson:"status"` // 状态 Title string `json:"title" bson:"title"` // 标题 HorizontalCover string `json:"horizontalCover" bson:"horizontalCover"` // 横版封面 VerticalCover string `json:"verticalCover" bson:"verticalCover"` // 竖版封面 Tags []primitive.ObjectID `json:"tags" bson:"tags"` // 标签 TagDetails []TagDetail `json:"tagDetails" bson:"tagDetails"` // 标签对象 Summary string `json:"summary" bson:"summary"` // 简介 TotalEpisode int `json:"totalEpisode" bson:"totalEpisode"` // 总集数 CurrentEpisode int `json:"currentEpisode" bson:"currentEpisode"` // 当前更新的集数 FreeEpisode int `json:"freeEpisode" bson:"freeEpisode"` // 免费集数 UpdateStatus int `json:"updateStatus" bson:"updateStatus"` // 更新状态 MediaType string `json:"mediaType" bson:"mediaType"` // 媒体类型 "video":动漫,"image":漫画 "text":小说 MediaSubType MediaSubType `json:"mediaSubType" bson:"mediaSubType"` // 子类型 ,暂时只有小说使用 0-默认文本小说 1-有声小说 DefaultContent DefaultContent `json:"defaultContent" bson:"defaultContent"` // 默认展示内容,暂时只有漫画需要 Kind int `json:"kind" bson:"kind"` // 种类(1、哩番,2、3D,3、同人动画,4、单行本,5、连载漫画,6、韩漫 ) Style int `json:"style" bson:"style"` // 展示背景颜色 0-随机 1~5对应ui五种颜色 PermissionIconHide bool `json:"permissionIconHide" bson:"permissionIconHide"` // 售卖类型标识隐藏 Permission int `json:"permission" bson:"permission"` // 收听权限 0:会员 1:金币购买 2:免费 Price int64 `json:"price" bson:"price"` // 价格(整部购买的类型 小说 cos 写真) ContentsPrice int64 `json:"contentsPrice" bson:"contentsPrice"` // 所有子集加起来的价格 Direction int64 `json:"direction" bson:"direction"` // 排版方向 0横 1竖(冗余字段) //SellType int `json:"sellType" bson:"sellType"` // 商品售卖类型(0单集售卖 1整部售卖) FreeTime int `json:"freeTime" bson:"freeTime"` // 免费试看时长 单位 s MID string `json:"mId" bson:"mId"` // 模块ID ModuleName string `json:"moduleName" bson:"moduleName"` // 模块名称 SectionName string `json:"sectionName" bson:"sectionName"` // 专题名称 SID primitive.ObjectID `json:"sId" bson:"sId"` // 专题ID SectionSort int `json:"sectionSort" bson:"sectionSort"` // 专题排序 CountComment int64 `json:"countComment" bson:"countComment"` // 评论数 CountPurchases int64 `json:"countPurchases" bson:"countPurchases"` // 购买数 HasFollow bool `json:"hasFollow" bson:"hasFollow"` // 是否关注 CountBrowse int64 `json:"countBrowse" bson:"countBrowse"` // 浏览数 CountCollect int64 `json:"countCollect" bson:"countCollect"` // 收藏数 CountLike int64 `json:"countLike" bson:"countLike"` // 喜欢数 CountDisLike int64 `json:"countDisLike" bson:"countDisLike"` // 不喜欢数 CountView int64 `json:"countView" bson:"countView"` // 展现数 CountShare int64 `json:"countShare" bson:"countShare"` // 分享数 MediaStatus MediaStatus `json:"mediaStatus" bson:"mediaStatus"` // 媒体状态 Number int64 `json:"number" bson:"number"` // 编号 Author string `json:"author"` // 作者 CreatedAt time.Time `json:"createdAt" bson:"createdAt"` // 文档创建时间 UpdateTime time.Time `json:"updateTime" bson:"updateTime"` // 文档更新时间 LatestPublishedAt time.Time `json:"latestPublishedAt" bson:"latestPublishedAt"` // 最新上架或子集更新时间 LsjId string `json:"lsjId" bson:"lsjId"` // 老司机ID HasDramaCard bool `json:"hasDramaCard" bson:"hasDramaCard"` // 是否持有有效短剧权益卡 } // MediaStatus 媒体状态 type MediaStatus struct { HasPaid bool `json:"hasPaid" bson:"hasPaid"` // 已支付(如果是父集,表示整本购买) HasCollected bool `json:"hasCollected" bson:"hasCollected"` // 已收藏 HasLiked bool `json:"hasLiked" bson:"hasLiked"` // 已点赞 } type MediaContent struct { ID primitive.ObjectID `json:"id"` // 文档id MediaID primitive.ObjectID `json:"mediaId"` // 媒体资源ID EpisodeNumber int `json:"episodeNumber"` // 第几集 ListenPermission int `json:"listenPermission"` // 收听权限 0:会员 1:金币购买 2:免费 Price int64 `json:"price"` // 购买价格 Name string `json:"name"` // 章节名 Text string `json:"text"` // 内容(小说专用) Md5 string `json:"md5"` // 媒体md5 VideoUrl string `json:"videoUrl"` // 视频地址 AudioUrl string `json:"audioUrl" bson:"audioUrl"` // 有声小说地址 UrlSet []string `json:"urlSet"` // 地址集(多个资源地址用 例如漫画) Height int `json:"height"` // 高 Weight int `json:"weight"` // 宽 CountComment int64 `json:"countComment" bson:"countComment"` // 评论数 CountPurchases int64 `json:"countPurchases" bson:"countPurchases"` // 购买数 CountBrowse int64 `json:"countBrowse" bson:"countBrowse"` // 浏览数 CountCollect int64 `json:"countCollect" bson:"countCollect"` // 收藏数 CountLike int64 `json:"countLike" bson:"countLike"` // 喜欢数 CountDisLike int64 `json:"countDisLike" bson:"countDisLike"` // 不喜欢数 MediaSize int64 `json:"mediaSize"` // 资源大小 PlayTime uint `json:"playTime"` // 影片长度 Ratio float64 `json:"ratio"` // 宽高比 MediaStatus MediaStatus `json:"mediaStatus" bson:"mediaStatus"` // 媒体状态 CreatedAt time.Time `json:"createdAt"` // 文档创建时间 UpdateTime time.Time `json:"updateTime"` // 文档更新时间 } type AppLibrary struct { Key string `json:"key" bson:"key"` // 健值 Name string `json:"name" bson:"name"` // 健名称 Kind []KindInfo `json:"kind" bson:"kind"` // 种类 (1、哩番,2、3D,3、同人动画,4、单行本,5、连载漫画,6、韩漫 ) } type KindInfo struct { Key string `json:"key" bson:"key"` // 健值 Name string `json:"name" bson:"name"` // 健名称 Cover string `json:"cover" bson:"cover"` // 封面 Dimension []DimensionInfo `json:"dimension" bson:"dimension"` // 纬度 } type DimensionInfo struct { Key string `json:"key" bson:"key"` // 健值 Name string `json:"name" bson:"name"` // 健名称 Tag []TagInfo `json:"tag" bson:"tag"` // 标签 } type TagInfo struct { ID string `json:"id" bson:"id"` // 标签ID Name string `json:"name" bson:"name"` // 标签名称 } type AppLibraryReq struct { MediaType string `json:"mediaType" bson:"mediaType"` // 媒体类型 TagIds []string `json:"tagIds" bson:"tagIds"` // 标签ID SortType int `json:"sortType" bson:"sortType"` // 排序 1、精选,2、最新,3、最热,4、最多收藏 commod.Page } type AppElasticSearchLibraryResponse struct { List []*AppMediaBase `json:"list"` // list HasNext bool `json:"hasNext"` // hasNext } func (p AppLibraryReq) Filter(ids []primitive.ObjectID) bson.M { filter := bson.M{} filter["_id"] = bson.M{"$in": ids} return filter } func AppLibrarySortField(sortType int) string { switch sortType { case 1: return "choiceSort" case 3: return "countLike" case 4: return "countCollect" default: return "updateTime" } } func (p AppLibraryReq) Options() bson.D { if p.MediaType == MediaTypeDrama && p.SortType == 1 { return bson.D{ {Key: "sortCode", Value: -1}, {Key: "createdAt", Value: -1}, {Key: "_id", Value: -1}, } } return bson.D{{Key: AppLibrarySortField(p.SortType), Value: -1}} } type AppSearchReq struct { KeyWord string `form:"keyword" json:"keyword"` // 搜索关键词 TagName string `form:"tagName" json:"tagName"` // 搜索标签名 Kind int `form:"kind" json:"kind"` // 种类 1、动漫 2、漫画 3、小说 4、短剧 commod.Page SortType int `json:"sortType" form:"sortType"` // 1-最新上架 2-最多观看 } type AppElasticSearchResponse struct { List []*AppMediaBase `json:"list"` // list TagID string `json:"tagID"` // 帖子搜索时附带的tagID TagMediaList []*AppMediaBase `json:"tagMediaList"` // 搜索时tag相关的帖子 HasNext bool `json:"hasNext"` // hasNext } func (p AppSearchReq) Options() bson.D { if p.Kind == 4 { if p.SortType == 2 { return bson.D{{Key: "countBrowse", Value: -1}, {Key: "latestPublishedAt", Value: -1}, {Key: "_id", Value: -1}} } return bson.D{{Key: "latestPublishedAt", Value: -1}, {Key: "createdAt", Value: -1}, {Key: "_id", Value: -1}} } return bson.D{{Key: "createdAt", Value: -1}} } type AppLibraryV2Req struct { MediaType string `json:"mediaType" form:"mediaType"` // 动漫类型 video-动漫 image-漫画 text-小说 } type AppLibraryV2Resp struct { MediaType []AppLibraryItem `json:"mediaType"` SortType []AppLibraryItem `json:"sortType"` // 1-最多播放 2-收藏最多 3-最新上架 TagName []AppLibraryItem `json:"tagName"` // 标签名 PayType []AppLibraryItem `json:"payType"` // 付费类型 } type AppLibraryItem struct { Name string `json:"name"` Value string `json:"value"` } type AppLibrarySearchV2Req struct { MediaType string `json:"mediaType" form:"mediaType"` // 媒体类型 SortType string `json:"sortType" form:"sortType"` // 排序类型 TagName string `json:"tagName" form:"tagName"` // 标签名 PayType string `json:"payType" form:"payType"` // 付费类型 commod.Page }