1
This commit is contained in:
@@ -439,7 +439,6 @@ func checkNameLength(name string, weight int, uint string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func uploadImg(api *tao_vegetable.API, imgs []string) *string {
|
func uploadImg(api *tao_vegetable.API, imgs []string) *string {
|
||||||
globals.SugarLogger.Debugf("imgs==== := %s", utils.Format4Output(imgs, false))
|
|
||||||
result := make([]string, 0, 0)
|
result := make([]string, 0, 0)
|
||||||
for _, v := range imgs {
|
for _, v := range imgs {
|
||||||
if v == "" {
|
if v == "" {
|
||||||
@@ -453,6 +452,11 @@ func uploadImg(api *tao_vegetable.API, imgs []string) *string {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
body, _ := ioutil.ReadAll(resp.Body)
|
body, _ := ioutil.ReadAll(resp.Body)
|
||||||
|
// 图片失效
|
||||||
|
if strings.Contains(string(body), "Document not found") || len(body) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if newImg, _ := api.UploadImg(&request1475.AlibabaWdkPictureUploadRequest{
|
if newImg, _ := api.UploadImg(&request1475.AlibabaWdkPictureUploadRequest{
|
||||||
PictureCategoryId: utils.Int64ToPointer(0),
|
PictureCategoryId: utils.Int64ToPointer(0),
|
||||||
Img: &body,
|
Img: &body,
|
||||||
@@ -462,9 +466,6 @@ func uploadImg(api *tao_vegetable.API, imgs []string) *string {
|
|||||||
result = append(result, newImg)
|
result = append(result, newImg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
defer func() {
|
|
||||||
globals.SugarLogger.Debugf("result==== := %s", utils.Format4Output(result, false))
|
|
||||||
}()
|
|
||||||
// 商品图片最多五张
|
// 商品图片最多五张
|
||||||
if len(result) > 5 {
|
if len(result) > 5 {
|
||||||
return utils.String2Pointer(strings.Join(result[1:], ","))
|
return utils.String2Pointer(strings.Join(result[1:], ","))
|
||||||
|
|||||||
Reference in New Issue
Block a user