WithdrawSuccessEvent.php 924 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. *
  5. * User: king/QQ:995265288
  6. * Date: 2018/7/5 下午5:29
  7. * Email: livsyitian@163.com
  8. */
  9. namespace app\common\events\withdraw;
  10. use app\common\events\Event;
  11. use app\common\exceptions\ShopException;
  12. use app\common\models\Withdraw;
  13. class WithdrawSuccessEvent extends Event
  14. {
  15. private $withdraw_sn;
  16. private $withdrawModel;
  17. public function __construct($withdraw_sn)
  18. {
  19. $this->withdraw_sn = $withdraw_sn;
  20. $this->setWithdrawModel();
  21. }
  22. public function getWithdrawModel()
  23. {
  24. return $this->withdrawModel;
  25. }
  26. private function setWithdrawModel()
  27. {
  28. $withdrawModel = Withdraw::where('withdraw_sn', $this->withdraw_sn)->first();
  29. if (!$withdrawModel) {
  30. throw new ShopException("提现记录不存在,单号:{$this->withdraw_sn}");
  31. }
  32. $this->withdrawModel = $withdrawModel;
  33. }
  34. }