aa
This commit is contained in:
@@ -3,6 +3,7 @@ package jdshopapi
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/md5"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"image"
|
||||
"image/gif"
|
||||
@@ -41,14 +42,15 @@ func TestDeleteShopCategory(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUploadPicture(t *testing.T) {
|
||||
data, _, err := DownloadFileByURL("https://image.jxc4.com/noGoodsImg.jpg")
|
||||
data, _, _ := DownloadFileByURL("http://image.jxc4.com/image/5de25b52598d7327b17399d6ddba0197.jpg")
|
||||
// img, outMimeType, _ := Binary2Image(data, "")
|
||||
// result2, _ := Image2Binary(img, outMimeType)
|
||||
result, err := api.UploadPicture(data, 0, "noGoodsImg")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
fmt.Println(base64.StdEncoding.EncodeToString(data))
|
||||
//result, err := api.UploadPicture(data, 0, "noGoodsImg")
|
||||
//if err != nil {
|
||||
// t.Fatal(err)
|
||||
//}
|
||||
//t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func DownloadFileByURL(fileURL string) (bodyData []byte, fileMD5 string, err error) {
|
||||
|
||||
Reference in New Issue
Block a user