You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.1 KiB
49 lines
1.1 KiB
<?php
|
|
|
|
namespace app\admin\controller\setting;
|
|
|
|
use app\admin\controller\Controller;
|
|
use app\common\dm\Dm;
|
|
use app\common\model\Pass;
|
|
|
|
/**
|
|
* 配置
|
|
* Class Index
|
|
* @package app\admin\controller
|
|
*/
|
|
class Config extends Controller
|
|
{
|
|
/**
|
|
* 清理缓存
|
|
* @return mixed
|
|
*/
|
|
public function index()
|
|
{
|
|
|
|
$dm = new Dm();
|
|
|
|
if ($this->request->isAjax()) {
|
|
|
|
$request = $this->request->request();
|
|
$threshold = $request['threshold'];
|
|
|
|
if (empty($threshold)) $this->renderError('请填写阈值');
|
|
if (is_numeric($threshold) && $threshold > 0) $this->renderError('阈值必须是数字');
|
|
|
|
# 修改阈值
|
|
$dm->update('bt_config',['value' => $threshold],'"key"='."'threshold'");
|
|
|
|
return $this->renderSuccess('操作成功');
|
|
}
|
|
|
|
$configList = [];
|
|
|
|
$configRes = $dm->find("bt_config",' "key" = ' . "'threshold'");
|
|
$threshold = $configRes['value'];
|
|
|
|
return $this->fetch('index', [
|
|
'configList' => $configList,
|
|
'threshold' => $threshold,
|
|
]);
|
|
}
|
|
}
|