读取永辉excel
This commit is contained in:
@@ -248,6 +248,17 @@ func GetGoodsInfoAndDetailMap(goodsList []*weimobapi.GoodsInfo) (goodsMap map[st
|
|||||||
return goodsMap
|
return goodsMap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// func getSelectedClassifyLeafList(l []weimobapi.SelectedClassifyList) (list []int64) {
|
||||||
|
// for _, v := range l {
|
||||||
|
// if v.ChildrenClassify == nil {
|
||||||
|
// list = append(list, v.ClassifyID)
|
||||||
|
// } else {
|
||||||
|
// subList := getSelectedClassifyLeafList(v.ChildrenClassify)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return list
|
||||||
|
// }
|
||||||
|
|
||||||
func updateWeiMobGoods(costPrice, salePrice float64, goodsDetail *weimobapi.GoodsDetailInfo) (goodsID int64, skuMap map[string]int64, err error) {
|
func updateWeiMobGoods(costPrice, salePrice float64, goodsDetail *weimobapi.GoodsDetailInfo) (goodsID int64, skuMap map[string]int64, err error) {
|
||||||
var (
|
var (
|
||||||
categoryList []*weimobapi.CategoryList
|
categoryList []*weimobapi.CategoryList
|
||||||
@@ -272,6 +283,7 @@ func updateWeiMobGoods(costPrice, salePrice float64, goodsDetail *weimobapi.Good
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
baseapi.SugarLogger.Errorf("FindFreightTemplateList error:%v", err)
|
baseapi.SugarLogger.Errorf("FindFreightTemplateList error:%v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
//寻找分类子ID
|
//寻找分类子ID
|
||||||
categoryList = goodsDetail.CategoryList
|
categoryList = goodsDetail.CategoryList
|
||||||
if len(categoryList) > 0 {
|
if len(categoryList) > 0 {
|
||||||
@@ -279,6 +291,17 @@ func updateWeiMobGoods(costPrice, salePrice float64, goodsDetail *weimobapi.Good
|
|||||||
} else {
|
} else {
|
||||||
return 0, nil, errors.New(fmt.Sprintf("未查询到此商品的分类信息!goodsID : [%v] ,", goodsDetail.GoodsID))
|
return 0, nil, errors.New(fmt.Sprintf("未查询到此商品的分类信息!goodsID : [%v] ,", goodsDetail.GoodsID))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectedClassifyList := goodsDetail.SelectedClassifyList
|
||||||
|
var selectedClassifyListID []int64
|
||||||
|
if len(selectedClassifyList) > 0 {
|
||||||
|
for _, v := range selectedClassifyList {
|
||||||
|
selectedClassifyListID = append(selectedClassifyListID, v.ChildrenClassify[0].ClassifyID)
|
||||||
|
}
|
||||||
|
// categoryID = categoryList[len(categoryList)-1].CategoryID
|
||||||
|
} else {
|
||||||
|
return 0, nil, errors.New(fmt.Sprintf("未查询到此商品的分类信息!goodsID : [%v] ,", goodsDetail.GoodsID))
|
||||||
|
}
|
||||||
b2CSku := &weimobapi.B2CSku{
|
b2CSku := &weimobapi.B2CSku{
|
||||||
Weight: skuListInfo.B2CSku.Weight,
|
Weight: skuListInfo.B2CSku.Weight,
|
||||||
Volume: skuListInfo.B2CSku.Volume,
|
Volume: skuListInfo.B2CSku.Volume,
|
||||||
@@ -298,16 +321,17 @@ func updateWeiMobGoods(costPrice, salePrice float64, goodsDetail *weimobapi.Good
|
|||||||
}
|
}
|
||||||
skuListParam = append(skuListParam, skuList)
|
skuListParam = append(skuListParam, skuList)
|
||||||
goods := &weimobapi.Goods{
|
goods := &weimobapi.Goods{
|
||||||
B2CGoods: b2CGoods,
|
B2CGoods: b2CGoods,
|
||||||
SkuList: skuListParam,
|
SkuList: skuListParam,
|
||||||
Title: goodsDetail.Title,
|
Title: goodsDetail.Title,
|
||||||
IsMultiSku: goodsDetail.IsMultiSku,
|
IsMultiSku: goodsDetail.IsMultiSku,
|
||||||
IsPutAway: weimobapi.GoodsTypeNormal,
|
IsPutAway: weimobapi.GoodsTypeNormal,
|
||||||
GoodsImageURL: goodsDetail.GoodsImageURL,
|
GoodsImageURL: goodsDetail.GoodsImageURL,
|
||||||
GoodsID: goodsDetail.GoodsID,
|
GoodsID: goodsDetail.GoodsID,
|
||||||
CategoryID: categoryID,
|
CategoryID: categoryID,
|
||||||
OuterGoodsCode: goodsDetail.OuterGoodsCode,
|
OuterGoodsCode: goodsDetail.OuterGoodsCode,
|
||||||
PointDeductRatio: goodsDetail.PointDeductRatio,
|
PointDeductRatio: goodsDetail.PointDeductRatio,
|
||||||
|
SelectedClassifyIDList: selectedClassifyID,
|
||||||
}
|
}
|
||||||
updateGoodsParam := &weimobapi.UpdateGoodsParam{
|
updateGoodsParam := &weimobapi.UpdateGoodsParam{
|
||||||
Goods: goods,
|
Goods: goods,
|
||||||
|
|||||||
Reference in New Issue
Block a user