mt sku
This commit is contained in:
@@ -2,6 +2,8 @@ package cms
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
@@ -11,7 +13,6 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/mtwm"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/putils"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CopyOnStoreSkuToOther 将一个美团门店分类和商品复制到另一个门店
|
||||
@@ -131,7 +132,7 @@ func BatchInitData(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi *mt
|
||||
foodData["min_order_count"] = 1
|
||||
}
|
||||
foodData["unit"] = storeSku.Unit
|
||||
attr := mtwm.SwitchAttr(int64(storeSku.TagID))
|
||||
attr := mtwm.SwitchAttr(toApi, vendorStoreID, int64(storeSku.TagID), 0, storeSku.Name)
|
||||
if attr != "" {
|
||||
foodData["common_attr_value"] = attr
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
}
|
||||
foodData["unit"] = storeSku.Unit
|
||||
//todo 增加商品必填属性
|
||||
attr := SwitchAttr(getAPI(getStoreVendorOrgCode(storeID), storeID, vendorStoreID), vendorStoreID, storeSku.VendorVendorCatID, storeSku.NameID, storeSku.Name, isCreate)
|
||||
attr := SwitchAttr(getAPI(getStoreVendorOrgCode(storeID), storeID, vendorStoreID), vendorStoreID, storeSku.VendorVendorCatID, storeSku.NameID, storeSku.Name)
|
||||
if attr != "" {
|
||||
foodData["common_attr_value"] = attr
|
||||
}
|
||||
@@ -493,14 +493,14 @@ type ValueList struct {
|
||||
Value string `json:"value"` //普通属性值名称(与普通属性值Id一一对应),支持自定义。
|
||||
}
|
||||
|
||||
func SwitchAttr(apiObj *mtwmapi.API, vendorStoreID string, vendorCatID int64, nameID int, name string, isNeed bool) (attrs string) {
|
||||
func SwitchAttr(apiObj *mtwmapi.API, vendorStoreID string, vendorCatID int64, nameID int, name string) (attrs string) {
|
||||
var (
|
||||
db *dao.DaoDB
|
||||
tempCatID int64
|
||||
attrValue CommonAttrValue
|
||||
attrValues []CommonAttrValue
|
||||
)
|
||||
if isNeed == false && nameID != 0 { //是否为纯创建
|
||||
if nameID != 0 { //是否为纯创建
|
||||
if tData, err := dao.GetSkuNames(db, []int{nameID}, nil, "", false); err == nil && len(tData) > 0 {
|
||||
if tData[0].MtAttribute != "[]" && tData[0].MtAttribute != "{}" && tData[0].MtAttribute != "" {
|
||||
return tData[0].MtAttribute
|
||||
|
||||
Reference in New Issue
Block a user