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);
//渲染系統(tǒng)設置頁面
return $this->fetch();
}
public function doEdit()
{
//獲取提交的數(shù)據(jù)
$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:代碼很精簡, 不錯, 功能 實現(xiàn)的也是正確 的.....