BaseService.php 652 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace addons\UnionPay\common\service;
  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. }