- fix bug in promotion.OnStoreStockMsg
This commit is contained in:
@@ -696,30 +696,30 @@ func RefreshJdPromotionLockStatus(promotionID int) (err error) {
|
|||||||
|
|
||||||
func OnStoreStockMsg(msg *jdapi.CallbackStoreStockMsg) (retVal *jdapi.CallbackResponse) {
|
func OnStoreStockMsg(msg *jdapi.CallbackStoreStockMsg) (retVal *jdapi.CallbackResponse) {
|
||||||
var err error
|
var err error
|
||||||
|
globals.SugarLogger.Debugf("OnStoreStockMsg msg:%s", utils.Format4Output(msg, false))
|
||||||
|
// globals.SugarLogger.Debugf("OnStoreStockMsg IsJdStoreSkuLocked:%t", storeskulock.IsJdStoreSkuLocked(msg.StationNo, msg.SkuId))
|
||||||
if (msg.Vendibility == 1 || !msg.Have) && storeskulock.IsJdStoreSkuLocked(msg.StationNo, msg.SkuId) {
|
if (msg.Vendibility == 1 || !msg.Have) && storeskulock.IsJdStoreSkuLocked(msg.StationNo, msg.SkuId) {
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
if msg.Vendibility == 1 {
|
sku := &model.Sku{}
|
||||||
sku := &model.Sku{}
|
sku.JdID = msg.SkuId
|
||||||
sku.JdID = msg.SkuId
|
if err = dao.GetEntity(db, sku, model.FieldJdID); err == nil {
|
||||||
if err = dao.GetEntity(db, sku); err == nil {
|
if msg.Vendibility == 1 {
|
||||||
if msg.Vendibility == 1 {
|
vendibility := &jdapi.StockVendibility{
|
||||||
vendibility := &jdapi.StockVendibility{
|
OutSkuId: utils.Int2Str(sku.ID),
|
||||||
OutSkuId: utils.Int2Str(sku.ID),
|
DoSale: true,
|
||||||
DoSale: true,
|
|
||||||
}
|
|
||||||
_, err = api.JdAPI.BatchUpdateVendibility("", msg.StationNo, []*jdapi.StockVendibility{
|
|
||||||
vendibility,
|
|
||||||
}, "prevent")
|
|
||||||
}
|
}
|
||||||
if !msg.Have {
|
_, err = api.JdAPI.BatchUpdateVendibility("", msg.StationNo, []*jdapi.StockVendibility{
|
||||||
stock := &jdapi.SkuStock{
|
vendibility,
|
||||||
OutSkuId: utils.Int2Str(sku.ID),
|
}, "prevent")
|
||||||
StockQty: model.MaxStoreSkuStockQty,
|
}
|
||||||
}
|
if !msg.Have {
|
||||||
_, err = api.JdAPI.BatchUpdateCurrentQtys("", msg.StationNo, []*jdapi.SkuStock{
|
stock := &jdapi.SkuStock{
|
||||||
stock,
|
OutSkuId: utils.Int2Str(sku.ID),
|
||||||
}, "prevent")
|
StockQty: model.MaxStoreSkuStockQty,
|
||||||
}
|
}
|
||||||
|
_, err = api.JdAPI.BatchUpdateCurrentQtys("", msg.StationNo, []*jdapi.SkuStock{
|
||||||
|
stock,
|
||||||
|
}, "prevent")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user