This commit is contained in:
邹宗楠
2023-07-06 18:52:18 +08:00
parent eb86c1805d
commit 9644387ae5
2 changed files with 3 additions and 17 deletions

View File

@@ -20,22 +20,7 @@ import (
// 上传图片
func TestUploadImg(t *testing.T) {
responseImg, err := http.Get("http://image.jxc4.com/8b7e117eb51bda162ea7fd249086d2e0.png")
if err != nil {
globals.SugarLogger.Debugf("img err := %s", err.Error())
return
}
imgByte, _ := ioutil.ReadAll(responseImg.Body)
globals.SugarLogger.Debugf("=======imgByte := %s", utils.Format4Output(len(imgByte), false))
data, err := apiTao.UploadImg(&request1475.AlibabaWdkPictureUploadRequest{
PictureCategoryId: utils.Int64ToPointer(0),
Img: &imgByte,
ImgInputTitle: utils.String2Pointer("059c91725ee08443a4aaa204d1f54032.png"),
Title: utils.String2Pointer("059c91725ee08443a4aaa204d1f54032"),
})
globals.SugarLogger.Debugf("=======data := %s", utils.Format4Output(data, false))
globals.SugarLogger.Debugf("=======err2 := %s", utils.Format4Output(err, false))
uploadImg(apiTao, []string{"http://image.jxc4.com/9e8e8471ba959d10166d0cf4f08ccb2d.jpg"})
}
func TestAddStoreSku(t *testing.T) {
@@ -190,7 +175,6 @@ func TestGetSkuDetaul(t *testing.T) {
globals.SugarLogger.Debugf("err := %s ", utils.Format4Output(err, false))
globals.SugarLogger.Debugf("result := %s ", utils.Format4Output(result, false))
}
func uploadImg(api *API, imgs []string) *string {
result := make([]string, 0, 0)
for _, v := range imgs {

View File

@@ -23,5 +23,7 @@ func (a *API) UploadImg(param *request.AlibabaWdkPictureUploadRequest) (string,
return "", fmt.Errorf(*data.Result.ErrMsg)
}
globals.SugarLogger.Debugf("UploadImg Data := %s", utils.Format4Output(data, false))
return *data.Result.Model.FullUrl, nil
}