This commit is contained in:
richboo111
2023-08-31 14:34:27 +08:00
parent 86ff0d854b
commit 6ec674a89e
2 changed files with 6 additions and 5 deletions

View File

@@ -495,10 +495,9 @@ type ValueList struct {
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
db *dao.DaoDB
tempCatID int64
attrValue CommonAttrValue
)
if nameID != 0 { //是否为纯创建
if tData, err := dao.GetSkuNames(db, []int{nameID}, nil, "", false); err == nil && len(tData) > 0 {
@@ -516,6 +515,7 @@ func SwitchAttr(apiObj *mtwmapi.API, vendorStoreID string, vendorCatID int64, na
}
//根据类目id获取类目属性列表
if attrList, err := apiObj.CategoryAttrList(tempCatID); err == nil && len(attrList) > 0 {
globals.SugarLogger.Debugf("SwitchAttr attrList==================%s", utils.Format4Output(attrList, false))
for _, v := range attrList {
if v.Need == mtwmapi.NeedYes {
attrValue = CommonAttrValue{
@@ -539,6 +539,7 @@ func SwitchAttr(apiObj *mtwmapi.API, vendorStoreID string, vendorCatID int64, na
}
}
}
var attrValues []CommonAttrValue
attrValues = append(attrValues, attrValue)
temp, _ := json.Marshal(attrValues)
attrs = string(temp)