admin/app/common/events/withdraw/WithdrawSuccessEvent.php

48 lines
924 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* Created by PhpStorm.
*
* User: king/QQ995265288
* Date: 2018/7/5 下午5:29
* Email: livsyitian@163.com
*/
namespace app\common\events\withdraw;
use app\common\events\Event;
use app\common\exceptions\ShopException;
use app\common\models\Withdraw;
class WithdrawSuccessEvent extends Event
{
private $withdraw_sn;
private $withdrawModel;
public function __construct($withdraw_sn)
{
$this->withdraw_sn = $withdraw_sn;
$this->setWithdrawModel();
}
public function getWithdrawModel()
{
return $this->withdrawModel;
}
private function setWithdrawModel()
{
$withdrawModel = Withdraw::where('withdraw_sn', $this->withdraw_sn)->first();
if (!$withdrawModel) {
throw new ShopException("提现记录不存在,单号:{$this->withdraw_sn}");
}
$this->withdrawModel = $withdrawModel;
}
}