Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop

This commit is contained in:
eson 2023-06-25 20:01:38 +08:00
commit 0afaed5089

View File

@ -48,18 +48,19 @@ func ThousandFaceImageFormat(req *ThousandFaceImageFormatReq) {
if req.Size > 0 {
coverSlice := strings.Split(req.Cover, ".")
coverImgSlice := strings.Split(req.CoverImg, ".")
if req.Size >= 200 && len(coverSlice) == 2 && len(coverImgSlice) == 2 {
if req.Size >= 200 && len(coverSlice) >= 2 && len(coverImgSlice) >= 2 {
req.Cover = fmt.Sprintf("%s_%d.%s", coverSlice[0], req.Size, coverSlice[1])
req.CoverImg = fmt.Sprintf("%s_%d.%s", coverImgSlice[0], req.Size, coverImgSlice[1])
}
if req.IsThousandFace == 0 {
return
}
//千人千面处理
if req.IsThousandFace == 1 {
req.Cover = ""
req.CoverDefault = req.CoverImg
if req.Size >= 200 && len(coverSlice) == 2 && len(coverImgSlice) == 2 {
req.CoverImg = fmt.Sprintf("%s/test/%d/%d_%d.png?%d", constants.DOMAIN_RENDER_IMG_NAME, req.UserInfo.Id, req.UserInfo.Id, req.ProductId, time.Now().Unix())
req.CoverDefault = fmt.Sprintf("%s_%d.%s", coverImgSlice[0], req.Size, coverImgSlice[1])
}
req.Cover = ""
req.CoverDefault = req.CoverImg
if req.Size >= 200 && len(coverSlice) >= 2 && len(coverImgSlice) >= 2 {
req.CoverImg = fmt.Sprintf("%s/test/%d/%d_%d.png?%d", constants.DOMAIN_RENDER_IMG_NAME, req.UserInfo.Id, req.UserInfo.Id, req.ProductId, time.Now().Unix())
req.CoverDefault = fmt.Sprintf("%s_%d.%s", coverImgSlice[0], req.Size, coverImgSlice[1])
}
}
}