1
This commit is contained in:
@@ -573,7 +573,7 @@ func ModifyPetOrderSkusStock(db *dao.DaoDB, order *model.GoodsOrder, isAdd bool)
|
|||||||
dao.UpdateEntity(db, ss, "Stock")
|
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)
|
_, err = cms.SyncSkus(jxcontext.AdminCtx, nil, nil, []string{"309558"}, nil, skuIDList, true)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,
|
task := tasksch.NewParallelTask("syncStoreSkuNew", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError2), ctx,
|
||||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||||
step := batchItemList[0].(int)
|
step := batchItemList[0].(int)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package ebai
|
package ebai
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
beego "github.com/astaxie/beego/server/web"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@@ -455,9 +456,9 @@ func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo, isCreate, isE
|
|||||||
"url": storeSku.Img5,
|
"url": storeSku.Img5,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
params = map[string]interface{}{
|
params = map[string]interface{}{
|
||||||
// "name": utils.LimitMixedStringLen(storeSku.SkuName, ebaiapi.MaxSkuNameByteCount),
|
// "name": utils.LimitMixedStringLen(storeSku.SkuName, ebaiapi.MaxSkuNameByteCount),
|
||||||
"left_num": model.MaxStoreSkuStockQty,
|
|
||||||
// "category_id": utils.Str2Int64(storeSku.VendorCatID),
|
// "category_id": utils.Str2Int64(storeSku.VendorCatID),
|
||||||
//"predict_cat": 0, // 不使用推荐类目
|
//"predict_cat": 0, // 不使用推荐类目
|
||||||
// "cat3_id": getEbaiCat(storeSku.VendorVendorCatID),
|
// "cat3_id": getEbaiCat(storeSku.VendorVendorCatID),
|
||||||
@@ -465,6 +466,12 @@ func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo, isCreate, isE
|
|||||||
"photos": photos,
|
"photos": photos,
|
||||||
"preparation_time": storeSku.PreparationTime,
|
"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 {
|
if !isExd {
|
||||||
var categoryID = utils.Str2Int64(storeSku.VendorCatID)
|
var categoryID = utils.Str2Int64(storeSku.VendorCatID)
|
||||||
if ebaiExSkuCatMap[storeSku.SkuID] != 0 {
|
if ebaiExSkuCatMap[storeSku.SkuID] != 0 {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/partner"
|
"git.rosy.net.cn/jx-callback/business/partner"
|
||||||
"git.rosy.net.cn/jx-callback/business/partner/putils"
|
"git.rosy.net.cn/jx-callback/business/partner/putils"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
|
beego "github.com/astaxie/beego/server/web"
|
||||||
"image/jpeg"
|
"image/jpeg"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -375,11 +376,15 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku
|
|||||||
vendorSkuIdMap[k] = v
|
vendorSkuIdMap[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
var successSku = make([]int, 0, len(vendorSkuIdMap))
|
var successSku = make(map[int]int, len(vendorSkuIdMap))
|
||||||
for _, v := range storeSkuList {
|
for _, v := range storeSkuList {
|
||||||
if k, ok := vendorSkuIdMap[utils.Int2Str(v.SkuID)]; ok {
|
if k, ok := vendorSkuIdMap[utils.Int2Str(v.SkuID)]; ok {
|
||||||
v.VendorSkuID = k
|
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 {
|
} else {
|
||||||
v.VendorSkuID = "0"
|
v.VendorSkuID = "0"
|
||||||
v.SkuSyncStatus = 59
|
v.SkuSyncStatus = 59
|
||||||
@@ -627,7 +632,7 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrg
|
|||||||
}
|
}
|
||||||
|
|
||||||
// updateStoreSkusStockByCreate 创建时更新库存数量
|
// 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{}
|
param := request589.AlibabaWdkStockPublishRequest{}
|
||||||
batchStockPublishDto := &domain589.AlibabaWdkStockPublishBatchStockPublishDto{
|
batchStockPublishDto := &domain589.AlibabaWdkStockPublishBatchStockPublishDto{
|
||||||
UpdateType: utils.Int64ToPointer(tao_vegetable.UpdateTypeStoke),
|
UpdateType: utils.Int64ToPointer(tao_vegetable.UpdateTypeStoke),
|
||||||
@@ -639,10 +644,10 @@ func updateStoreSkusStockByCreate(ctx *jxcontext.Context, api *tao_vegetable.API
|
|||||||
StockPublishDtos: nil,
|
StockPublishDtos: nil,
|
||||||
}
|
}
|
||||||
stockPublishDtos := make([]domain589.AlibabaWdkStockPublishStockPublishDto, 0, 0)
|
stockPublishDtos := make([]domain589.AlibabaWdkStockPublishStockPublishDto, 0, 0)
|
||||||
for _, v := range storeSkuList {
|
for skuId, stock := range storeSkuList {
|
||||||
stockPublishDtos = append(stockPublishDtos, domain589.AlibabaWdkStockPublishStockPublishDto{
|
stockPublishDtos = append(stockPublishDtos, domain589.AlibabaWdkStockPublishStockPublishDto{
|
||||||
SkuCode: utils.String2Pointer(utils.Int2Str(v)),
|
SkuCode: utils.String2Pointer(utils.Int2Str(skuId)),
|
||||||
Quantity: utils.String2Pointer("9999"),
|
Quantity: utils.String2Pointer(utils.Int2Str(stock)),
|
||||||
OrderNo: utils.String2Pointer(fmt.Sprintf("%s_%d_%d", vendorStoreID, time.Now().UnixNano(), 84671)),
|
OrderNo: utils.String2Pointer(fmt.Sprintf("%s_%d_%d", vendorStoreID, time.Now().UnixNano(), 84671)),
|
||||||
OrderType: utils.String2Pointer("10006800"), // 这个不太确定
|
OrderType: utils.String2Pointer("10006800"), // 这个不太确定
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -689,7 +689,7 @@ func upDateChildrenPriceStockLaunch(api *tiktokShop.API, storeSku *dao.StoreSkuS
|
|||||||
StockNum: int64(storeSku.Stock),
|
StockNum: int64(storeSku.Stock),
|
||||||
OutSkuId: int64(storeSku.SkuID),
|
OutSkuId: int64(storeSku.SkuID),
|
||||||
}
|
}
|
||||||
if paramStock.StockNum == 0 {
|
if paramStock.StockNum == 0 && beego.BConfig.RunMode != model.ServerTypePet {
|
||||||
paramStock.StockNum = 99999
|
paramStock.StockNum = 99999
|
||||||
}
|
}
|
||||||
if err := api.UpdateSkuStock(paramStock); err != nil {
|
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)},
|
{InfoType: "weight", InfoUnit: specsUnit, InfoValue: utils.Float64ToStr(specQuality * infoValue)},
|
||||||
}
|
}
|
||||||
stock := localSku.Stock
|
stock := localSku.Stock
|
||||||
if localSku.Stock == 0 {
|
if localSku.Stock == 0 && beego.BConfig.RunMode != model.ServerTypePet {
|
||||||
stock = 99999
|
stock = 99999
|
||||||
}
|
}
|
||||||
sku.StockNum = stock
|
sku.StockNum = stock
|
||||||
@@ -1182,7 +1182,7 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
stock := localSku.Stock
|
stock := localSku.Stock
|
||||||
if localSku.Stock == 0 {
|
if localSku.Stock == 0 && beego.BConfig.RunMode != model.ServerTypePet {
|
||||||
stock = 99999
|
stock = 99999
|
||||||
}
|
}
|
||||||
sku.StockNum = stock
|
sku.StockNum = stock
|
||||||
@@ -1212,7 +1212,7 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
stock := localSku.Stock
|
stock := localSku.Stock
|
||||||
if localSku.Stock == 0 {
|
if localSku.Stock == 0 && beego.BConfig.RunMode != model.ServerTypePet {
|
||||||
stock = 99999
|
stock = 99999
|
||||||
}
|
}
|
||||||
sku.StockNum = stock
|
sku.StockNum = stock
|
||||||
|
|||||||
Reference in New Issue
Block a user