ShopException.php 926 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * Author: 芸众商城 www.yunzshop.com
  5. * Date: 2017/4/17
  6. * Time: 下午6:10
  7. */
  8. namespace app\common\exceptions;
  9. use Exception;
  10. class ShopException extends Exception
  11. {
  12. public $redirect = '';
  13. public $data = [];
  14. const UNIACID_NOT_FOUND = -2; // 公众号id不存在
  15. public function setRedirect($redirect)
  16. {
  17. $this->redirect = $redirect;
  18. }
  19. public function __construct($message = "", $data = [], $redirect = '')
  20. {
  21. $this->data = $data;
  22. $this->redirect = $redirect;
  23. parent::__construct($message, 0);
  24. }
  25. public function getData()
  26. {
  27. return $this->data;
  28. }
  29. private function getDefaultData()
  30. {
  31. return ['code' => $this->getCode()];
  32. }
  33. public function getRedirect()
  34. {
  35. return $this->redirect;
  36. }
  37. public function getStatusCode()
  38. {
  39. return 200;
  40. }
  41. }