zoukankan      html  css  js  c++  java
  • tp6重构80cms系统配置

    //系统配置
        function config(){
    		if (!$this->request->isPost()){
    			$info = db("config")->find(1);
    		    // dump($info);
    			$this->view->assign('info',checkData($info,false));
    			// $this->view->assign('themesList',CatagoryService::tplList(''));
    			return view('base/config');
    		}else{
    			$data = $this->request->post();
    			// dump($data);exit;
                   $where['c_name']=$data['c_name'];
                   $where['c_webname'] = $data['c_webname'];
    			   $where['c_weburl'] = $data['c_weburl'];
    			   $where['c_indextemp'] =$data['c_indextemp'];
    			   $where['c_webtemp']= $data['c_webtemp'];
    			   $where['c_mobiletemp']= $data['c_mobiletemp'];
    			   $where['c_indexkeyword']= $data['c_indexkeyword'];
    			   $where['c_indexdescription']= $data['c_indexkeyword'];
    			   $where['c_webcopyright']= $data['c_webcopyright'];
    			   $where['c_icpnum']= $data['c_icpnum'];
    			   $result=db('config')->where(['c_id'=>1])->save($where);
    			   if($result){
    			   	 // return json(['status'=>'00','msg'=>'修改成功']);
    			   	$this->success('修改成功',url('Base/config'));
    			   	}else{
    			   	$this->error('无修改,正在返回',url('Base/config'));
    			   	}           
    		}
    	}
    

      继承admin.php

    <?php
    /**
     * ============================================================================
     * * COPYRIGHT 2016-2019 xhadmin.com , and all rights reserved.
     * * WEBSITE: http://www.xhadmin.com;
     * ----------------------------------------------------------------------------
     * This is not a free software!You have not used for commercial purposes in the
     * premise of the program code to modify and use; and publication does not allow
     * any form of code for any purpose.
     * ============================================================================
     * Author:  QQ:2228293408
     */
     
    namespace appadmincontroller;
    use thinkexceptionFuncNotFoundException;
    use thinkexceptionValidateException;
    use appBaseController;
    
    class Admin extends BaseController
    {
    	
    	public function initialize(){
    		$controller = $this->request->controller();
    		$action = $this->request->action();
    		$app = app('http')->getName();
    		
    		$admin = session('admin');
            $userid = session('admin_sign') == data_auth_sign($admin) ? $admin['a_id'] : 0;
    		
            if( !$userid && ( $app <> 'admin' || $controller <> 'Login' )){
    			echo '<script type="text/javascript">window.parent.frames.location.href="'.url('admin/Login/index').'";</script>';exit();
            }
    
    		$url =  "{$app}/{$controller}/{$action}";
    		// if(session('admin.role_id') <> 1 && !in_array($url,config('my.nocheck')) && $action !== 'getExtends' && $controller <> 'FormData'){	
    		// 	if(!in_array($url,session('admin.nodes'))){
    		// 		throw new ValidateException ('你没操作权限');
    		// 	}
    		// }
    		
    		event('DoLog');
    		
    		$list = db("config")->cache(true,60)->find(1);
    		config($list,'xhadmin');
    	}
    	
    	public function __call($method, $args){
            throw new FuncNotFoundException('方法不存在',$method);
        }
    
    }
    

      

  • 相关阅读:
    ORACLE AWR 和 ASH
    11g RAC R2 日常巡检--Grid
    Linux中重命名文件
    Xshell4连接Linux后 win快捷键锁屏
    vim 删除临时文件
    shell--read命令
    shell基础篇(一)从hello world开始
    ORACLE--分区表数据清理
    Shell—学习之心得
    awk 手册--【转载】
  • 原文地址:https://www.cnblogs.com/mo3408/p/13688159.html
Copyright © 2011-2022 走看看