This commit is contained in:
richboo111
2023-09-01 16:23:24 +08:00
parent 6ee80aa437
commit 22ff84a59d
2 changed files with 6 additions and 0 deletions

View File

@@ -4,6 +4,8 @@ import (
"fmt"
"time"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
@@ -132,7 +134,9 @@ func BatchInitData(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi *mt
foodData["min_order_count"] = 1
}
foodData["unit"] = storeSku.Unit
globals.SugarLogger.Debugf("BatchInitData storeSku=%s", utils.Format4Output(storeSku, false))
attr := mtwm.SwitchAttr(toApi, vendorStoreID, int64(storeSku.TagID), 0, storeSku.Name)
globals.SugarLogger.Debugf("BatchInitData attr=%s", attr)
if attr != "" {
foodData["common_attr_value"] = attr
}

View File

@@ -501,7 +501,9 @@ func SwitchAttr(apiObj *mtwmapi.API, vendorStoreID string, vendorCatID int64, na
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
}