AdminConfigController.php 2.0 KB
<?php
// +----------------------------------------------------------------------
// | bronet [ 以客户为中心 以奋斗者为本 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <bronet@126.com>
// +----------------------------------------------------------------------
namespace app\portal\controller;

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

/**
 * Class AdminConfigController
 * @package app\portal\controller
 * @adminMenuRoot(
 *     'name'   =>'配置',
 *     'action' =>'default',
 *     'parent' =>'',
 *     'display'=> true,
 *     'order'  => 30,
 *     'icon'   =>'th',
 *     'remark' =>'配置'
 * )
 */
class AdminConfigController extends AdminBaseController
{
    /**
     * 配置
     * @adminMenu(
     *     'name'   => '配置',
     *     'parent' => 'portal/AdminConfig/default',
     *     'display'=> true,
     *     'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '配置',
     *     'param'  => ''
     * )
     */
    public function index()
    {
        $data = $this->request->param();
        if($this->request->isPost()){
            $where['id'] = $data['id'];
            $add['tel'] = $data['tel'];
//            $add['create_time'] = time();
            $add['update_time'] = time();
            $res = Db::name('Config')->where($where)->update($add);
            if($res){
                $this->success('修改成功');
            }else{
                $this->error('修改失败');
            }
        }else{
            $where['id'] = 1;
            $where['status'] = array('neq',9);
            $list = Db::name('Config')->where($where)->find();
            $this->assign('list',$list);
            return $this->fetch('index');
        }

    }


}