上传图片测试
This commit is contained in:
@@ -77,6 +77,9 @@ 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("test11111111111111111111111111111111")
|
||||
img.Bounds()
|
||||
fmt.Println("test2122222222222222222222222222222222")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -85,7 +88,6 @@ 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,
|
||||
@@ -101,11 +103,9 @@ 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,7 +114,6 @@ 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