protected override bool CheckStocks(InventoryEntity inventory, int buyNum) { if (inventory.Amount < buyNum) { return false; } inventory.Amount -= buyNum;//支付状态订单扣减库存 return true; }
/// <summary> /// 扣减库存 /// </summary> /// <param name="inventory">库存ID</param> /// <param name="buyNum">库存数量</param> protected abstract bool CheckStocks(InventoryEntity inventory, int buyNum);
protected override bool CheckStocks(InventoryEntity inventory, int buyNum) { return inventory.Amount >= buyNum; //未支付订单不扣减库存 }