BaseService.php 815 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace addons\Alitopay\common\services;
  3. use yii\base\BaseObject;
  4. /**
  5. * BaseService
  6. * @package addons\Alitopay\common\services
  7. */
  8. class BaseService extends BaseObject
  9. {
  10. protected $mall_id;
  11. protected $error_msg;
  12. public function __construct($mall_id = 0)
  13. {
  14. if (is_numeric($mall_id)) {
  15. $this->setMallId($mall_id);
  16. } else {
  17. $this->setMallId(0);
  18. }
  19. }
  20. public function setMallId(int $mall_id)
  21. {
  22. $this->mall_id = $mall_id;
  23. }
  24. public function error(string $msg = '')
  25. {
  26. $this->setErrorMsg($msg);
  27. return false;
  28. }
  29. public function setErrorMsg(string $msg)
  30. {
  31. $this->error_msg = $msg;
  32. }
  33. public function getErrorMsg()
  34. {
  35. return $this->error_msg;
  36. }
  37. }