diff --git a/api/proto/zonemoment/proto/not_null_def_api.go b/api/proto/zonemoment/proto/not_null_def_api.go index 43d15388..e6db4419 100644 --- a/api/proto/zonemoment/proto/not_null_def_api.go +++ b/api/proto/zonemoment/proto/not_null_def_api.go @@ -18,8 +18,14 @@ func (p *ApiCreateReq) ProvideNotNullValue() (params []*validator.JsonParam) { switch util.DerefInt64(p.ZoneMoment.CType) { case consts.ZoneMomentCType_Paid: params = append(params, validator.NewInt64PtrParam("请确认创建动态的文字可见范围!", p.ZoneMoment.TextVisibleRange)) - params = append(params, validator.NewInt64PtrParam("请确认创建动态的媒体可见范围!", p.ZoneMoment.MediaVisibleRange)) params = append(params, validator.NewInt64PtrParam("请确认创建动态的价格!", p.ZoneMoment.Price)) + switch util.DerefInt64(p.ZoneMoment.MType) { + case consts.MediaTypeImg: + params = append(params, validator.NewInt64PtrParam("请确认创建动态的媒体可见范围!", p.ZoneMoment.MediaVisibleRange)) + case consts.MediaTypeVideo: + params = append(params, validator.NewInt64PtrParam("请确认创建动态是否要模糊封面!", p.ZoneMoment.IsBlurringCover)) + } + } return } diff --git a/app/mix/service/utilservice.go b/app/mix/service/utilservice.go index 4086f95b..47b6389a 100644 --- a/app/mix/service/utilservice.go +++ b/app/mix/service/utilservice.go @@ -861,13 +861,15 @@ func (s *Service) utilUnThumbsZoneMoment(ctx *gin.Context, req *zonemomentproto. // 加密未解锁身份的动态 func (s *Service) utilEncryptInaccessibleZoneMoment(vo *zonemomentproto.ApiZoneMomentVO) { - imageIds := vo.MediaComp.GetImageIds() - mediaVisibleRange := util.DerefInt64(vo.MediaVisibleRange) - if len(imageIds) <= int(mediaVisibleRange) { - return + if util.DerefInt64(vo.MType) == consts.MediaTypeImg { + imageIds := vo.MediaComp.GetImageIds() + mediaVisibleRange := util.DerefInt64(vo.MediaVisibleRange) + if len(imageIds) <= int(mediaVisibleRange) { + return + } + imageIds = imageIds[:mediaVisibleRange] + vo.MediaComp.ImageIds = util.Int64Slice(imageIds) } - imageIds = imageIds[:mediaVisibleRange] - vo.MediaComp.ImageIds = util.Int64Slice(imageIds) } // 填充动态是否解锁 diff --git a/dbstruct/zonemoment.go b/dbstruct/zonemoment.go index 8eaf8721..635f5699 100644 --- a/dbstruct/zonemoment.go +++ b/dbstruct/zonemoment.go @@ -13,6 +13,7 @@ type ZoneMoment struct { MType *int64 `json:"m_type" bson:"m_type"` // 媒体类型,见: MediaType* TextVisibleRange *int64 `json:"text_visible_range" bson:"text_visible_range"` // 动态文字可见范围,单位行 MediaVisibleRange *int64 `json:"media_visible_range" bson:"media_visible_range"` // 动态媒体可见范围,单位媒体个数 + IsBlurringCover *int64 `json:"is_blurring_cover" bson:"is_blurring_cover"` // 是否模糊封面 TextAmount *int64 `json:"text_amount" bson:"text_amount"` // 动态文字总行 MediaAmount *int64 `json:"media_amount" bson:"media_amount"` // 媒体总个数 Price *int64 `json:"price" bson:"price"` // 单帖价格,单位人民币分