<?php
/**
 * @Copyright (C) 2016 汉潮 All rights reserved.
 * @License http://www.hanchao9999.com
 * @Author xiaoq <570035208@qq.com>
 */

namespace Admin\Controller;

/**

 * 直播配置控制器

 */

class LiveSetController extends BaseController{
	
	public function _initialize() {

		parent::_initialize ();

		$this->model = M('LiveSet');

	}
	public function chat_index(){
		$map['group'] = 1;
		$map['status'] = 1;
		$list = $this->model->where($map)->select();
		$this->assign('list',$list);
		$this->assign('livesetname','聊天配置');
		$this->assign('message','注意事项');
		$this->display('index');
	}
	public function video_index(){
		$map['group'] = 0;
		$map['status'] = 1;
		$list = $this->model->where($map)->select();
		$this->assign('list',$list);
		$this->assign('livesetname','视频配置');
		$this->assign('message','注意事项');
		$this->display('index');
	}
	public function update($config){//视频配置
		//$param = I('param.');
        if ($config && is_array($config)) {
            $vi=array();
            foreach ($config as $name => $value) {
                $map = array('name' => $name);
                if (str_exists($name, 'UPLOAD_') || str_exists($name, 'THUMB_')) $configupload[$name] = $value;
                if(is_array($value)){
                    foreach($value as $key=>$val){
                        $vi[]=implode(":",$val);
                    }
                    $value = implode(",",$vi);
                }
                //print_r($value);exit;
                $result= $this->model->where($map)->setField('value', $value);
                // if($name=='sensitive_words'){
                //     $im= new \Common\Vendor\Webim;
                //     $usersig=$im->getusersig(C('USERSIG'));//获取用户sig
                //     $im->set_user_sig($usersig['info']);//设置当前用户sig
                //     $info = $im->openim_dirty_words($value);
                // }
            }
        }
		if ($result) {
            $this->success('操作成功');
        } else {
            $this->error('操作失败');
        }
	}
}