dev-feat-IRONFANS-70-Robin #230

Merged
chenhao merged 2 commits from dev-feat-IRONFANS-70-Robin into feat-IRONFANS-70 2024-04-04 21:25:33 +08:00
3 changed files with 16 additions and 7 deletions

View File

@ -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
}

View File

@ -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)
}
// 填充动态是否解锁

View File

@ -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"` // 单帖价格,单位人民币分