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

This commit is contained in:
laodaming 2023-11-23 11:12:44 +08:00
commit 53f63d8207

View File

@ -78,7 +78,6 @@ type (
)
func (l *defaultImageHandle) LogoInfoSet(ctx context.Context, in *LogoInfoSetReq) (*LogoInfoSetRes, error) {
fmt.Println("算法请求轮训下标:", globalBLMServiceIndex)
var bLMServicePort = l.BLMServiceUrls[globalBLMServiceIndex]
if len(l.BLMServiceUrls) == (globalBLMServiceIndex + 1) {
globalBLMServiceIndex = 0
@ -97,12 +96,12 @@ func (l *defaultImageHandle) LogoInfoSet(ctx context.Context, in *LogoInfoSetReq
postMap["is_all_template"] = "0"
}
logc.Infof(ctx, "算法请求--LOGO基础信息--开始时间:%v", time.Now().UTC())
// logc.Infof(ctx, "算法请求--LOGO基础信息--开始时间:%v", time.Now().UTC())
err := curl.NewClient(ctx, &curl.Config{
BaseUrl: bLMServicePort,
Url: constants.BLMServiceUrlLogoFeatureExtraction,
}).PostJson(postMap, &resultBLM)
logc.Infof(ctx, "算法请求--LOGO基础信息--结束时间:%v", time.Now().UTC())
// logc.Infof(ctx, "算法请求--LOGO基础信息--结束时间:%v", time.Now().UTC())
if err != nil {
logx.Error(err)
return nil, err
@ -253,7 +252,6 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq
postMap["tag_data"] = in.ProductTemplateTagGroups
postMap["param_data"] = combineParam
fmt.Println("算法请求轮训下标:", globalBLMServiceIndex)
var bLMServicePort = l.BLMServiceUrls[globalBLMServiceIndex]
if len(l.BLMServiceUrls) == (globalBLMServiceIndex + 1) {
globalBLMServiceIndex = 0
@ -261,8 +259,8 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq
globalBLMServiceIndex = globalBLMServiceIndex + 1
}
logc.Infof(ctx, "合图--算法请求--合图--开始时间:%v", time.Now().UTC())
var startTimeLogoCombine = time.Now().UnixMilli() //合图--处理--开始时间
// logc.Infof(ctx, "合图--算法请求--合图--开始时间:%v", time.Now().UTC())
// var startTimeLogoCombine = time.Now().UnixMilli() //合图--处理--开始时间
// postMapB, _ := json.Marshal(postMap)
// logc.Info(ctx, "合图参数--%v", string(postMapB))
@ -275,9 +273,9 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq
}).PostJson(postMap, &resultBLM)
//logc.Infof(ctx, "合图--算法请求--合图--结束时间:%v", time.Now().UTC())
endTimeLogoCombine := time.Now().UnixMilli() //合图--处理--开始时间
diffTimeLogoCombine := endTimeLogoCombine - startTimeLogoCombine //合图--处理--中间差
logc.Infof(ctx, "合图--算法请求--合图--业务耗时:%d", diffTimeLogoCombine)
// endTimeLogoCombine := time.Now().UnixMilli() //合图--处理--开始时间
// diffTimeLogoCombine := endTimeLogoCombine - startTimeLogoCombine //合图--处理--中间差
// logc.Infof(ctx, "合图--算法请求--合图--业务耗时:%d", diffTimeLogoCombine)
if err != nil {
logx.Error(err)
return nil, err
@ -300,8 +298,8 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq
var fileBase = resultData["result"].(string)
var spendTime = resultData["spend_time"].(string)
spendTimeInt, _ := strconv.Atoi(spendTime)
diffTimeLogoCombine = int64(spendTimeInt)
logc.Infof(ctx, "合图--算法请求--合图--业务耗时(自身):%d", diffTimeLogoCombine)
diffTimeLogoCombine := int64(spendTimeInt)
// logc.Infof(ctx, "合图--算法请求--合图--业务耗时(自身):%d", diffTimeLogoCombine)
// 上传文件
var upload = file.Upload{
@ -310,7 +308,7 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq
AwsSession: l.AwsSession,
}
logc.Infof(ctx, "合图--上传文件--开始时间:%v", time.Now().UTC())
// logc.Infof(ctx, "合图--上传文件--开始时间:%v", time.Now().UTC())
var startTimeUploadFile = time.Now().UnixMilli() //合图--上传--开始时间
uploadRes, err := upload.UploadFileByBase64(&file.UploadBaseReq{
@ -322,11 +320,11 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq
UserId: in.UserId,
GuestId: in.GuestId,
})
logc.Infof(ctx, "合图--上传文件--结束时间:%v", time.Now().UTC())
// logc.Infof(ctx, "合图--上传文件--结束时间:%v", time.Now().UTC())
endTimeUploadFile := time.Now().UnixMilli() //合图--处理--开始时间
diffTimeUploadFile := endTimeUploadFile - startTimeUploadFile //合图--处理--中间差
logc.Infof(ctx, "合图--上传文件--业务耗时:%d", diffTimeUploadFile)
// logc.Infof(ctx, "合图--上传文件--业务耗时:%d", diffTimeUploadFile)
if err != nil {
logx.Error(err)
return nil, err
@ -409,7 +407,6 @@ func (l *defaultImageHandle) LogoStandard(ctx context.Context, in *LogoStandardR
postMap["height"] = in.Height
postMap["proportion"] = in.Proportion
fmt.Println("算法请求轮训下标:", globalBLMServiceIndex)
var bLMServicePort = l.BLMServiceUrls[globalBLMServiceIndex]
if len(l.BLMServiceUrls) == (globalBLMServiceIndex + 1) {
globalBLMServiceIndex = 0
@ -417,12 +414,12 @@ func (l *defaultImageHandle) LogoStandard(ctx context.Context, in *LogoStandardR
globalBLMServiceIndex = globalBLMServiceIndex + 1
}
logc.Infof(ctx, "算法请求--去背景--开始时间:%v", time.Now().UTC())
// logc.Infof(ctx, "算法请求--去背景--开始时间:%v", time.Now().UTC())
err = curl.NewClient(ctx, &curl.Config{
BaseUrl: bLMServicePort,
Url: constants.BLMServiceUrlLogoRemovebg,
}).PostJson(postMap, &resultBLM)
logc.Infof(ctx, "算法请求--去背景--结束时间:%v", time.Now().UTC())
// logc.Infof(ctx, "算法请求--去背景--结束时间:%v", time.Now().UTC())
if err != nil {
logx.Error(err)
return nil, err