This commit is contained in:
richboo111
2023-09-01 16:37:00 +08:00
parent 22ff84a59d
commit 7edb19ac52
2 changed files with 7 additions and 11 deletions

View File

@@ -500,15 +500,15 @@ func SwitchAttr(apiObj *mtwmapi.API, vendorStoreID string, vendorCatID int64, na
attrValue CommonAttrValue
attrValues []CommonAttrValue
)
if nameID != 0 { //是否为纯创建
globals.SugarLogger.Debugf("SwitchAttr nameID=%d", nameID)
if tData, err := dao.GetSkuNames(db, []int{nameID}, nil, "", false); err == nil && len(tData) > 0 {
globals.SugarLogger.Debugf("SwitchAttr tData=%s", utils.Format4Output(tData, false))
if tData[0].MtAttribute != "[]" && tData[0].MtAttribute != "{}" && tData[0].MtAttribute != "" {
return tData[0].MtAttribute
}
//if nameID != 0 { //是否为纯创建
globals.SugarLogger.Debugf("SwitchAttr nameID=%d", nameID)
if tData, err := dao.GetSkuNames(db, []int{nameID}, nil, "", false); err == nil && len(tData) > 0 {
globals.SugarLogger.Debugf("SwitchAttr tData=%s", utils.Format4Output(tData, false))
if tData[0].MtAttribute != "[]" && tData[0].MtAttribute != "{}" && tData[0].MtAttribute != "" {
return tData[0].MtAttribute
}
}
//}
if vendorCatID == 0 { //创建商品时无分类,使用推荐分类
if comTag, err := apiObj.RetailRecommendTag(name, vendorStoreID, 0, mtwmapi.TypeCategory); err == nil && comTag.TagID != 0 {
tempCatID = int64(comTag.TagID)