BaseAddonConfigService.php 769 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace common\components;
  3. use Yii;
  4. /**
  5. * 公用获取配置服务
  6. *
  7. * Class BaseAddonConfigService
  8. * @package common\components
  9. */
  10. class BaseAddonConfigService extends Service
  11. {
  12. /**
  13. * @var array
  14. */
  15. private $setting = [];
  16. /**
  17. * @param $merchant_id
  18. * @return mixed
  19. */
  20. public function setting($merchant_id = 0)
  21. {
  22. // 查找是否已经获取
  23. if (isset($this->setting[$merchant_id])) {
  24. return $this->setting[$merchant_id];
  25. }
  26. $setting = new $this->settingForm;
  27. $setting->attributes = Yii::$app->services->addonsConfig->findConfigByCache($this->addonName, $merchant_id, true);
  28. $this->setting[$merchant_id] = $setting;
  29. return $setting;
  30. }
  31. }
粤ICP备19079148号