<?php
/*
* $Author ：PHPYUN开发团队
*
* 官网: http://www.phpyun.com
*
* 版权所有 2009-2019 宿迁鑫潮信息技术有限公司，并保留所有权利。
*
* 软件声明：未经授权前提下，不得用于商业运营、二次开发以及任何形式的再次发布。
 */
class admin_comset_controller extends adminCommon{	 

	function index_action(){
    
        $rating               =     $this->MODEL('rating');
        
        $rwhere['category']   =     1;
        
        $rwhere['orderby']	  =	    array('sort,desc');
        
        $qy_rows              =     $rating -> getList($rwhere);
    
		$this->yunset("qy_rows",$qy_rows);
		
		$this->yunset("com_link_no",@explode(',',$this->config['com_link_no']));
    
		$this->yuntpl(array('admin/admin_com_config'));
    
	}
	function save_action(){
    	
        $configM    =   $this->   MODEL("config");
    
 		if($_POST["config"]){
      		
            unset($_POST["config"]);
			unset($_POST['pytoken']);
			
			if($_FILES['exa_cert_wt_files']){

				$upArr  =  array(
				    'file'  =>  $_FILES['exa_cert_wt_files'],
				    'dir'   =>  'comdoc'
				);
				
				$uploadM  =  $this->MODEL('upload');
				
				$result   =  $uploadM -> uploadDoc($upArr);
				
				if ($result['msg']){
				    
				    $this->ACT_layer_msg($result['msg'],8);
				    
				}else{
				    $_POST['exa_cert_wt']  =  $result['docurl'];
				    
				}
			}
			

			$configM -> setConfig($_POST);
       
            $this->web_config();
      
            $this->ACT_layer_msg("配置修改成功！",9,1,2,1);
		}
	}
	function savereward_action(){
    
        $configM    =   $this->   MODEL("config");
    
	    unset($_POST["config"]);
	    
	    $configM -> setConfig($_POST);
	    
	    $this->web_config();
      
	    $this->ACT_layer_msg("配置修改成功！",9,$_SERVER['HTTP_REFERER'],2,1);
      
	}
	function logo_action(){
    
		if($_POST['submit']){
      
			$this->web_config();
      
			$this->ACT_layer_msg("会员头像配置设置成功！",9,$_SERVER['HTTP_REFERER'],2,1);
		}
		$this->yuntpl(array('admin/admin_comlogo'));
	}
	function set_action(){
		
		$this->yuntpl(array('admin/admin_integral_com'));
	}
	function rating_action(){

        $rating     =   $this->MODEL('rating');
        $qy_rows    =   $rating -> getList(array('category' => 1, 'orderby' => array('sort,desc')));
        $this->yunset("qy_rows",$qy_rows);

        $this->yunset("com_look",@explode(',',$this->config['com_look']));
        $this->yunset("rating_add",@explode(',',$this->config['rating_add']));
        $this->yuntpl(array('admin/admin_rating_config'));
	}	
	
	function reward_action(){
    
		$this->yuntpl(array('admin/admin_com_reward'));
    
	}
	
	function comspend_action(){
	    
		$configM 	=	$this -> MODEL('config');
		
		$row		=	$configM -> getInfo(array('name'=>'integral_down_resume_dayprice'));
		
		$marr		=	explode(':',$row['config']);
		
		foreach($marr as $v){
			
			$narr	=	explode('_',$v);
			
			$data[]	=	array('days'=>$narr[0],'price'=>$narr[1]);
		}
		
		$com_single_can = @explode(',',$this->config['com_single_can']);

		$this->yunset('data',$data);

		$this->yunset('com_single_can',$com_single_can);
		
		$this->yuntpl(array('admin/admin_integral_comspend'));
    
	}
	function saveComspend_action(){
	    
	    $configM    =   $this->   MODEL("config");
	    
	    if($_POST["config"]){
	        
	        unset($_POST["config"]);
	        unset($_POST['pytoken']);
	        if(isset($_POST['com_single_can'])){
	            $_POST['com_single_can'] = $_POST['com_single_can'] ? @implode(',', $_POST['com_single_can']) : '';
	        }else{
	            $_POST['com_single_can'] = '';
	        }
	        
	        
	        $configM -> setConfig($_POST);
	        
	        $this->web_config();
	        
	        $this->ACT_layer_msg("配置修改成功！",9,1,2,1);
	    }
	}

	function whb_action(){

	    $imgList    =   [
	        array('id' => 1, 'title' => '模板1'),
            array('id' => 2, 'title' => '模板2'),
            array('id' => 3, 'title' => '模板3'),
            array('id' => 4, 'title' => '模板4'),
            array('id' => 5, 'title' => '中秋节'),
            array('id' => 6, 'title' => '端午节'),
            array('id' => 7, 'title' => '感恩节'),
            array('id' => 8, 'title' => '国庆节'),
            array('id' => 9, 'title' => '五一节'),
            array('id' => 10, 'title' => '清明节'),
            array('id' => 11, 'title' => '元旦节'),
        ];
	    $this->yunset('imgList', $imgList);

        $this->yunset("job_hb",@explode(',',$this->config['sy_job_hb']));

        $this->yuntpl(array('admin/admin_company_job_hb'));
    }
}
?>