From ed6326f07d2a2fa9b13c1aea5b3e55d25a794a67 Mon Sep 17 00:00:00 2001 From: momo <1012651275@qq.com> Date: Fri, 25 Aug 2023 10:48:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=AF=B7=E6=B1=82=E7=AE=97=E6=B3=95,?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/repositories/image_handle.go | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/service/repositories/image_handle.go b/service/repositories/image_handle.go index caab53c2..d9ac8356 100644 --- a/service/repositories/image_handle.go +++ b/service/repositories/image_handle.go @@ -99,13 +99,12 @@ type ( ResourceId string ResourceUrl *string Metadata *string - DiffTimeLogoCombine time.Duration - DiffTimeUploadFile time.Duration + DiffTimeLogoCombine int64 + DiffTimeUploadFile int64 } ) func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq) (*LogoCombineRes, error) { - logc.Infof(ctx, "合图--处理--开始时间:%v", time.Now().UTC()) // 查询logo最新基础信息 var metadata *string var logoUrl *string @@ -198,7 +197,7 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq postMap["param_data"] = combineParam logc.Infof(ctx, "合图--算法请求--合图--开始时间:%v", time.Now().UTC()) - var startTimeLogoCombine = time.Now() //合图--处理--开始时间 + var startTimeLogoCombine = time.Now().UnixMilli() //合图--处理--开始时间 var resultBLM constants.BLMServiceUrlResult err = curl.NewClient(ctx, &curl.Config{ @@ -207,9 +206,9 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq }).PostJson(postMap, &resultBLM) logc.Infof(ctx, "合图--算法请求--合图--结束时间:%v", time.Now().UTC()) - endTimeLogoCombine := time.Now() //合图--处理--开始时间 - diffTimeLogoCombine := endTimeLogoCombine.Sub(startTimeLogoCombine) //合图--处理--中间差 - + endTimeLogoCombine := time.Now().UnixMilli() //合图--处理--开始时间 + diffTimeLogoCombine := endTimeLogoCombine - startTimeLogoCombine //合图--处理--中间差 + logc.Infof(ctx, "合图--算法请求--合图--业务耗时:%d", diffTimeLogoCombine) if err != nil { logx.Error(err) return nil, err @@ -239,7 +238,7 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq } logc.Infof(ctx, "合图--上传文件--开始时间:%v", time.Now().UTC()) - var startTimeUploadFile = time.Now() //合图--上传--开始时间 + var startTimeUploadFile = time.Now().UnixMilli() //合图--上传--开始时间 uploadRes, err := upload.UploadFileByBase64(&file.UploadBaseReq{ Source: "combine-image", @@ -251,14 +250,14 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq GuestId: in.GuestId, }) logc.Infof(ctx, "合图--上传文件--开始时间:%v", time.Now().UTC()) - endTimeUploadFile := time.Now() //合图--处理--开始时间 - diffTimeUploadFile := endTimeUploadFile.Sub(startTimeUploadFile) //合图--处理--中间差 + endTimeUploadFile := time.Now().UnixMilli() //合图--处理--开始时间 + diffTimeUploadFile := endTimeUploadFile - startTimeUploadFile //合图--处理--中间差 + logc.Infof(ctx, "合图--上传文件--业务耗时:%d", diffTimeUploadFile) if err != nil { logx.Error(err) return nil, err } - logc.Infof(ctx, "合图--处理--结束时间:%v", time.Now().UTC()) return &LogoCombineRes{ ResourceId: uploadRes.ResourceId,