fix
This commit is contained in:
parent
d0e0d17b5d
commit
0b6428cf34
|
@ -1,7 +0,0 @@
|
||||||
package constants
|
|
||||||
|
|
||||||
// 千人千面windows访问图片的地址
|
|
||||||
const DOMAIN_RENDER_IMG_NAME = "https://fusenrenderimg.kayue.cn"
|
|
||||||
|
|
||||||
// 云渲染域名和访问地址
|
|
||||||
const DOMAIN_NAME = "https://fusenapi.kayue.cn:8010/"
|
|
|
@ -1,12 +1,5 @@
|
||||||
package image
|
package image
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"fusenapi/constants"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
// 定义尺寸规则
|
// 定义尺寸规则
|
||||||
var sizeArray = []uint32{1200, 1000, 750, 500, 128}
|
var sizeArray = []uint32{1200, 1000, 750, 500, 128}
|
||||||
|
|
||||||
|
@ -42,25 +35,3 @@ type ThousandFaceImageFormatReq struct {
|
||||||
ProductId int64
|
ProductId int64
|
||||||
UserId int64
|
UserId int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func ThousandFaceImageFormat(req *ThousandFaceImageFormatReq) {
|
|
||||||
if req.Size <= 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
coverSlice := strings.Split(req.Cover, ".")
|
|
||||||
coverImgSlice := strings.Split(req.CoverImg, ".")
|
|
||||||
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
|
|
||||||
}
|
|
||||||
//千人千面处理
|
|
||||||
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.UserId, req.UserId, req.ProductId, time.Now().UTC().Unix())
|
|
||||||
req.CoverDefault = fmt.Sprintf("%s_%d.%s", coverImgSlice[0], req.Size, coverImgSlice[1])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user