| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace App\Presenters;
- use App\Models\System;
- /**
- * Class SystemPresenter
- *
- * @package namespace App\Presenters;
- */
- class SystemPresenter
- {
- protected $list;
- public function __construct()
- {
- $this->list = System::optionList();
- }
- /**
- * 根据key获取value
- *
- * @param $key
- * @return mixed
- */
- public function getKeyValue($key)
- {
- return isset($this->list[$key]) ? $this->list[$key] : '';
- }
- /**
- * 检查返回相应的value
- *
- * @param $key
- * @param $defaultValue
- * @return mixed
- */
- public function checkReturnValue($key, $defaultValue)
- {
- if ($defaultValue != "") {
- return $defaultValue;
- }
- return $this->getKeyValue($key);
- }
- }
|