BaseService.php 650 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace addons\Sicpay\common\services;
  3. use yii\base\BaseObject;
  4. class BaseService extends BaseObject
  5. {
  6. /**
  7. * @var string
  8. */
  9. public $error = '';
  10. /**
  11. * @var int
  12. */
  13. public $mall_id;
  14. public function __construct ($config = [])
  15. {
  16. if(empty($config)){
  17. parent::__construct([]);
  18. }else{
  19. foreach ($config as $key => $val) {
  20. if (property_exists($this, $key)) {
  21. $this->{$key} = $val;
  22. }
  23. }
  24. }
  25. }
  26. public function error($msg):bool {
  27. $this->error = $msg;
  28. return false;
  29. }
  30. }