上传图片测试
This commit is contained in:
@@ -77,8 +77,6 @@ func RegisterDataResource(ctx *jxcontext.Context, name, resourceURL, mimeType, h
|
||||
return nil, fmt.Errorf("MIME type:%s非法,当前只支持:%s", mimeType, model.GetValidMimeTypeDesc())
|
||||
}
|
||||
img, _, err := Binary2Image(resBinary, mimeType)
|
||||
fmt.Println("testtttt", img)
|
||||
fmt.Println("testtttt", err)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -87,6 +85,7 @@ func RegisterDataResource(ctx *jxcontext.Context, name, resourceURL, mimeType, h
|
||||
return nil, fmt.Errorf("图片大小:%dx%d非法,要求必须:%dx%d", img.Bounds().Dx(), img.Bounds().Dy(), MainImgWidth, MainImgHeight)
|
||||
}
|
||||
}
|
||||
fmt.Println("test11111111111111111111111111111111111")
|
||||
dataRes = &model.DataResource{
|
||||
Name: name,
|
||||
HashCode: hashCode,
|
||||
@@ -102,10 +101,11 @@ func RegisterDataResource(ctx *jxcontext.Context, name, resourceURL, mimeType, h
|
||||
case model.VendorIDEBAI:
|
||||
dataRes.EbaiURL = resourceURL
|
||||
}
|
||||
|
||||
fmt.Println("test222222222222222222222222222222222222222")
|
||||
dao.WrapAddIDCULEntity(dataRes, ctx.GetUserName())
|
||||
if err = dao.CreateEntity(dao.GetDB(), dataRes); err != nil {
|
||||
if dao.IsDuplicateError(err) {
|
||||
fmt.Println("test4444444444444444444444444444444444")
|
||||
dataRes, err = dao.GetDataResource(dao.GetDB(), dataRes.HashCode, dataRes.MainURL)
|
||||
} else {
|
||||
dataRes = nil
|
||||
@@ -114,6 +114,7 @@ func RegisterDataResource(ctx *jxcontext.Context, name, resourceURL, mimeType, h
|
||||
}
|
||||
if imgType > 0 {
|
||||
if globals.EnableStoreWrite {
|
||||
fmt.Println("test333333333333333333333333333333333")
|
||||
// 忽略上传错误
|
||||
UploadImage2Vendors(ctx, nil, dataRes, resBinary, isAsyncUpload2Vendor)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user