2015-07-28 15:15:57 +08:00
|
|
|
<?php
|
|
|
|
|
namespace Admin\Controller;
|
|
|
|
|
use Admin\Controller;
|
2016-01-24 11:54:16 +08:00
|
|
|
|
|
|
|
|
/**
|
2017-02-03 12:32:57 +08:00
|
|
|
* @Author: Zhou Yuyang <1009465756@qq.com> 10:28 2017/02/02
|
2016-12-03 21:42:04 +08:00
|
|
|
* @Copyright 2015-2020 SISMO
|
|
|
|
|
* @Project homepage https://github.com/CNSISMO
|
2017-02-03 12:32:57 +08:00
|
|
|
* @Version 2.0
|
2016-01-24 11:54:16 +08:00
|
|
|
*/
|
|
|
|
|
|
2015-07-28 15:15:57 +08:00
|
|
|
class SettingController extends BaseController
|
|
|
|
|
{
|
2017-02-03 12:32:57 +08:00
|
|
|
public function index()
|
2015-07-28 15:15:57 +08:00
|
|
|
{
|
2017-02-03 12:32:57 +08:00
|
|
|
$model = M('setting');
|
|
|
|
|
$setting = $model->where('id=1')-> find();
|
2015-07-28 15:15:57 +08:00
|
|
|
$this->assign('model', $setting);
|
|
|
|
|
$this->display();
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-03 12:32:57 +08:00
|
|
|
public function other()
|
2015-07-28 15:15:57 +08:00
|
|
|
{
|
2017-02-03 12:32:57 +08:00
|
|
|
$model = M('setting');
|
|
|
|
|
$setting = $model->where('id=2')-> find();
|
|
|
|
|
$this->assign('model', $setting);
|
|
|
|
|
$this->display();
|
2015-07-28 15:15:57 +08:00
|
|
|
}
|
2017-02-03 12:32:57 +08:00
|
|
|
|
|
|
|
|
|
2015-07-28 15:15:57 +08:00
|
|
|
/**
|
2017-02-03 12:32:57 +08:00
|
|
|
* 更新基础配置
|
2015-07-28 15:15:57 +08:00
|
|
|
*/
|
|
|
|
|
public function update()
|
|
|
|
|
{
|
|
|
|
|
if (!IS_POST) {
|
|
|
|
|
$this->display();
|
|
|
|
|
}
|
|
|
|
|
if (IS_POST) {
|
2017-02-03 12:32:57 +08:00
|
|
|
$model = M("setting");
|
|
|
|
|
$data = I();
|
|
|
|
|
$id = I('get.id',0,'intval');
|
|
|
|
|
if ($model-> where('id='.$id) ->save($data)) {
|
|
|
|
|
$this->success("配置更新成功", U('setting/index'));
|
2015-07-28 15:15:57 +08:00
|
|
|
} else {
|
2017-02-03 12:32:57 +08:00
|
|
|
$this->error("配置更新失败");
|
2015-07-28 15:15:57 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|