PromotionGroupConfigService.php 944 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App\Modules\Sys\Services;
  3. use App\Modules\Sys\Models\PromotionGroupConfig;
  4. /**
  5. *
  6. * @method static string OUT_CHANNEL_ID_LIST() 外部渠道号;
  7. * @method static string INNER_CHANNEL_ID_LIST() 内部渠道号;
  8. * @method static string CHANNEL_ID_LIST() 渠道号;
  9. */
  10. class PromotionGroupConfigService
  11. {
  12. private $model;
  13. private static $_instance;
  14. public function __construct()
  15. {
  16. $this->model = (new PromotionGroupConfig)->filter();
  17. }
  18. public function getItem(string $option)
  19. {
  20. return $this->model->where('option', $option)->pluck('value')->first();
  21. }
  22. public static function __callStatic($name, $arguments)
  23. {
  24. if (self::$_instance == null) {
  25. self::$_instance = new PromotionGroupConfigService;
  26. }
  27. return self::$_instance->getItem($name);
  28. }
  29. public function __get($name)
  30. {
  31. return $this->getItem($name);
  32. }
  33. }