aa
This commit is contained in:
@@ -3,6 +3,7 @@ package jdshopapi
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
"image/gif"
|
"image/gif"
|
||||||
@@ -41,14 +42,15 @@ func TestDeleteShopCategory(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUploadPicture(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, "")
|
// img, outMimeType, _ := Binary2Image(data, "")
|
||||||
// result2, _ := Image2Binary(img, outMimeType)
|
// result2, _ := Image2Binary(img, outMimeType)
|
||||||
result, err := api.UploadPicture(data, 0, "noGoodsImg")
|
fmt.Println(base64.StdEncoding.EncodeToString(data))
|
||||||
if err != nil {
|
//result, err := api.UploadPicture(data, 0, "noGoodsImg")
|
||||||
t.Fatal(err)
|
//if err != nil {
|
||||||
}
|
// t.Fatal(err)
|
||||||
t.Log(utils.Format4Output(result, false))
|
//}
|
||||||
|
//t.Log(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
func DownloadFileByURL(fileURL string) (bodyData []byte, fileMD5 string, err error) {
|
func DownloadFileByURL(fileURL string) (bodyData []byte, fileMD5 string, err error) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package mtunionapi
|
package mtunionapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
@@ -40,7 +41,9 @@ func (a *API) GetCallbackMsg(request *http.Request) (call *CallBackResult, err e
|
|||||||
}
|
}
|
||||||
mapData := utils.URLValues2Map(values)
|
mapData := utils.URLValues2Map(values)
|
||||||
fmt.Println("1111111111111111111", mapData)
|
fmt.Println("1111111111111111111", mapData)
|
||||||
utils.Map2StructByJson(mapData, &call, false)
|
for k, _ := range mapData {
|
||||||
|
json.Unmarshal([]byte(k), &call)
|
||||||
|
}
|
||||||
fmt.Println("2222222222222222222", utils.Format4Output(call, true))
|
fmt.Println("2222222222222222222", utils.Format4Output(call, true))
|
||||||
return call, err
|
return call, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user