尝试银豹skuname上
This commit is contained in:
@@ -498,6 +498,29 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
return skuList
|
||||
}
|
||||
isContinueWhenError2 := true
|
||||
//如果是银豹平台,则要按照商品skuname维度同步
|
||||
var changeList2Yb = func(list1 []*dao.StoreSkuSyncInfo, list2 []*partner.StoreSkuInfo) {
|
||||
var (
|
||||
skuNameMap = make(map[int]*dao.StoreSkuSyncInfo)
|
||||
)
|
||||
for _, v := range list1 {
|
||||
skuNameMap[v.NameID] = v
|
||||
}
|
||||
list1 = list1[:]
|
||||
for _, v := range skuNameMap {
|
||||
list1 = append(list1, v)
|
||||
}
|
||||
for _, v := range list1 {
|
||||
v.YbBarCode = storeDetail.YbStorePrefix + v.YbNameSuffix
|
||||
}
|
||||
}
|
||||
if vendorID == model.VendorIDYB {
|
||||
// createList, updateList []*dao.StoreSkuSyncInfo
|
||||
// deleteList, stockList, onlineList, offlineList, priceList []*partner.StoreSkuInfo
|
||||
if len(createList) > 0 {
|
||||
changeList2Yb(createList, nil)
|
||||
}
|
||||
}
|
||||
task := tasksch.NewParallelTask("syncStoreSkuNew", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError2), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
step := batchItemList[0].(int)
|
||||
|
||||
@@ -47,8 +47,9 @@ type StoreDetail struct {
|
||||
JdStoreLevel string `json:"jdStoreLevel"` //京东门店等级
|
||||
IsOrder int `json:"isOrder"` //是否是下预订单门店
|
||||
|
||||
YbAppID string `orm:"column(yb_app_id)" json:"ybAppID"`
|
||||
YbAppKey string `json:"ybAppKey"`
|
||||
YbAppID string `orm:"column(yb_app_id)" json:"ybAppID"`
|
||||
YbAppKey string `json:"ybAppKey"`
|
||||
YbStorePrefix string `json:"ybStorePrefix"`
|
||||
}
|
||||
|
||||
// 带快递门店信息的
|
||||
@@ -92,7 +93,7 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto
|
||||
sql := `
|
||||
SELECT t1.*,
|
||||
t2.vendor_store_id, t2.status vendor_status, t2.delivery_fee_deduction_sill, t2.delivery_fee_deduction_fee, t2.sync_status, t2.vendor_org_code,
|
||||
t2.price_percentage, t2.auto_pickup, t2.delivery_type, t2.delivery_competition, t2.is_sync, t2.vendor_store_name, t2.is_order, t2.yb_app_id, t2.yb_app_key,
|
||||
t2.price_percentage, t2.auto_pickup, t2.delivery_type, t2.delivery_competition, t2.is_sync, t2.vendor_store_name, t2.is_order, t2.yb_app_id, t2.yb_app_key, t2.yb_store_prefix,
|
||||
t3.value price_percentage_pack_str,
|
||||
t4.value freight_deduction_pack_str,
|
||||
district.name district_name,
|
||||
|
||||
@@ -80,7 +80,9 @@ type StoreSkuSyncInfo struct {
|
||||
IsGlobal int8 `orm:"default(1)" json:"isGlobal"` // 是否是全部(全国)可见,如果否的话,可见性由SkuPlace决定
|
||||
NameStatus int
|
||||
SellCities []string
|
||||
NameCategoryID int `orm:"column(name_category_id)"`
|
||||
NameCategoryID int `orm:"column(name_category_id)"`
|
||||
YbNameSuffix string //银豹的商品条码后缀
|
||||
YbBarCode string //银豹的商品条码
|
||||
|
||||
// 平台相关的图片信息
|
||||
Img string
|
||||
@@ -394,7 +396,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.store_id, t1.deleted_at bind_deleted_at,t1.status_sale_begin,t1.status_sale_end,
|
||||
t2.*,
|
||||
t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.status name_status, t3.ex_prefix, t3.ex_prefix_begin, t3.ex_prefix_end, t3.category_id name_category_id,
|
||||
t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.status name_status, t3.ex_prefix, t3.ex_prefix_begin, t3.ex_prefix_end, t3.category_id name_category_id, t3.yb_name_suffix,
|
||||
IF(t11.%s <> '', t11.%s, t3.img) img,
|
||||
IF(t12.%s <> '', t12.%s, t3.img2) img2,
|
||||
t13.%s desc_img,
|
||||
|
||||
@@ -324,14 +324,15 @@ func loopPages(parameterType, parameterValue string, skuNameList []*partner.SkuN
|
||||
|
||||
func buildProductInfoParam(storeSku *dao.StoreSkuSyncInfo) (productInfoParam *yinbaoapi.ProductInfoParam) {
|
||||
var (
|
||||
buyPrice float64 = utils.Str2Float64(utils.Int64ToStr(storeSku.Price)) / 100
|
||||
sellPrice float64 = utils.Str2Float64(utils.Int64ToStr(storeSku.VendorPrice)) / 100
|
||||
buyPrice float64 = utils.Str2Float64(utils.Int64ToStr(storeSku.Price)) / 100
|
||||
sellPrice float64 = utils.Str2Float64(utils.Int64ToStr(storeSku.VendorPrice)) / 100
|
||||
_, name, _, _, _, _ = jxutils.SplitSkuName(storeSku.SkuName)
|
||||
)
|
||||
productInfoParam = &yinbaoapi.ProductInfoParam{}
|
||||
productInfo := &yinbaoapi.ProductInfo{
|
||||
Stock: utils.Float64ToPointer(utils.Str2Float64(utils.Int2Str(model.MaxStoreSkuStockQty))),
|
||||
Name: storeSku.SkuName,
|
||||
Barcode: utils.Int2Str(storeSku.SkuID),
|
||||
Name: name,
|
||||
Barcode: storeSku.YbBarCode,
|
||||
BuyPrice: &buyPrice,
|
||||
SellPrice: &sellPrice,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user