diff --git a/config/config.yaml b/config/config.yaml index 9a5f2b5..e453f10 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -21,8 +21,8 @@ minio: secretAccessKey: OIxv7QptYBO3 bucket: jky-data node: - host: 127.0.0.1 - port: 27188 + host: 192.168.53.10 + port: 9188 token: 06d36c6f5705507dae778fdce90d0767 functions: - name: task-response diff --git a/mq/handler.go b/mq/handler.go index 6059d03..7b5748c 100644 --- a/mq/handler.go +++ b/mq/handler.go @@ -260,6 +260,7 @@ func ModelTaskExecuteHandler(payload map[string]interface{}) { response, err := http.Post(reqUrl, "multipart/form-data", dec) if err != nil { config.Logger.With(zap.String("源文件名", f.FileName)). + With(zap.String("请求地址", reqUrl)). With(zap.String("临时文件名", path.Join(config.Cfg.TmpPath, payload["subDataset"].(string), f.FileName))). Error("文件提交", zap.Error(err)) } @@ -272,6 +273,7 @@ func ModelTaskExecuteHandler(payload map[string]interface{}) { body, err := io.ReadAll(response.Body) if err != nil { config.Logger.With(zap.String("源文件名", f.FileName)). + With(zap.String("请求地址", reqUrl)). With(zap.String("临时文件名", path.Join(config.Cfg.TmpPath, payload["subDataset"].(string), f.FileName))). Error("模型识别", zap.Error(err)) } @@ -423,7 +425,7 @@ func ModelTaskExecuteHandler(payload map[string]interface{}) { //} } else { reqUrl := fmt.Sprintf("http://127.0.0.1:%s/%s", issue.DstPort, issue.HttpUrl) - if len(payload["httpUrl"].(string)) > 0 { + if len(payload["httpUrl"].(string)) > 1 { reqUrl = payload["httpUrl"].(string) } fc := f["file"].(string) @@ -438,6 +440,7 @@ func ModelTaskExecuteHandler(payload map[string]interface{}) { response, err := http.Post(reqUrl, writer.FormDataContentType(), buff) if err != nil { config.Logger.With(zap.String("源文件名", f["fileName"].(string))). + With(zap.String("请求地址", reqUrl)). With(zap.String("临时文件名", path.Join(config.Cfg.TmpPath, payload["subDataset"].(string), f["fileName"].(string)))). Error("文件提交", zap.Error(err)) } diff --git a/mq/service.go b/mq/service.go index fd52e26..160f6bc 100644 --- a/mq/service.go +++ b/mq/service.go @@ -62,7 +62,10 @@ func ProcessWorkflow(payload map[string]interface{}, fc proto.FileCapture, wf *W case "start-node": fn, _ := base64.StdEncoding.DecodeString(fc.File) buff := bytes.NewBuffer(fn) - img, imgType, _ = image.Decode(buff) + img, imgType, err = image.Decode(buff) + if err != nil { + goto ReturnPoint + } case "image-node": //处理图像后 fn := utils.ImageToBuff(img, imgType) diff --git a/pkg/utils/image.go b/pkg/utils/image.go index 0e9097b..5c7975c 100644 --- a/pkg/utils/image.go +++ b/pkg/utils/image.go @@ -171,6 +171,8 @@ func SplitImage(buff *bytes.Buffer, w, h int) []image.Image { newHeight := int(math.Ceil(float64(img.Bounds().Dy()) / float64(h))) rect := image.Rect(0, 0, newWidth*w, newHeight*h) newImage := image.NewRGBA(rect) + black := color.RGBA{A: 255} + draw.Draw(newImage, newImage.Bounds(), &image.Uniform{C: black}, image.Point{}, draw.Src) draw.Draw(newImage, img.Bounds(), img, newImage.Bounds().Min, draw.Over) sp := splitPattern(newImage, w, h) spLen := len(sp)