This commit is contained in:
邹宗楠
2025-02-20 17:08:28 +08:00
parent 8e7e2421a7
commit b15175006b
5 changed files with 24 additions and 22 deletions

View File

@@ -573,7 +573,7 @@ func ModifyPetOrderSkusStock(db *dao.DaoDB, order *model.GoodsOrder, isAdd bool)
dao.UpdateEntity(db, ss, "Stock")
}
}
_, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, nil, storeIdList, false, skuIDList, nil, model.SyncFlagStoreSkuModifiedMask, true, true)
_, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, nil, storeIdList, false, skuIDList, nil, model.SyncFlagStockMask, true, true)
_, err = cms.SyncSkus(jxcontext.AdminCtx, nil, nil, []string{"309558"}, nil, skuIDList, true)
return err
}

View File

@@ -750,16 +750,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
}
globals.SugarLogger.Debugf("------createList := %s", utils.Format4Output(createList, false))
globals.SugarLogger.Debugf("------updateList := %s", utils.Format4Output(updateList, false))
globals.SugarLogger.Debugf("------deleteList := %s", utils.Format4Output(deleteList, false))
globals.SugarLogger.Debugf("------stockList := %s", utils.Format4Output(stockList, false))
globals.SugarLogger.Debugf("------onlineList := %s", utils.Format4Output(onlineList, false))
globals.SugarLogger.Debugf("------offlineList := %s", utils.Format4Output(offlineList, false))
globals.SugarLogger.Debugf("------priceList := %s", utils.Format4Output(priceList, false))
globals.SugarLogger.Debugf("------updateItems := %s", utils.Format4Output(updateItems, false))
globals.SugarLogger.Debugf("------reorderSkuMap := %s", utils.Format4Output(reorderSkuMap, false))
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)

View File

@@ -1,6 +1,7 @@
package ebai
import (
beego "github.com/astaxie/beego/server/web"
"regexp"
"strings"
"time"
@@ -455,9 +456,9 @@ func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo, isCreate, isE
"url": storeSku.Img5,
})
}
params = map[string]interface{}{
// "name": utils.LimitMixedStringLen(storeSku.SkuName, ebaiapi.MaxSkuNameByteCount),
"left_num": model.MaxStoreSkuStockQty,
// "category_id": utils.Str2Int64(storeSku.VendorCatID),
//"predict_cat": 0, // 不使用推荐类目
// "cat3_id": getEbaiCat(storeSku.VendorVendorCatID),
@@ -465,6 +466,12 @@ func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo, isCreate, isE
"photos": photos,
"preparation_time": storeSku.PreparationTime,
}
if storeSku.Stock == 0 && beego.BConfig.RunMode != model.ServerTypePet {
params["left_num"] = model.MaxStoreSkuStockQty
} else {
params["left_num"] = storeSku.Stock
}
if !isExd {
var categoryID = utils.Str2Int64(storeSku.VendorCatID)
if ebaiExSkuCatMap[storeSku.SkuID] != 0 {

View File

@@ -21,6 +21,7 @@ import (
"git.rosy.net.cn/jx-callback/business/partner"
"git.rosy.net.cn/jx-callback/business/partner/putils"
"git.rosy.net.cn/jx-callback/globals"
beego "github.com/astaxie/beego/server/web"
"image/jpeg"
"io/ioutil"
"net/http"
@@ -375,11 +376,15 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku
vendorSkuIdMap[k] = v
}
var successSku = make([]int, 0, len(vendorSkuIdMap))
var successSku = make(map[int]int, len(vendorSkuIdMap))
for _, v := range storeSkuList {
if k, ok := vendorSkuIdMap[utils.Int2Str(v.SkuID)]; ok {
v.VendorSkuID = k
successSku = append(successSku, v.SkuID)
if beego.BConfig.RunMode != model.ServerTypePet && v.Stock == model.NO {
successSku[v.SkuID] = 9999
} else {
successSku[v.SkuID] = v.Stock
}
} else {
v.VendorSkuID = "0"
v.SkuSyncStatus = 59
@@ -627,7 +632,7 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrg
}
// updateStoreSkusStockByCreate 创建时更新库存数量
func updateStoreSkusStockByCreate(ctx *jxcontext.Context, api *tao_vegetable.API, storeID int, vendorStoreID string, storeSkuList []int) (failedList []*partner.StoreSkuInfoWithErr) {
func updateStoreSkusStockByCreate(ctx *jxcontext.Context, api *tao_vegetable.API, storeID int, vendorStoreID string, storeSkuList map[int]int) (failedList []*partner.StoreSkuInfoWithErr) {
param := request589.AlibabaWdkStockPublishRequest{}
batchStockPublishDto := &domain589.AlibabaWdkStockPublishBatchStockPublishDto{
UpdateType: utils.Int64ToPointer(tao_vegetable.UpdateTypeStoke),
@@ -639,10 +644,10 @@ func updateStoreSkusStockByCreate(ctx *jxcontext.Context, api *tao_vegetable.API
StockPublishDtos: nil,
}
stockPublishDtos := make([]domain589.AlibabaWdkStockPublishStockPublishDto, 0, 0)
for _, v := range storeSkuList {
for skuId, stock := range storeSkuList {
stockPublishDtos = append(stockPublishDtos, domain589.AlibabaWdkStockPublishStockPublishDto{
SkuCode: utils.String2Pointer(utils.Int2Str(v)),
Quantity: utils.String2Pointer("9999"),
SkuCode: utils.String2Pointer(utils.Int2Str(skuId)),
Quantity: utils.String2Pointer(utils.Int2Str(stock)),
OrderNo: utils.String2Pointer(fmt.Sprintf("%s_%d_%d", vendorStoreID, time.Now().UnixNano(), 84671)),
OrderType: utils.String2Pointer("10006800"), // 这个不太确定
})

View File

@@ -689,7 +689,7 @@ func upDateChildrenPriceStockLaunch(api *tiktokShop.API, storeSku *dao.StoreSkuS
StockNum: int64(storeSku.Stock),
OutSkuId: int64(storeSku.SkuID),
}
if paramStock.StockNum == 0 {
if paramStock.StockNum == 0 && beego.BConfig.RunMode != model.ServerTypePet {
paramStock.StockNum = 99999
}
if err := api.UpdateSkuStock(paramStock); err != nil {
@@ -1156,7 +1156,7 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk
{InfoType: "weight", InfoUnit: specsUnit, InfoValue: utils.Float64ToStr(specQuality * infoValue)},
}
stock := localSku.Stock
if localSku.Stock == 0 {
if localSku.Stock == 0 && beego.BConfig.RunMode != model.ServerTypePet {
stock = 99999
}
sku.StockNum = stock
@@ -1182,7 +1182,7 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk
},
}
stock := localSku.Stock
if localSku.Stock == 0 {
if localSku.Stock == 0 && beego.BConfig.RunMode != model.ServerTypePet {
stock = 99999
}
sku.StockNum = stock
@@ -1212,7 +1212,7 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk
},
}
stock := localSku.Stock
if localSku.Stock == 0 {
if localSku.Stock == 0 && beego.BConfig.RunMode != model.ServerTypePet {
stock = 99999
}
sku.StockNum = stock