| | |
| | | //|| $this->libraryModel->expire_start_time > $date |
| | | |
| | | if ($this->libraryModel->expire_end_time < $date) { |
| | | throw new \Exception('兑换码失效'); |
| | | throw new \Exception('提货卡失效'); |
| | | } |
| | | } |
| | | if ($this->libraryModel->expire_type === 'relatively') { |
| | | if ($this->libraryModel->expire_start_day < 1) { |
| | | throw new \Exception('兑换码失效'); |
| | | throw new \Exception('提货卡失效'); |
| | | } |
| | | } |
| | | } |
| | |
| | | public function hasDisable() |
| | | { |
| | | if ($this->codeModel->status == 0) { |
| | | throw new ExchangeException('该兑换码已禁用'); |
| | | throw new ExchangeException('该提货卡已禁用'); |
| | | } |
| | | } |
| | | |
| | | public function hasExchange() |
| | | { |
| | | if (in_array($this->codeModel->status, [2, 3])) { |
| | | throw new ExchangeException('该兑换码已兑换'); |
| | | throw new ExchangeException('该提货卡已兑换'); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | //参数补充 |
| | | if ($this->codeModel->status === 3) { |
| | | throw new ExchangeException('该兑换码已兑换'); |
| | | throw new ExchangeException('该提货卡已兑换'); |
| | | } |
| | | if ($this->codeModel->status !== 2) { |
| | | throw new ExchangeException('该兑换码无法兑换'); |
| | | throw new ExchangeException('该提货卡无法兑换'); |
| | | } |
| | | if ($this->codeModel->r_user_id != $this->user->id) { |
| | | throw new ExchangeException('非法用户'); |
| | |
| | | $this->libraryModel->expire_type !== 'all' |
| | | && $this->codeModel->valid_start_time > date('Y-m-d H:i:s') |
| | | ) { |
| | | throw new ExchangeException('该兑换码未到使用时间!'); |
| | | throw new ExchangeException('该提货卡未到使用时间!'); |
| | | } |
| | | } |
| | | |
| | |
| | | $this->libraryModel->expire_type !== 'all' |
| | | && $this->codeModel->valid_end_time < date('Y-m-d H:i:s') |
| | | ) { |
| | | throw new ExchangeException('该兑换码已过期'); |
| | | throw new ExchangeException('该提货卡已过期'); |
| | | } |
| | | } |
| | | |
| | |
| | | public function hasNullLibrary($code) |
| | | { |
| | | if (empty($code)) { |
| | | throw new \Exception('暂无可用兑换码'); |
| | | throw new \Exception('暂无可用提货卡'); |
| | | } |
| | | } |
| | | |