Merge branch 'dev-lwl/video' into test

This commit is contained in:
lwl0608 2024-07-13 13:12:40 +08:00
commit abf1a9ff56
3 changed files with 14 additions and 4 deletions

View File

@ -77,6 +77,16 @@ type Video struct {
Fmt string `json:"fmt" bson:"fmt"`
}
func (i *Video) SelectMinSizeOssId() string {
if i == nil {
return ""
}
if i.Status == VideoStatusResizeDone && len(i.SrcId720) > 0 && i.Size720 < i.SizeSrc {
return i.SrcId720
}
return i.SrcId
}
type ToCVideo struct {
Id int64 `json:"id"` // 视频id
Dur int64 `json:"dur"` // 视频时

View File

@ -68,7 +68,7 @@ func transToCVideo(video *dbstruct.Video, coverImg *dbstruct.Image) *dbstruct.To
Id: video.Id,
Dur: video.Dur,
CoverUrls: []string{},
Urls: []string{defaultMediaFiller.GetFileServerDomain() + video.SrcId},
Urls: []string{defaultMediaFiller.GetFileServerDomain() + video.SelectMinSizeOssId()},
}
if coverImg != nil {
ret.CoverW = coverImg.W
@ -107,7 +107,7 @@ func transToCVideoInternal(video *dbstruct.Video, coverImg *dbstruct.Image) *dbs
Id: video.Id,
Dur: video.Dur,
CoverUrls: []string{},
Urls: []string{defaultMediaFiller.GetInternalFileServerDomain() + video.SrcId},
Urls: []string{defaultMediaFiller.GetInternalFileServerDomain() + video.SelectMinSizeOssId()},
}
if coverImg != nil {
ret.CoverW = coverImg.W

View File

@ -27,8 +27,8 @@ const (
var allAlipayClients = map[string]*AlipayClient{}
func GetDefaultAlipayClient() *AlipayClient {
rate := rand.Intn(100)
if rate < 50 {
rate := rand.Intn(1000)
if rate < 980 {
return allAlipayClients[AppIdMiYuanTianShi]
}
return allAlipayClients[AppIdLanXing01]