test_lgq/niucloud/app/service/admin/auth/ConfigService.php

65 lines
2.1 KiB
PHP
Raw Normal View History

2024-01-24 17:36:08 +08:00
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud-admin.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\service\admin\auth;
use app\dict\sys\ConfigKeyDict;
use app\model\sys\SysConfig;
use app\service\core\sys\CoreConfigService;
use core\base\BaseAdminService;
use think\Model;
/**
* 登录服务层
* Class BaseService
* @package app\service
*/
class ConfigService extends BaseAdminService
{
public function __construct()
{
parent::__construct();
}
/**
* 获取注册与登录设置
* @return array
*/
public function getConfig()
{
$info = (new CoreConfigService())->getConfig($this->request->defaultSiteId(), ConfigKeyDict::ADMIN_LOGIN)['value'] ?? [];
return [
'is_captcha' => $info['is_captcha'] ?? 0,//是否启用验证码
'is_site_captcha' => $info['is_site_captcha'] ?? 0,//是否启用站点验证码
'bg' => $info['bg'] ?? '',//平台登录端 背景
'site_bg' => $info['site_bg'] ?? '',//站点登录端 背景
];
}
/**
* 注册与登录设置
* @param array $data
* @return true
*/
public function setConfig(array $data)
{
$config = [
'is_captcha' => $data['is_captcha'] ?? 0,//是否启用验证码
'is_site_captcha' => $data['is_site_captcha'] ?? 0,//是否启用站点验证码
'bg' => $data['bg'] ?? '',//平台登录端 背景
'site_bg' => $data['site_bg'] ?? '',//站点登录端 背景
];
(new CoreConfigService())->setConfig($this->site_id, ConfigKeyDict::ADMIN_LOGIN, $config);
return true;
}
}