饿鲜达商品库合并测试,订单分账修改

This commit is contained in:
苏尹岚
2020-02-12 15:39:39 +08:00
parent e186ca37fa
commit 6eb145f6b4
5 changed files with 97 additions and 27 deletions

View File

@@ -260,26 +260,26 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn
case 3:
priceReferSnapshotList, err = dao.GetPriceReferSnapshotNoPage(db, []int{0}, nil, nil, snapshotAt)
taskFunc := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
dao.Begin(db)
defer func() {
if r := recover(); r != nil || err != nil {
dao.Rollback(db)
if r != nil {
panic(r)
}
}
}()
v := batchItemList[0].(*model.PriceReferSnapshot)
for _, appOrg := range apimanager.CurAPIManager.GetAppOrgCodeList(model.VendorIDJD) {
directPrice, _ := jd.GetAPI(appOrg).GetJdSkuDirectPrice(v.SkuID)
dao.Begin(db)
defer func() {
if r := recover(); r != nil || err != nil {
dao.Rollback(db)
if r != nil {
panic(r)
}
}
}()
if directPrice == 0 {
continue
} else {
v.JdDirectPrice = int(directPrice)
dao.UpdateEntity(db, v, "JdDirectPrice")
}
dao.Commit(db)
}
dao.Commit(db)
return retVal, err
}
taskParallel := tasksch.NewParallelTask("获取并更新京东指导价格", tasksch.NewParallelConfig(), ctx, taskFunc, priceReferSnapshotList)