ActualStockForOrderEvent.php 934 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * 订单支付后事件
  4. * Created by PhpStorm.
  5. * Author: 芸众商城 www.yunzshop.com
  6. * Date: 2017/3/3
  7. * Time: 上午11:44
  8. */
  9. namespace app\common\events\goods;
  10. class ActualStockForOrderEvent extends \app\common\events\Event
  11. {
  12. protected $goods;
  13. protected $is_replace;
  14. protected $actual_stock;
  15. public function __construct($goods)
  16. {
  17. $this->goods = $goods;
  18. $this->actual_stock = 0;
  19. $this->is_replace = 0;
  20. }
  21. public function getGoods()
  22. {
  23. return $this->goods;
  24. }
  25. public function setActualStock($stock, $msg = '')
  26. {
  27. $this->actual_stock = $stock;
  28. $this->is_replace = 1;
  29. \Log::debug('插件设置当前实际库存:' . $msg, $stock);
  30. }
  31. public function getReplaceStock()
  32. {
  33. if ($this->is_replace) {
  34. return $this->actual_stock;
  35. } else {
  36. return false;
  37. }
  38. }
  39. }