diff --git a/business/jxstore/act/act.go b/business/jxstore/act/act.go index a370b7c00..0631a04e4 100644 --- a/business/jxstore/act/act.go +++ b/business/jxstore/act/act.go @@ -952,28 +952,31 @@ func ForceUpdateVendorPrice(ctx *jxcontext.Context, vendorID int, actType int, s } storeSkuBind.DeletedAt = utils.DefaultTimeValue if err = dao.GetEntity(db, storeSkuBind, model.FieldStoreID, model.FieldSkuID, model.FieldDeletedAt); err == nil { - if v.VendorPrice != 0 { + vendorPrice := int(v.VendorPrice) + if vendorPrice != 0 { if err2 := checkDiscountValidation(actType, float64(v.ActualActPrice)*100/float64(v.VendorPrice)); err2 != nil { v.ErrMsg = err2.Error() wrongSkuList = append(wrongSkuList, v) storeSkuBind = nil } } else { - vendorPrice := dao.GetStoreSkuBindVendorPrice(storeSkuBind, vendorID) + vendorPrice = dao.GetStoreSkuBindVendorPrice(storeSkuBind, vendorID) if checkDiscountValidation(actType, float64(v.ActualActPrice)*100/float64(vendorPrice)) != nil { if actType == model.ActSkuSecKill { vendorPrice = int(v.ActualActPrice)*100/maxDiscount4SkuSecKill + 10 } else if actType == model.ActSkuDirectDown { vendorPrice = int(v.ActualActPrice) + 10 } - dao.SetStoreSkuBindVendorPrice(storeSkuBind, vendorID, vendorPrice) - if vendorID != model.VendorIDJX { - dao.SetStoreSkuBindSyncStatus(storeSkuBind, vendorID, dao.GetStoreSkuBindSyncStatus(storeSkuBind, vendorID)|model.SyncFlagPriceMask) - } - storeSkuBind.LastOperator = ctx.GetUserName() + } else { + storeSkuBind = nil } } if storeSkuBind != nil { + dao.SetStoreSkuBindVendorPrice(storeSkuBind, vendorID, vendorPrice) + if vendorID != model.VendorIDJX { + dao.SetStoreSkuBindSyncStatus(storeSkuBind, vendorID, dao.GetStoreSkuBindSyncStatus(storeSkuBind, vendorID)|model.SyncFlagPriceMask) + } + storeSkuBind.LastOperator = ctx.GetUserName() storeSkuBindList = append(storeSkuBindList, storeSkuBind) } } else {