This commit is contained in:
邹宗楠
2022-10-19 16:05:55 +08:00
parent ac287d0d95
commit 6a323aea9a
5 changed files with 42 additions and 40 deletions

View File

@@ -450,7 +450,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
var skus []*dao.StoreSkuSyncInfo
if isFull {
skus, err = dao.GetFullStoreSkus(db, vendorID, storeID)
} else {
skus, err = dao.GetStoreSkus(db, vendorID, storeID, skuIDs)
}

View File

@@ -568,7 +568,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo
%s vendor_sku_id, t1.%s_sync_status sku_sync_status, t1.%s_price vendor_price, t1.%s_lock_time lock_time,t1.vendor_sku_attr_id,t1.vendor_main_id,
t1.store_id, t1.deleted_at bind_deleted_at,t1.status_sale_begin,t1.status_sale_end, t1.jds_ware_id, t1.stock, t1.mt_ladder_box_price,
t2.*,
t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.status name_status, t3.category_id name_category_id, t3.yb_name_suffix,
t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.status name_status, t3.category_id name_category_id, t3.yb_name_suffix,t3.tiktok_attribute,
t3.jds_stock_switch, t3.preparation_time, t3.img_watermark, t3.ex_vendor_id, t3.img img_origin,
IF(t11.%s <> '', t11.%s, t3.img) img,
IF(t12.%s <> '', t12.%s, t3.img2) img2,

View File

@@ -199,12 +199,13 @@ type SkuName struct {
// JdSyncStatus int8 `orm:"default(2)" json:"jdSyncStatus"`
// LinkID int `orm:"column(link_id);null;index" json:"linkID"`
YbNameSuffix string `json:"ybNameSuffix"` //银豹商品后缀
JdsStockSwitch int8 `orm:"default(1)" json:"jdsStockSwitch"` //京东商城总库存
PreparationTime int `orm:"default(1)" json:"preparationTime"` //商品准备时长
BestSeller int `json:"bestSeller"` //畅销品 0不是 1是
Video string `json:"video"` //商品视频地址
VideoID string `orm:"column(video_id)" json:"videoID"` //商品视频美团ID
YbNameSuffix string `json:"ybNameSuffix"` //银豹商品后缀
JdsStockSwitch int8 `orm:"default(1)" json:"jdsStockSwitch"` //京东商城总库存
PreparationTime int `orm:"default(1)" json:"preparationTime"` //商品准备时长
BestSeller int `json:"bestSeller"` //畅销品 0不是 1是
Video string `json:"video"` //商品视频地址
VideoID string `orm:"column(video_id)" json:"videoID"` //商品视频美团ID
TiktokAttribute string `orm:"column(tiktok_attribute);size(512)" json:"tiktok_attribute"` //抖音分类属性的存储
}
func (*SkuName) TableUnique() [][]string {

View File

@@ -306,12 +306,12 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
// spec_prices
param.SpecPrices = GetSpecPrices(param.Specs, vendorStoreID, 0, storeSku)
// ProductFormatNew 获取商品属性
productFormatNew, err := GetProductFormatNew(param.CategoryLeafId, storeDetail.VendorOrgCode)
globals.SugarLogger.Debugf("er=====productFormatNew=========%s", productFormatNew)
if err != nil {
return nil, err
}
param.ProductFormatNew = productFormatNew
//productFormatNew, err := GetProductFormatNew(param.CategoryLeafId, storeDetail.VendorOrgCode)
//globals.SugarLogger.Debugf("er=====productFormatNew=========%s", productFormatNew)
//if err != nil {
// return nil, err
//}
//param.ProductFormatNew = productFormatNew
// 获取品牌
param.StandardBrandId, err = api.GetSkuBrand(param.CategoryLeafId)
@@ -431,11 +431,11 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
// spec_prices
param.SpecPrices = GetSpecPrices(param.Specs, vendorStoreID, utils.Str2Int64(storeSku.VendorSkuID), storeSku)
// ProductFormatNew 获取商品属性
productFormatNew, err := GetProductFormatNew(param.CategoryLeafId, storeDetail.VendorOrgCode)
if err != nil {
return nil, err
}
param.ProductFormatNew = productFormatNew
//productFormatNew, err := GetProductFormatNew(param.CategoryLeafId, storeDetail.VendorOrgCode)
//if err != nil {
// return nil, err
//}
//param.ProductFormatNew = productFormatNew
// 获取品牌
//brandID, err := api.GetSkuBrand(param.CategoryLeafId)

View File

@@ -5,6 +5,7 @@ import (
"errors"
"fmt"
freightTemplate_create_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/freightTemplate_create/request"
product_getCatePropertyV2_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_getCatePropertyV2/response"
shop_bindStoreFreight_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_bindStoreFreight/request"
shop_bindStoreSaleLimit_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_bindStoreSaleLimit/request"
trade_createTradeLimitTemplate_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/trade_createTradeLimitTemplate/request"
@@ -125,30 +126,31 @@ func GetDeliveryTemp(api *tiktokShop.API, vendorStoreID string, storeDetail *dao
}
// GetProductFormatNew 获取物品属性
func GetProductFormatNew(categoryLeftId int64, vendorOrgCode string) (string, error) {
func GetProductFormatNew(categoryLeftId int64, vendorOrgCode string) (*product_getCatePropertyV2_response.ProductGetCatePropertyV2Response, error) {
category, err := getAPI(vendorOrgCode, 0, "").GetCatePropertyV2(categoryLeftId)
if err != nil {
return "", err
return nil, err
}
format := make(map[string][]*tiktokShop.ProductFormatNewList, 0)
for _, v := range category.Data.Data {
if v.Required != 1 { // 必填属性必须填写
continue
}
for _, d := range v.Options {
formateNew := &tiktokShop.ProductFormatNewList{
Value: utils.Str2Int64(d.Value),
Name: d.Name,
DiyType: v.DiyType,
}
format[utils.Int64ToStr(v.PropertyId)] = append(format[utils.Int64ToStr(v.CategoryId)], formateNew)
}
}
productFormatNew, err := json.Marshal(format)
if err != nil {
return "", err
}
return string(productFormatNew), nil
return category, nil
//format := make(map[string][]*tiktokShop.ProductFormatNewList, 0)
//for _, v := range category.Data.Data {
// if v.Required != 1 { // 必填属性必须填写
// continue
// }
// for _, d := range v.Options {
// formateNew := &tiktokShop.ProductFormatNewList{
// Value: utils.Str2Int64(d.Value),
// Name: d.Name,
// DiyType: v.DiyType,
// }
// format[utils.Int64ToStr(v.PropertyId)] = append(format[utils.Int64ToStr(v.CategoryId)], formateNew)
// }
//}
//productFormatNew, err := json.Marshal(format)
//if err != nil {
// return "", err
//}
//return string(productFormatNew), nil
}
// GetTiktokImgList 获取抖音图片链接