abstract:<?php/** * Created by PhpStorm. * User: Administrator * Date: 2019/5/27 * Time: 22:54 */namespace app\admin\controller;use app\admin\controller\Common;use app\model\System as SystemModel;use think\
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2019/5/27
* Time: 22:54
*/
namespace app\admin\controller;
use app\admin\controller\Common;
use app\model\System as SystemModel;
use think\facade\Request;
class System extends Common
{
public function index()
{
$system = SystemModel::get(1);
$this->assign('system',$system);
//渲染系统设置页面
return $this->fetch();
}
public function doEdit()
{
//获取提交的数据
$data = Request::param();
$result = SystemModel::where('id',$data['id'])->update($data);
if ($result) {
return ['res'=>1,'msg'=>'保存成功'];
} else {
return ['res'=>0,'msg'=>'保存失败'];
}
}
}
Correcting teacher:天蓬老师Correction time:2019-05-28 17:01:10
Teacher's summary:代码很精简, 不错, 功能 实现的也是正确 的.....