- optimize UploadWeimobImg4SkuName

This commit is contained in:
gazebo
2019-02-13 11:21:26 +08:00
parent a590c61fde
commit aa9c83ec94
2 changed files with 4 additions and 2 deletions

View File

@@ -523,7 +523,9 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
if err == nil {
dao.Commit(db)
_, err = CurVendorSync.SyncSku(ctx, db, nameID, -1, false, false, userName)
initdata.UploadWeimobImg4SkuName(ctx, []int{nameID}, true, true)
if valid["img"] != "" {
initdata.UploadWeimobImg4SkuName(ctx, []int{nameID}, true, true)
}
}
}
}

View File

@@ -203,7 +203,7 @@ func UploadWeimobImg4SkuName(ctx *jxcontext.Context, nameIDs []int, isAsync, isC
skuName := batchItemList[0].(*model.SkuName)
if skuName.Img != "" && skuName.ImgWeimob == "" {
if skuName.ImgWeimob, err = api.WeimobAPI.UploadImgByURL(skuName.Img, ""); err == nil {
_, err = dao.UpdateEntity(db, skuName)
_, err = dao.UpdateEntity(db, skuName, "ImgWeimob")
}
}
return nil, err