- up
www.qq.com 183.3.226.35
This commit is contained in:
@@ -268,48 +268,52 @@ func (p *PurchaseHandler) GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTas
|
||||
return skuNameList, err
|
||||
}
|
||||
|
||||
func vendorSku2Jx(vendorSku *mtwmapi.AppFood) (skuName *partner.SkuNameInfo) {
|
||||
prefix, name, comment, specUnit, unit, specQuality := jxutils.SplitSkuName(vendorSku.Name)
|
||||
mtwmSku := vendorSku.SkuList[0]
|
||||
weight := mtwmSku.Weight
|
||||
func vendorSku2Jx(appFood *mtwmapi.AppFood) (skuName *partner.SkuNameInfo) {
|
||||
prefix, name, comment, specUnit, unit, specQuality := jxutils.SplitSkuName(appFood.Name)
|
||||
vendorSku := appFood.SkuList[0]
|
||||
weight := vendorSku.Weight
|
||||
if weight <= 0 {
|
||||
weight = jxutils.FormatSkuWeight(specQuality, specUnit)
|
||||
}
|
||||
skuID := int(utils.Str2Int64WithDefault(vendorSku.SkuID, 0))
|
||||
skuName = &partner.SkuNameInfo{
|
||||
NameID: skuID,
|
||||
VendorNameID: vendorSku.SkuID,
|
||||
|
||||
Prefix: prefix,
|
||||
Name: name,
|
||||
Unit: unit,
|
||||
SkuList: []*partner.SkuInfo{
|
||||
&partner.SkuInfo{
|
||||
StoreSkuInfo: partner.StoreSkuInfo{
|
||||
VendorSkuID: mtwmSku.SkuID,
|
||||
SkuID: int(utils.Str2Int64WithDefault(mtwmSku.SkuID, 0)),
|
||||
VendorSkuID: vendorSku.SkuID,
|
||||
SkuID: skuID,
|
||||
|
||||
Stock: int(utils.Str2Int64WithDefault(mtwmSku.Stock, partner.UnlimitedStoreSkuStock)),
|
||||
Price: jxutils.StandardPrice2Int(utils.Str2Float64WithDefault(mtwmSku.Price, 0)),
|
||||
Status: mtwmSkuStatus2Jx(vendorSku.IsSoldOut),
|
||||
Stock: int(utils.Str2Int64WithDefault(vendorSku.Stock, partner.UnlimitedStoreSkuStock)),
|
||||
Price: jxutils.StandardPrice2Int(utils.Str2Float64WithDefault(vendorSku.Price, 0)),
|
||||
Status: mtwmSkuStatus2Jx(appFood.IsSoldOut),
|
||||
},
|
||||
SkuName: vendorSku.Name,
|
||||
SkuName: appFood.Name,
|
||||
Comment: comment,
|
||||
SpecQuality: float64(specQuality),
|
||||
SpecUnit: specUnit,
|
||||
Weight: weight,
|
||||
},
|
||||
},
|
||||
PictureList: vendorSku.PictureList,
|
||||
PictureList: appFood.PictureList,
|
||||
}
|
||||
if vendorSku.CategoryName != "" {
|
||||
skuName.VendorCatIDList = []string{vendorSku.CategoryName}
|
||||
if vendorSku.SecondaryCategoryName != "" {
|
||||
skuName.VendorCatIDList = append(skuName.VendorCatIDList, vendorSku.SecondaryCategoryName)
|
||||
if appFood.CategoryName != "" {
|
||||
skuName.VendorCatIDList = []string{appFood.CategoryName}
|
||||
if appFood.SecondaryCategoryName != "" {
|
||||
skuName.VendorCatIDList = append(skuName.VendorCatIDList, appFood.SecondaryCategoryName)
|
||||
}
|
||||
}
|
||||
return skuName
|
||||
}
|
||||
|
||||
func vendorSkuList2Jx(vendorSkuList []*mtwmapi.AppFood) (skuNameList []*partner.SkuNameInfo) {
|
||||
for _, vendorSku := range vendorSkuList {
|
||||
skuNameList = append(skuNameList, vendorSku2Jx(vendorSku))
|
||||
func vendorSkuList2Jx(appFoodList []*mtwmapi.AppFood) (skuNameList []*partner.SkuNameInfo) {
|
||||
for _, appFood := range appFoodList {
|
||||
skuNameList = append(skuNameList, vendorSku2Jx(appFood))
|
||||
}
|
||||
return skuNameList
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user