This commit is contained in:
richboo111
2023-09-01 16:58:14 +08:00
parent 7edb19ac52
commit cf871b52e6

View File

@@ -500,15 +500,13 @@ 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 { //是否为纯创建
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
}
}
}
//}
if vendorCatID == 0 { //创建商品时无分类,使用推荐分类
if comTag, err := apiObj.RetailRecommendTag(name, vendorStoreID, 0, mtwmapi.TypeCategory); err == nil && comTag.TagID != 0 {
tempCatID = int64(comTag.TagID)