初始化项目:添加后端代码、ThinkPHP框架、前端资源
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\config;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 登录终端限制配置
|
||||
*/
|
||||
class Terminal extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* 模型对象
|
||||
* @var null
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
protected $configName = 'terminal';
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
* @return mixed
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
\app\common\model\fill\Handle::check('app_config', $this->configName);
|
||||
|
||||
$data = \app\common\model\app\Config::getConfig($this->configName);
|
||||
|
||||
return $this->success("获取成功", $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存配置
|
||||
* @return mixed
|
||||
*/
|
||||
public function setConfig()
|
||||
{
|
||||
$row = $this->request->post("row/a", [], 'trim');
|
||||
|
||||
// 登录终端限制数:范围 1-50,非数字回退默认值 3
|
||||
if (isset($row['login_terminal_limit'])) {
|
||||
$limit = trim((string)$row['login_terminal_limit']);
|
||||
if ($limit === '' || !is_numeric($limit)) {
|
||||
$row['login_terminal_limit'] = '3';
|
||||
} else {
|
||||
$limit = intval($limit);
|
||||
if ($limit < 1) {
|
||||
$limit = 1;
|
||||
}
|
||||
if ($limit > 50) {
|
||||
$limit = 50;
|
||||
}
|
||||
$row['login_terminal_limit'] = (string)$limit;
|
||||
}
|
||||
}
|
||||
|
||||
\app\common\model\fill\Handle::check('app_config', $this->configName);
|
||||
|
||||
$data = \app\common\model\app\Config::setConfig($this->configName, $row);
|
||||
return $this->success("保存成功", $data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user