BaseService.php 997 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace addons\Happiness\common\service;
  3. use Exception;
  4. class BaseService
  5. {
  6. public $mall_id;
  7. public $user_id;
  8. public $store_id;
  9. public $platform;
  10. public $user;
  11. public $admin;
  12. public function __construct($config = [])
  13. {
  14. $this->mall_id = $config['mall_id'] ?? 0;
  15. $this->user_id = $config['user_id'] ?? 0;
  16. $this->platform = $config['platform'] ?? '';
  17. $this->store_id = $config['store_id'] ?? 0;
  18. $this->user = $config['user'] ?? [];
  19. $this->admin = $config['admin'] ?? [];
  20. }
  21. /**
  22. * 错误信息
  23. *
  24. * @var string
  25. */
  26. protected $error;
  27. /**
  28. * 错误返回
  29. *
  30. * @param string $msg
  31. * @return false
  32. */
  33. public function error(string $msg = '')
  34. {
  35. $this->error = $msg;
  36. return false;
  37. }
  38. /**
  39. * 获取错误信息
  40. *
  41. * @return string
  42. */
  43. public function getError()
  44. {
  45. return $this->error;
  46. }
  47. }