AdminSetUpController.php 1.1 KB
<?php
/**
 * Created by PhpStorm.
 * User: ruidiudiu
 * Date: 2018/11/14
 * Time: 10:09
 */

namespace app\portal\controller;


use cmf\controller\AdminBaseController;
use think\Db;

/**
 * Class AdminSetUpController
 * @package app\portal\controller
 * @adminMenuRoot(
 *     'name'   =>'参数设置',
 *     'action' =>'index',
 *     'parent' =>'',
 *     'display'=> true,
 *     'order'  => 30,
 *     'icon'   =>'th',
 *     'remark' =>'参数设置'
 * )
 */
class AdminSetUpController extends AdminBaseController{

    public function index(){
        $data=Db::name('set_up')->where('id',1)->find();
        $data['bill_rules']=html_entity_decode($data['bill_rules']);
        $data['directions']=html_entity_decode($data['directions']);
        $this->assign('setup',$data);
        return $this->fetch();
    }

    public function setupPost(){
        $param=$this->request->param();
        $param['update_time']=time();
        $res=Db::name('set_up')->where('id',1)->update($param);
        if ($res){
            $this->success('保存完成');
        }else{
            $this->error('保存失败');
        }
    }
}