This commit is contained in:
邹宗楠
2025-04-27 13:53:28 +08:00
parent 4103676275
commit e607e62f1d

View File

@@ -5,7 +5,6 @@ import (
"errors" "errors"
"fmt" "fmt"
product_addV2_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_addV2/response" product_addV2_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_addV2/response"
"git.rosy.net.cn/jx-callback/globals"
beego "github.com/astaxie/beego/server/web" beego "github.com/astaxie/beego/server/web"
"strings" "strings"
"time" "time"
@@ -1096,7 +1095,6 @@ func MakeProductFormatNew(api *tiktokShop.API, skuNameId int64, categoryLeafId i
} }
categoryMap := make(map[string][]map[string]interface{}) categoryMap := make(map[string][]map[string]interface{})
tiktokBrandId, _ := getTiktokBrandId(api, db, upcCode, upcBrandName, upcTiktokBrandId, categoryLeafId) tiktokBrandId, _ := getTiktokBrandId(api, db, upcCode, upcBrandName, upcTiktokBrandId, categoryLeafId)
globals.SugarLogger.Debugf("---------categoryList.Data.Data- := %s", utils.Format4Output(categoryList.Data.Data, false))
for _, v := range categoryList.Data.Data { for _, v := range categoryList.Data.Data {
if v.Required != model.YES { if v.Required != model.YES {
continue continue
@@ -1108,16 +1106,14 @@ func MakeProductFormatNew(api *tiktokShop.API, skuNameId int64, categoryLeafId i
} else if v.PropertyName == "产地" { } else if v.PropertyName == "产地" {
options = append(options, map[string]interface{}{"name": v.PropertyName, "value": 13850, "diy_type": v.DiyType}) options = append(options, map[string]interface{}{"name": v.PropertyName, "value": 13850, "diy_type": v.DiyType})
categoryMap[utils.Int64ToStr(v.PropertyId)] = options categoryMap[utils.Int64ToStr(v.PropertyId)] = options
} else if len(options) == 0 { } else if len(v.Options) == 0 {
options = append(options, map[string]interface{}{"name": v.PropertyName, "value": 0, "diy_type": v.DiyType}) options = append(options, map[string]interface{}{"name": v.PropertyName, "value": 0, "diy_type": v.DiyType})
categoryMap[utils.Int64ToStr(v.PropertyId)] = options categoryMap[utils.Int64ToStr(v.PropertyId)] = options
} else { } else {
globals.SugarLogger.Debugf("---------Options- := %s", utils.Format4Output(v.Options, false))
options = append(options, map[string]interface{}{"name": v.PropertyName, "value": v.Options[0].Value, "diy_type": v.DiyType}) options = append(options, map[string]interface{}{"name": v.PropertyName, "value": v.Options[0].Value, "diy_type": v.DiyType})
categoryMap[utils.Int64ToStr(v.PropertyId)] = options categoryMap[utils.Int64ToStr(v.PropertyId)] = options
} }
} }
globals.SugarLogger.Debugf("---------ccategoryMap- := %s", utils.Format4Output(categoryMap, false))
productFormatNew := utils.Format4Output(categoryMap, false) productFormatNew := utils.Format4Output(categoryMap, false)
dao.UpdateSkuNameTiktokAttr(dao.GetDB(), skuNameId, productFormatNew) dao.UpdateSkuNameTiktokAttr(dao.GetDB(), skuNameId, productFormatNew)
return utils.Format4Output(categoryMap, false), tiktokBrandId, nil return utils.Format4Output(categoryMap, false), tiktokBrandId, nil