From be93f2d9c864306d3e6aac636366f46f420b198f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 21 Apr 2021 09:25:35 +0800 Subject: [PATCH] aa --- platformapi/jdshopapi/sku_test.go | 14 ++++++++------ platformapi/mtunionapi/callback.go | 5 ++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/platformapi/jdshopapi/sku_test.go b/platformapi/jdshopapi/sku_test.go index 6cb51274..489d34f9 100644 --- a/platformapi/jdshopapi/sku_test.go +++ b/platformapi/jdshopapi/sku_test.go @@ -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) { diff --git a/platformapi/mtunionapi/callback.go b/platformapi/mtunionapi/callback.go index efd84784..2a8dd81f 100644 --- a/platformapi/mtunionapi/callback.go +++ b/platformapi/mtunionapi/callback.go @@ -1,6 +1,7 @@ package mtunionapi import ( + "encoding/json" "fmt" "git.rosy.net.cn/baseapi/utils" "io/ioutil" @@ -40,7 +41,9 @@ func (a *API) GetCallbackMsg(request *http.Request) (call *CallBackResult, err e } mapData := utils.URLValues2Map(values) 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)) return call, err }