新增小程序扫码建商品

This commit is contained in:
苏尹岚
2020-04-01 15:43:35 +08:00
parent 25e4afd974
commit b33031abc9
3 changed files with 111 additions and 5 deletions

View File

@@ -36,8 +36,9 @@ func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, v
failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDYB], "创建商品")
} else {
storeSku.VendorSkuID = utils.Int64ToStr(result.UID)
// uploadYbImage(vendorStoreID, storeSku.YbBarCode, storeSku.Img)
if !flag {
updateYbSkuPluCode(vendorStoreID, storeSku.YbBarCode)
updateYbSku(vendorStoreID, storeSku.YbBarCode)
}
}
}
@@ -447,7 +448,7 @@ func convertVendorCatList(remoteCats []*yinbaoapi.LoadCategorysWithOptionResult)
return cats
}
func updateYbSkuPluCode(vendorStoreID, ybBarCode string) (err error) {
func updateYbSku(vendorStoreID, ybBarCode string) (err error) {
for {
err = api.YinBaoAPI.SaveProduct(vendorStoreID, ybBarCode)
if err == nil {
@@ -458,7 +459,7 @@ func updateYbSkuPluCode(vendorStoreID, ybBarCode string) (err error) {
if err != nil {
break
}
err = updateYbSkuPluCode(vendorStoreID, ybBarCode)
err = updateYbSku(vendorStoreID, ybBarCode)
} else {
break
}
@@ -482,3 +483,11 @@ func checkYbSku(storeSku *dao.StoreSkuSyncInfo) (flag bool, err error) {
}
return flag, err
}
// func uploadYbImage(vendorStoreID, ybBarCode, img string) (err error) {
// ybSkuID, err := api.YinBaoAPI.LoadProductsByPage(vendorStoreID, ybBarCode)
// resBinary, _, err := jxutils.DownloadFileByURL(img)
// api.YinBaoAPI.UploadProductImage(vendorStoreID, ybSkuID, file)
// return err
// }