123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <?php
- // +----------------------------------------------------------------------
- // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
- // +----------------------------------------------------------------------
- // | Author: CRMEB Team <admin@crmeb.com>
- // +----------------------------------------------------------------------
- namespace app\dao\system\config;
- use app\dao\BaseDao;
- use app\model\system\config\SystemConfig;
- /**
- * 系统配置
- * Class SystemConfigDao
- * @package app\dao\system\config
- */
- class SystemConfigDao extends BaseDao
- {
- /**
- * 设置模型
- * @return string
- */
- protected function setModel(): string
- {
- return SystemConfig::class;
- }
- /**
- * 获取某个系统配置
- * @param string $configNmae
- * @return mixed
- * @throws \ReflectionException
- */
- public function getConfigValue(string $configNmae)
- {
- return $this->search(['menu_name' => $configNmae])->value('value');
- }
- /**
- * 获取所有配置
- * @param array $configName
- * @return array
- * @throws \ReflectionException
- */
- public function getConfigAll(array $configName = [])
- {
- if ($configName) {
- return $this->search(['menu_name' => $configName])->column('value', 'menu_name');
- } else {
- return $this->getModel()->column('value', 'menu_name');
- }
- }
- /**
- * 获取配置列表分页
- * @param array $where
- * @param int $page
- * @param int $limit
- * @return array
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function getConfigList(array $where, int $page, int $limit)
- {
- return $this->search($where)->page($page, $limit)->order('sort desc,id asc')->select()->toArray();
- }
- /**
- * 获取某些分类配置下的配置列表
- * @param int $tabId
- * @param int $status
- * @return array
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function getConfigTabAllList(int $tabId, int $status = 1)
- {
- $where['tab_id'] = $tabId;
- if ($status == 1) $where['status'] = $status;
- return $this->search($where)->order('sort desc,id ASC')->select()->toArray();
- }
- /**
- * 获取上传配置中的上传类型
- * @param string $configName
- * @return array
- * @throws \ReflectionException
- */
- public function getUploadTypeList(string $configName)
- {
- return $this->search(['menu_name' => $configName])->column('upload_type', 'type');
- }
- }
|