<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Caiji extends CI_Controller {

	function __construct(){
		parent::__construct();
        	$this->load->helper('url');
        	$this->load->helper('form');
                $this->load->library('session'); //加载session
		$this->load->model('CsdjDB');
		$this->load->model('CsdjSkins');
		$this->load->model('CsdjAdmin');
	        $this->CsdjAdmin->Admin_Login();
                $this->load->helper('file');
	}

	public function index()
	{
 	    $sid = $this->input->get('sid');
 	    $page = $this->input->get('page');
            if(empty($page)) $page=1;

            if(empty($sid)){
	         $sql_string = "SELECT * FROM ".CS_SqlPrefix."caiji order by CS_ID desc";
            }else{
	         $sql_string = "SELECT * FROM ".CS_SqlPrefix."caiji where cs_sid=".$sid." order by CS_ID desc";
            }
	    $query = $this->db->query($sql_string); 
	    $total = $query->num_rows();

            $base_url = site_url('admin/caiji/index/')."?sid=".$sid;
	    $per_page = 20; 
            $totalPages = ceil($total / $per_page); // 总页数
	    $data['nums'] = $total;
            if($total<$per_page){
               $per_page=$total;
            }
            $sql_string.=' limit '. $per_page*($page-1) .','. $per_page;
	    $query = $this->db->query($sql_string);

	    $data['caiji'] = $query->result();
	    $data['pages'] = $this->CsdjAdmin->get_page($base_url,$totalPages,$page,10); //获取分页类

            $this->load->view('admin/caiji',$data);
        }

	public function error()
	{
 	    $zid = $this->input->get('zid');
 	    $page = $this->input->get('page');
            if(empty($page)) $page=1;

            if($zid==1){
	         $sql_string = "SELECT * FROM ".CS_SqlPrefix."cjlist where cs_zid=0 order by CS_ID desc";
            }elseif($zid==2){
	         $sql_string = "SELECT * FROM ".CS_SqlPrefix."cjlist where cs_zid=1 order by CS_ID desc";
            }else{
	         $sql_string = "SELECT * FROM ".CS_SqlPrefix."cjlist order by CS_ID desc";
            }
	    $query = $this->db->query($sql_string); 
	    $total = $query->num_rows();

            $base_url = site_url('admin/caiji/error/')."?zid=".$zid;
	    $per_page = 20; 
            $totalPages = ceil($total / $per_page); // 总页数
	    $data['nums'] = $total;
            if($total<$per_page){
               $per_page=$total;
            }
            $sql_string.=' limit '. $per_page*($page-1) .','. $per_page;
	    $query = $this->db->query($sql_string);

	    $data['caiji'] = $query->result();
	    $data['pages'] = $this->CsdjAdmin->get_page($base_url,$totalPages,$page,10); //获取分页类

            $this->load->view('admin/caiji_error',$data);
        }

	public function errordel()
	{
            $this->CsdjAdmin->Admin_Qx('37');
 	    $ids = $this->input->post('CS_ID');
 	    $ac = $this->input->get('ac');

            if($ac=='all'){
                 $this->db->query("delete from ".CS_SqlPrefix."cjlist");
            }elseif($ac=='cg'){
                 $this->db->query("delete from ".CS_SqlPrefix."cjlist where CS_ZID=0");
            }elseif($ac=='sb'){
                 $this->db->query("delete from ".CS_SqlPrefix."cjlist where CS_ZID=1");
            }else{
                 if(empty($ids)) $this->CsdjAdmin->Admin_Url('<font color=red>参数错误，ID为空！</font>','javascript:history.back();');
                 $id=implode(',', $ids);
                 $this->db->query("delete from ".CS_SqlPrefix."cjlist where CS_ID in (".$id.")");
            }
            $this->CsdjAdmin->Admin_Url('<font color=#0000ff>恭喜您，删除成功！</font>',$_SERVER['HTTP_REFERER'],'ok');
        }

	public function daoru()
	{
            $this->load->view('admin/caiji_daoru');
        }

	public function datas()
	{
 	    $page = $this->input->get('page');
 	    $sid = $this->input->get('sid');
 	    $zid = $this->input->get('zid');
            if(empty($page)) $page=1;

            if(empty($sid)){
               if($zid==1 || $zid==2){
	         $sql_string = "SELECT * FROM ".CS_SqlPrefix."cjdata where cs_zid=".($zid-1)." order by CS_AddTime desc";
               }else{
	         $sql_string = "SELECT * FROM ".CS_SqlPrefix."cjdata order by CS_AddTime desc";
               }
            }else{
               if($zid==1 || $zid==2){
	         $sql_string = "SELECT * FROM ".CS_SqlPrefix."cjdata where cs_sid=".$sid." and cs_zid=".($zid-1)." order by CS_AddTime desc";
               }else{
	         $sql_string = "SELECT * FROM ".CS_SqlPrefix."cjdata where cs_sid=".$sid." order by CS_AddTime desc";
               }
            }

	    $query = $this->db->query($sql_string); 
	    $total = $query->num_rows();

            $base_url = site_url('admin/caiji/datas/')."?sid=".$sid."&zid=".$zid;
	    $per_page = 20; 
            $totalPages = ceil($total / $per_page); // 总页数
	    $data['nums'] = $total;
            if($total<$per_page){
               $per_page=$total;
            }
            $sql_string.=' limit '. $per_page*($page-1) .','. $per_page;
	    $query = $this->db->query($sql_string);

	    $data['datas'] = $query->result();
	    $data['sid'] = $sid;
	    $data['pages'] = $this->CsdjAdmin->get_page($base_url,$totalPages,$page,10); //获取分页类

            $this->load->view('admin/caiji_datas',$data);
        }

	public function plrksid()
	{
            $this->CsdjAdmin->Admin_Qx('37');
	    $id = $this->uri->segment(4);
 	    $page = $this->input->get('page');
            if(empty($page)) $page=1;
            if(empty($id)) $this->CsdjAdmin->Admin_Url('<font color=red>参数错误，ID为空！</font>',site_url('admin/caiji/'));

	    $sql_string = "SELECT * FROM ".CS_SqlPrefix."cjdata where CS_SID=".$id." order by CS_ID desc";
	    $query = $this->db->query($sql_string); 
	    $total = $query->num_rows();
	    $per_page = 20; 
            $totalPages = ceil($total / $per_page); // 总页数
            if($total<$per_page){
               $per_page=$total;
            }
            $sql_string.=' limit '. $per_page*($page-1) .','. $per_page;
	    $query = $this->db->query($sql_string);
	    $datas = $query->result();

            echo '<LINK href="'.base_url().'csdj/admin/images/admin.css" type="text/css" rel="stylesheet">';

            echo "<table align='left' border='0'style='border-collapse:collapse;'><tr><td>&nbsp;正在入库数据第<font style='color:red; font-size:15px; font-style:italic'>".$page."</font>页，共<font style='color:red; font-size:15px; font-style:italic'>".$totalPages."</font>页&nbsp;&nbsp;&nbsp;<a href='".site_url('admin/caiji/datas/')."'><font color=#0000ff>紧急停止</font></a></td></tr>" ;

            if(empty($datas)) die("<tr><td>&nbsp;<font style=color:red;font-size:10pt;><b>所有数据入库完毕．．．．</b></font></td></tr></table><script>setTimeout('ReadGo();',2000);function ReadGo(){window.parent.location.reload();parent.Dialog.close();}</script>");

            foreach ($datas as $row) { 
                 if($row->CS_ZID==0){

                        $data['CS_Name']=$row->CS_Name;
                        $data['CS_CID']=$row->CS_CID;
                        $data['CS_Content']=$row->CS_Content;
                        $data['CS_Tags']=$row->CS_Tags;
                        $data['CS_Pic']=$row->CS_Pic;
                        $data['CS_Keywords']=$row->CS_Tags;
                        $data['CS_User']=$row->CS_User;
                        $data['CS_Template']=$row->CS_Template;
                        $data['CS_AddTime']=date('Y-m-d H:i:s');

                            if($row->CS_SID==1){ //歌曲
                                $data['CS_FID']=$row->CS_FID;
                                $data['CS_PlayUrl']=$row->CS_PlayUrl;
                                $data['CS_DownUrl1']=$row->CS_PlayUrl;
                                $this->CsdjDB->get_insert('dance',$data);
                            }elseif($row->CS_SID==2){ //文章
                                $data['CS_Laiyuan']=$row->CS_Laiy;
                                $this->CsdjDB->get_insert('news',$data);
                            }else{  //视频
                                $data['CS_FID']=$row->CS_FID;
                                $data['CS_Daoy']=$row->CS_Daoy;
                                $data['CS_Yany']=$row->CS_Yany;
                                $data['CS_Year']=$row->CS_Year;
                                $data['CS_Laiy']=$row->CS_Laiy;
                                $data['CS_PlayUrl']=$row->CS_PlayUrl;
                                $this->CsdjDB->get_insert('vod',$data);
                            }
                            $data2['CS_ZID']=1;
                            $this->CsdjDB->get_update('cjdata',$row->CS_ID,$data2);  //修改入库状态
                 } 
                echo "<tr><td>&nbsp;<font style=font-size:10pt;><font color=red>".$row->CS_Name."</font>入库完成...</font></td></tr>";
            }

	    if($page>$totalPages){
		die("<tr><td>&nbsp;<font style=color:red;font-size:10pt;><b>所有数据入库完毕．．．．</b></font></td></tr></table><script>setTimeout('ReadGo();',2000);function ReadGo(){window.parent.location.reload();parent.Dialog.close();}</script>");
	    }else{	
		die("<tr><td>&nbsp;<font style=font-size:10pt;>暂停3秒后继续下一页 ．．．．</font><script language='javascript'>setTimeout('ReadGo();',".(3000).");function ReadGo(){location.href='".site_url('admin/caiji/plrksid/'.$id)."?page=".($page+1)."';}</script></td></tr></table>");
	    }

        }

	public function plruku()
	{
            $this->CsdjAdmin->Admin_Qx('37');
 	    $ids = $this->input->get('id');
            if(empty($ids)) $this->CsdjAdmin->Admin_Url('<font color=red>参数错误，ID为空！</font>',site_url('admin/caiji/'));
            echo '<LINK href="'.base_url().'csdj/admin/images/admin.css" type="text/css" rel="stylesheet">';
 	    $Arr=explode(',',$ids);
             for($i=0;$i<count($Arr);$i++){

                  $sql="SELECT * FROM ".CS_SqlPrefix."cjdata where cs_id=".$Arr[$i]."";
	          $row=$this->CsdjDB->get_all($sql);
	          if($row){

                        $data['CS_Name']=$row[0]->CS_Name;
                        $data['CS_CID']=$row[0]->CS_CID;
                        $data['CS_Content']=$row[0]->CS_Content;
                        $data['CS_Tags']=$row[0]->CS_Tags;
                        $data['CS_Pic']=$row[0]->CS_Pic;
                        $data['CS_Keywords']=$row[0]->CS_Tags;
                        $data['CS_User']=$row[0]->CS_User;
                        $data['CS_Template']=$row[0]->CS_Template;
                        $data['CS_AddTime']=date('Y-m-d H:i:s');

                        if($row[0]->CS_ZID==1){
                            echo "<font color=red>&nbsp;-->&nbsp;数据".$row[0]->CS_Name.",已经入库了，跳过...</font><br>";
                        }else{
                            if($row[0]->CS_SID==1){ //歌曲
								//判断歌手是否存在
								if(!empty($row[0]->CS_Yany)){
								   $rows=$this->db->query("SELECT CS_ID FROM ".CS_SqlPrefix."singer where CS_Name='".$row[0]->CS_Yany."'")->row();
								   if($rows){
							              $data['CS_SingerID']=$rows->CS_ID;
								   }else{
									      $adds['CS_Name']=$row[0]->CS_Yany;
									      $adds['CS_CID']=1;
									      $adds['CS_AddTime']=date('Y-m-d H:i:s');
										  $singerid=$this->CsdjDB->get_insert('singer',$adds);
							              $data['CS_SingerID']=intval($singerid);
								   }
                                   $data['CS_Singer']=$row[0]->CS_Yany;
                                }
                                $data['CS_FID']=$row[0]->CS_FID;
                                $data['CS_PID']=$row[0]->CS_PID;
                                $data['CS_PlayUrl']=$row[0]->CS_PlayUrl;
                                $data['CS_DownUrl1']=$row[0]->CS_PlayUrl;
                                $this->CsdjDB->get_insert('dance',$data);
                            }elseif($row[0]->CS_SID==2){ //文章
                                $data['CS_Laiyuan']=$row[0]->CS_Laiy;
                                $this->CsdjDB->get_insert('news',$data);
                            }else{  //视频
                                $data['CS_FID']=$row[0]->CS_FID;
                                $data['CS_Daoy']=$row[0]->CS_Daoy;
                                $data['CS_Yany']=$row[0]->CS_Yany;
                                $data['CS_Year']=$row[0]->CS_Year;
                                $data['CS_Laiy']=$row[0]->CS_Laiy;
                                $data['CS_PlayUrl']=$row[0]->CS_PlayUrl;
                                $this->CsdjDB->get_insert('vod',$data);
                            }
                            $data2['CS_ZID']=1;
                            $this->CsdjDB->get_update('cjdata',$row[0]->CS_ID,$data2);  //修改入库状态
                            echo "<font color=#0076AE>&nbsp;-->&nbsp;数据".$row[0]->CS_Name.",入库完成...</font><br>";
                        }
                  }
             }
             die("<script>setTimeout('ReadGo();',2000);function ReadGo(){window.parent.location.reload();parent.Dialog.close();}</script>"); //关闭窗口
        }

	public function add()
	{
 	    $page = $this->input->get('page');
            if(empty($page)) $page=1;

            if($page==1){
                 $data['CS_Name']="";
                 $data['CS_Url']="";
                 $data['CS_Code']="GB2312";
                 $data['CS_SID']="0";
                 $data['CS_CID']="0";
                 $data['CS_PID']="";
                 $data['CS_Laiy']="";
                 $data['CS_Cjurl']="";
                 $data['CS_Ksid']="1";
                 $data['CS_Jsid']="1";
                 $data['CS_FID']="0";
                 $data['CS_User']="admin";
                 $data['CS_CFID']="0";
                 $data['CS_PicID']="0";
                 $data['CS_DXID']="0";
                 $data['CS_RKID']="0";
                 $data['CS_Template']="";

            }elseif($page==2){
 	         $data['CS_Name'] = $this->input->post('CS_Name');
 	         $data['CS_Url'] = $this->input->post('CS_Url');
 	         $data['CS_Code'] = $this->input->post('CS_Code');
                 $data['CS_SID']= $this->input->post('CS_SID');
                 $data['CS_CID']= $this->input->post('CS_CID'.$data['CS_SID']);
                 $data['CS_PID']= $this->input->post('CS_PID');
                 $data['CS_Laiy']= $this->input->post('CS_Laiy');
 	         $data['CS_Cjurl'] = $this->input->post('CS_Cjurl');
 	         $data['CS_Ksid'] = $this->input->post('CS_Ksid');
 	         $data['CS_Jsid'] = $this->input->post('CS_Jsid');
                 $data['CS_FID']= $this->input->post('CS_FID'.$data['CS_SID']);
                 $data['CS_User']= $this->input->post('CS_User');
                 $data['CS_CFID']= $this->input->post('CS_CFID');
                 $data['CS_PicID']= $this->input->post('CS_PicID');
                 $data['CS_DXID']= $this->input->post('CS_DXID');
                 $data['CS_RKID']= $this->input->post('CS_RKID');
                 $data['CS_Template']= $this->input->post('CS_Template');
                 $this->session->set_userdata($data); //写入缓存

                 $CS_Cjurl =str_replace('{$id}',$data['CS_Ksid'],$data['CS_Cjurl']);
                 $data['CS_Html']=$this->CsdjAdmin->HtmlAll($CS_Cjurl,$data['CS_Code']);
                 if(empty($data['CS_Html'])) $this->CsdjAdmin->Admin_Url('<font color=red>获取列表页出错！</font>','javascript:history.back();');

                 $data['CS_Listks']="";
                 $data['CS_Listjs']="";

            }elseif($page==3){
 	         $data['CS_Listks'] = $this->input->post('CS_Listks');
                 $data['CS_Listjs']= $this->input->post('CS_Listjs');
                 $this->session->set_userdata($data); //写入缓存

 	         $Html = $this->input->post('Content');
                 $Listhtml =$this->CsdjAdmin->str_substr($data['CS_Listks'],$data['CS_Listjs'],$Html);
                 if(empty($Listhtml)) $this->CsdjAdmin->Admin_Url('<font color=red>获取列表内容出错！</font>','javascript:history.back();');
                 $data['CS_Html']=$Listhtml;

                 $data['CS_Linkks']="";
                 $data['CS_Linkjs']="";
                 $data['CS_PicMode']="0";
                 $data['CS_Picks']="";
                 $data['CS_Picjs']="";

            }elseif($page==4){
                 $data['CS_Linkks']= $this->input->post('CS_Linkks');
                 $data['CS_Linkjs']= $this->input->post('CS_Linkjs');
                 $data['CS_PicMode']= $this->input->post('CS_PicMode');
                 if($data['CS_PicMode']==1){
                     $data['CS_Picks']= $this->input->post('CS_Picks');
                     $data['CS_Picjs']= $this->input->post('CS_Picjs');
                 }
                 $this->session->set_userdata($data); //写入缓存

 	         $Html = $this->input->post('Content');
                 $Linkurl=$this->CsdjAdmin->getArr($data['CS_Linkks'],$data['CS_Linkjs'],$Html);
                 if(empty($Linkurl)) $this->CsdjAdmin->Admin_Url('<font color=red>获取连接列表出错！</font>','javascript:history.back();');

                 $data['CS_Linkurl']=$Linkurl;

                 $data['CS_Nameks']="";
                 $data['CS_Namejs']="";
                 $data['CS_SingerMode']="0";
                 $data['CS_Singerks']="";
                 $data['CS_Singerjs']="";
                 $data['CS_Lrcks']="";
                 $data['CS_Lrcjs']="";
                 $data['CS_YearMode']="0";
                 $data['CS_Yearks']="";
                 $data['CS_Yearjs']="";
                 $data['CS_ZuozMode']="0";
                 $data['CS_Zuozks']="";
                 $data['CS_Zuozjs']="";
                 $data['CS_DaoyMode']="0";
                 $data['CS_Daoyks']="";
                 $data['CS_Daoyjs']="";
                 $data['CS_TagsMode']="0";
                 $data['CS_Tagsks']="";
                 $data['CS_Tagsjs']="";
                 $data['CS_YuyanMode']="0";
                 $data['CS_Yuyanks']="";
                 $data['CS_Yuyanjs']="";
                 $data['CS_DiquMode']="0";
                 $data['CS_Diquks']="";
                 $data['CS_Diqujs']="";
                 $data['CS_Playks']="";
                 $data['CS_Playjs']="";
                 $data['CS_Danceks']="";
                 $data['CS_Dancejs']="";
                 $data['CS_LaiyuanMode']="0";
                 $data['CS_Laiyuanks']="";
                 $data['CS_Laiyuanjs']="";
                 $data['CS_LrcTh']="";
                 $data['CS_DanceTh']="";
                 $data['CS_Playlinkks']="";
                 $data['CS_Playlinkjs']="";
                 $data['CS_PlayMode']="0";
                 if($data['CS_PicMode']==2){
                     $data['CS_Picks']= "";
                     $data['CS_Picjs']= "";
                 }
                 if($data['CS_ZuozMode']==2) $data['CS_Zuozks']=$this->input->post('CS_Zuoz');

                 if($data['CS_PicMode']==1){
                    $Picurl=$this->CsdjAdmin->getArr($data['CS_Picks'],$data['CS_Picjs'],$Html);
                    if(empty($Picurl)) $this->CsdjAdmin->Admin_Url('<font color=red>获取图片列表出错！</font>','javascript:history.back();');
                    $data['CS_Picurl']=$Picurl;
                    $datap['CS_Pic']=$Picurl[0];
                    $this->session->set_userdata($datap); //写入缓存
                 }

                 if(substr($Linkurl[0],0,7)!="http://") $Linkurl[0]=$this->session->userdata('CS_Url').$Linkurl[0];
                 $data['CS_Html']=$this->CsdjAdmin->HtmlAll($Linkurl[0],$this->session->userdata('CS_Code'));
                 if(empty($data['CS_Html'])) $this->CsdjAdmin->Admin_Url('<font color=red>获取内容页出错！</font>','javascript:history.back();');

            }elseif($page==5){

                 $data['CS_Name']=$this->session->userdata('CS_Name');
                 $data['CS_Url']=$this->session->userdata('CS_Url');
                 $data['CS_Code']=$this->session->userdata('CS_Code');
                 $data['CS_SID']=$this->session->userdata('CS_SID');
                 $data['CS_CID']=$this->session->userdata('CS_CID');
                 $data['CS_PID']=$this->session->userdata('CS_PID');
                 $data['CS_Laiy']=$this->session->userdata('CS_Laiy');
                 $data['CS_Cjurl']=$this->session->userdata('CS_Cjurl');
                 $data['CS_Ksid']=$this->session->userdata('CS_Ksid');
                 $data['CS_Jsid']=$this->session->userdata('CS_Jsid');
                 $data['CS_FID']=$this->session->userdata('CS_FID');
                 $data['CS_User']=$this->session->userdata('CS_User');
                 $data['CS_CFID']=$this->session->userdata('CS_CFID');
                 $data['CS_PicID']=$this->session->userdata('CS_PicID');
                 $data['CS_DXID']=$this->session->userdata('CS_DXID');
                 $data['CS_RKID']=$this->session->userdata('CS_RKID');
                 $data['CS_Listks']=$this->session->userdata('CS_Listks');
                 $data['CS_Listjs']=$this->session->userdata('CS_Listjs');
                 $data['CS_Linkks']=$this->session->userdata('CS_Linkks');
                 $data['CS_Linkjs']=$this->session->userdata('CS_Linkjs');
                 $data['CS_PicMode']=$this->session->userdata('CS_PicMode');
                 $data['CS_Picks']=$this->session->userdata('CS_Picks');
                 $data['CS_Picjs']=$this->session->userdata('CS_Picjs'); 	         
                 $data['CS_Template']= $this->session->userdata('CS_Template');
                 

                 $data['CS_Nameks']= $this->input->post('CS_Nameks');
                 $data['CS_Namejs']= $this->input->post('CS_Namejs');
                 $data['CS_Singerks']= $this->input->post('CS_Singerks');
                 $data['CS_Singerjs']= $this->input->post('CS_Singerjs');
                 if($this->session->userdata('CS_PicMode')==2){
                     $data['CS_Picks']= $this->input->post('CS_Picks');
                     $data['CS_Picjs']= $this->input->post('CS_Picjs');
                 }
                 $data['CS_Lrcks']= $this->input->post('CS_Lrcks');
                 $data['CS_Lrcjs']= $this->input->post('CS_Lrcjs');
                 $data['CS_YearMode']= $this->input->post('CS_YearMode');
                 $data['CS_Yearks']= $this->input->post('CS_Yearks');
                 $data['CS_Yearjs']= $this->input->post('CS_Yearjs');
                 $data['CS_ZuozMode']= $this->input->post('CS_ZuozMode');
                 $data['CS_Zuozks']= $this->input->post('CS_Zuozks');
                 $data['CS_Zuozjs']= $this->input->post('CS_Zuozjs');
                 $data['CS_DaoyMode']= $this->input->post('CS_DaoyMode');
                 $data['CS_Daoyks']= $this->input->post('CS_Daoyks');
                 $data['CS_Daoyjs']= $this->input->post('CS_Daoyjs');
                 $data['CS_TagsMode']= $this->input->post('CS_TagsMode');
                 $data['CS_Tagsks']= $this->input->post('CS_Tagsks');
                 $data['CS_Tagsjs']= $this->input->post('CS_Tagsjs');
                 $data['CS_YuyanMode']= $this->input->post('CS_YuyanMode');
                 $data['CS_Yuyanks']= $this->input->post('CS_Yuyanks');
                 $data['CS_Yuyanjs']= $this->input->post('CS_Yuyanjs');
                 $data['CS_DiquMode']= $this->input->post('CS_DiquMode');
                 $data['CS_Diquks']= $this->input->post('CS_Diquks');
                 $data['CS_Diqujs']= $this->input->post('CS_Diqujs');
                 $data['CS_PlayMode']= $this->input->post('CS_PlayMode');
                 $data['CS_Playks']= $this->input->post('CS_Playks');
                 $data['CS_Playjs']= $this->input->post('CS_Playjs');
                 $data['CS_Danceks']= $this->input->post('CS_Danceks');
                 $data['CS_Dancejs']= $this->input->post('CS_Dancejs');
                 $data['CS_LaiyuanMode']= $this->input->post('CS_LaiyuanMode');
                 $data['CS_Laiyuanks']= $this->input->post('CS_Laiyuanks');
                 $data['CS_Laiyuanjs']= $this->input->post('CS_Laiyuanjs');
                 $data['CS_LrcTh']=$this->input->post('CS_LrcTh');
                 $data['CS_DanceTh']=$this->input->post('CS_DanceTh');
                 $data['CS_Playlinkks']= $this->input->post('CS_Playlinkks');
                 $data['CS_Playlinkjs']= $this->input->post('CS_Playlinkjs');

                 if($data['CS_DiquMode']==2) $data['CS_Diquks']=$this->input->post('CS_Diqu');
                 if($data['CS_YuyanMode']==2) $data['CS_Yuyanks']=$this->input->post('CS_Yuyan');
                 if($data['CS_TagsMode']==2) $data['CS_Tagsks']=$this->input->post('CS_Tags');
                 if($data['CS_DaoyMode']==2) $data['CS_Daoyks']=$this->input->post('CS_Daoy');
                 if($data['CS_LaiyuanMode']==2) $data['CS_Laiyuanks']=$this->input->post('CS_Laiyuan');

                 $this->CsdjAdmin->Admin_Qx('36');
                 $this->CsdjDB->get_insert('caiji',$data);

                 $data['CS_Diqu']=$this->input->post('CS_Diqu');
                 $data['CS_Yuyan']=$this->input->post('CS_Yuyan');
                 $data['CS_Tags']=$this->input->post('CS_Tags');
                 $data['CS_Daoy']=$this->input->post('CS_Daoy');
                 $data['CS_Laiyuan']=$this->input->post('CS_Laiyuan');
                 $data['CS_Zuoz']=$this->input->post('CS_Laiy');
                 $data['CS_Year']=$this->input->post('CS_Year');

 	         $Html = $this->input->post('Content');

                 $data['CS_Name']= $this->CsdjAdmin->str_substr($data['CS_Nameks'],$data['CS_Namejs'],$Html);
                 $data['CS_Neir']= $this->CsdjAdmin->str_substr($data['CS_Lrcks'],$data['CS_Lrcjs'],$Html);

                 if($data['CS_TagsMode']==1){
                         $data['CS_Tags']= $this->CsdjAdmin->str_substr($data['CS_Tagsks'],$data['CS_Tagsjs'],$Html);
                 }elseif($data['CS_TagsMode']==0){
                         $data['CS_Tags']= $data['CS_Name'];
                 }
                 if($data['CS_LaiyuanMode']==1){
                         $data['CS_Laiyuan']= $this->CsdjAdmin->str_substr($data['CS_Laiyuanks'],$data['CS_Laiyuanjs'],$Html);
                 }
                 if($this->session->userdata('CS_SID')==1){  //歌曲
                      $data['CS_Singer']= $this->CsdjAdmin->str_substr($data['CS_Singerks'],$data['CS_Singerjs'],$Html);
                 }elseif($this->session->userdata('CS_SID')==3){  //视频
                        if($data['CS_YearMode']==1){
                              $data['CS_Year']= $this->CsdjAdmin->str_substr($data['CS_Yearks'],$data['CS_Yearjs'],$Html);
                        }
                        if($data['CS_YuyanMode']==1){
                              $data['CS_Yuyan']= $this->CsdjAdmin->str_substr($data['CS_Yuyanks'],$data['CS_Yuyanjs'],$Html);
                        }
                        if($data['CS_DaoyMode']==1){
                              $data['CS_Daoy']= $this->CsdjAdmin->str_substr($data['CS_Daoyks'],$data['CS_Daoyjs'],$Html);
                        }
                        if($data['CS_ZuozMode']==1){
                              $data['CS_Zuoz']= $this->CsdjAdmin->str_substr($data['CS_Zuozks'],$data['CS_Zuozjs'],$Html);
                        }
                        $data['CS_Laiyuan']=$this->session->userdata('CS_Laiy');
                 }
                 if($data['CS_PlayMode']==1){
                        $PHtml= $this->CsdjAdmin->str_substr($data['CS_Playks'],$data['CS_Playjs'],$Html);
                        $plink=$this->CsdjAdmin->getArr($data['CS_Playlinkks'],$data['CS_Playlinkjs'],$PHtml);
                        $CS_Playlink=$this->CsdjAdmin->HtmlAll($plink[0],$this->session->userdata('CS_Code'));
                        $data['CS_Dance']= $this->CsdjAdmin->str_substr($data['CS_Danceks'],$data['CS_Dancejs'],$CS_Playlink);
                 }else{
                        $data['CS_Dance']= $this->CsdjAdmin->str_substr($data['CS_Danceks'],$data['CS_Dancejs'],$Html);
                 }

                 if($this->session->userdata('CS_PicMode')==2){
                       $data['CS_Pic']= $this->CsdjAdmin->str_substr($data['CS_Picks'],$data['CS_Picjs'],$Html);
                       $datap['CS_Pic']=$data['CS_Pic'];
                       $this->session->set_userdata($datap); //写入缓存
                 }

                 //替换名称
                 if(!empty($data['CS_LrcTh'])){
                        $data['CS_Name']= $this->CsdjAdmin->collectRep($data['CS_Name'],$data['CS_LrcTh']);
                 }
                 //替换内容
                 if(!empty($data['CS_LrcTh'])){
                        $data['CS_Neir']= $this->CsdjAdmin->collectRep($data['CS_Neir'],$data['CS_LrcTh']);
                 }
                 //替换地址
                 if(!empty($data['CS_DanceTh'])){
                        $data['CS_Dance']= $this->CsdjAdmin->collectRep($data['CS_Dance'],$data['CS_DanceTh']);
                 }

            }elseif($page==6){

                 $data['CS_Name']="";
                 $data['CS_Url']="";
                 $data['CS_Code']="";
                 $data['CS_SID']="";
                 $data['CS_CID']="";
                 $data['CS_PID']="";
                 $data['CS_Laiy']="";
                 $data['CS_Cjurl']="";
                 $data['CS_Ksid']="";
                 $data['CS_Jsid']="";
                 $data['CS_FID']="";
                 $data['CS_User']="";
                 $data['CS_CFID']="";
                 $data['CS_PicID']="";
                 $data['CS_DXID']="";
                 $data['CS_RKID']="";
                 $data['CS_Listks']="";
                 $data['CS_Listjs']="";
                 $data['CS_Linkks']="";
                 $data['CS_Linkjs']="";
                 $data['CS_PicMode']="";
                 $data['CS_Picks']="";
                 $data['CS_Picjs']="";	         
                 $data['CS_Template']="";
                 $this->session->set_userdata($data); //清除缓存

                 $this->CsdjAdmin->Admin_Url('<font color=#0000ff>恭喜您，操作成功！</font>',site_url('admin/caiji/'),'ok');
            }
            $data['CS_ID']='0';
            $data['page']=$page;
            $data['xurl']=site_url('admin/caiji/add/')."?page=".($page+1);
            $this->load->view('admin/caiji_list',$data);

        }

	public function edit()
	{
	    $id = $this->uri->segment(4);
 	    $page = $this->input->get('page');
            if(empty($page)) $page=1;
            if(empty($id)) $this->CsdjAdmin->Admin_Url('<font color=red>参数错误，ID为空！</font>',site_url('admin/caiji/'));

            $sql="SELECT * FROM ".CS_SqlPrefix."caiji where cs_id=".$id."";
	    $row=$this->CsdjDB->get_all($sql);
	    if(!$row){
                 $this->CsdjAdmin->Admin_Url('<font color=red>该记录不存在！</font>',site_url('admin/caiji/'));
            }

            if($page==1){
                 $data['CS_Name']=$row[0]->CS_Name;
                 $data['CS_Url']=$row[0]->CS_Url;
                 $data['CS_Code']=$row[0]->CS_Code;
                 $data['CS_SID']=$row[0]->CS_SID;
                 $data['CS_CID']=$row[0]->CS_CID;
                 $data['CS_PID']=$row[0]->CS_PID;
                 $data['CS_Laiy']=$row[0]->CS_Laiy;
                 $data['CS_Cjurl']=$row[0]->CS_Cjurl;
                 $data['CS_Ksid']=$row[0]->CS_Ksid;
                 $data['CS_Jsid']=$row[0]->CS_Jsid;
                 $data['CS_FID']=$row[0]->CS_FID;
                 $data['CS_User']=$row[0]->CS_User;
                 $data['CS_CFID']=$row[0]->CS_CFID;
                 $data['CS_PicID']=$row[0]->CS_PicID;
                 $data['CS_DXID']=$row[0]->CS_DXID;
                 $data['CS_RKID']=$row[0]->CS_RKID;
                 $data['CS_Template']=$row[0]->CS_Template;

            }elseif($page==2){
 	         $data['CS_Name'] = $this->input->post('CS_Name');
 	         $data['CS_Url'] = $this->input->post('CS_Url');
 	         $data['CS_Code'] = $this->input->post('CS_Code');
                 $data['CS_SID']= $this->input->post('CS_SID');
                 $data['CS_CID']= $this->input->post('CS_CID'.$data['CS_SID']);
                 $data['CS_PID']= $this->input->post('CS_PID');
                 $data['CS_Laiy']= $this->input->post('CS_Laiy');
 	         $data['CS_Cjurl'] = $this->input->post('CS_Cjurl');
 	         $data['CS_Ksid'] = $this->input->post('CS_Ksid');
 	         $data['CS_Jsid'] = $this->input->post('CS_Jsid');
                 $data['CS_FID']= $this->input->post('CS_FID'.$data['CS_SID']);
                 $data['CS_User']= $this->input->post('CS_User');
                 $data['CS_CFID']= $this->input->post('CS_CFID');
                 $data['CS_PicID']= $this->input->post('CS_PicID');
                 $data['CS_DXID']= $this->input->post('CS_DXID');
                 $data['CS_RKID']= $this->input->post('CS_RKID');
                 $data['CS_Template']= $this->input->post('CS_Template');
                 $this->session->set_userdata($data); //写入缓存

                 $CS_Cjurl =str_replace('{$id}',$data['CS_Ksid'],$data['CS_Cjurl']);
                 $data['CS_Html']=$this->CsdjAdmin->HtmlAll($CS_Cjurl,$data['CS_Code']);
                 if(empty($data['CS_Html'])) $this->CsdjAdmin->Admin_Url('<font color=red>获取列表页出错！</font>','javascript:history.back();');

                 $data['CS_Listks']=$row[0]->CS_Listks;
                 $data['CS_Listjs']=$row[0]->CS_Listjs;

            }elseif($page==3){
 	         $data['CS_Listks'] = $this->input->post('CS_Listks');
                 $data['CS_Listjs']= $this->input->post('CS_Listjs');
                 $this->session->set_userdata($data); //写入缓存

 	         $Html = $this->input->post('Content');
                 $Listhtml =$this->CsdjAdmin->str_substr($data['CS_Listks'],$data['CS_Listjs'],$Html);
                 if(empty($Listhtml)) $this->CsdjAdmin->Admin_Url('<font color=red>获取列表内容出错！</font>','javascript:history.back();');
                 $data['CS_Html']=$Listhtml;

                 $data['CS_Linkks']=$row[0]->CS_Linkks;
                 $data['CS_Linkjs']=$row[0]->CS_Linkjs;
                 $data['CS_PicMode']=$row[0]->CS_PicMode;
                 $data['CS_Picks']=$row[0]->CS_Picks;
                 $data['CS_Picjs']=$row[0]->CS_Picjs;

            }elseif($page==4){
                 $data['CS_Linkks']= $this->input->post('CS_Linkks');
                 $data['CS_Linkjs']= $this->input->post('CS_Linkjs');
                 $data['CS_PicMode']= $this->input->post('CS_PicMode');
                 if($data['CS_PicMode']==1){
                     $data['CS_Picks']= $this->input->post('CS_Picks');
                     $data['CS_Picjs']= $this->input->post('CS_Picjs');
                 }
                 $this->session->set_userdata($data); //写入缓存

 	         $Html = $this->input->post('Content');
                 $Linkurl=$this->CsdjAdmin->getArr($data['CS_Linkks'],$data['CS_Linkjs'],$Html);
                 if(empty($Linkurl)) $this->CsdjAdmin->Admin_Url('<font color=red>获取连接列表出错！</font>','javascript:history.back();');

                 $data['CS_Linkurl']=$Linkurl;

                 $data['CS_Nameks']=$row[0]->CS_Nameks;
                 $data['CS_Namejs']=$row[0]->CS_Namejs;
                 $data['CS_SingerMode']=$row[0]->CS_SingerMode;
                 $data['CS_Singerks']=$row[0]->CS_Singerks;
                 $data['CS_Singerjs']=$row[0]->CS_Singerjs;
                 $data['CS_Lrcks']=$row[0]->CS_Lrcks;
                 $data['CS_Lrcjs']=$row[0]->CS_Lrcjs;
                 $data['CS_YearMode']=$row[0]->CS_YearMode;
                 $data['CS_Yearks']=$row[0]->CS_Yearks;
                 $data['CS_Yearjs']=$row[0]->CS_Yearjs;
                 $data['CS_ZuozMode']=$row[0]->CS_ZuozMode;
                 $data['CS_Zuozks']=$row[0]->CS_Zuozks;
                 $data['CS_Zuozjs']=$row[0]->CS_Zuozjs;
                 $data['CS_DaoyMode']=$row[0]->CS_DaoyMode;
                 $data['CS_Daoyks']=$row[0]->CS_Daoyks;
                 $data['CS_Daoyjs']=$row[0]->CS_Daoyjs;
                 $data['CS_TagsMode']=$row[0]->CS_TagsMode;
                 $data['CS_Tagsks']=$row[0]->CS_Tagsks;
                 $data['CS_Tagsjs']=$row[0]->CS_Tagsjs;
                 $data['CS_YuyanMode']=$row[0]->CS_YuyanMode;
                 $data['CS_Yuyanks']=$row[0]->CS_Yuyanks;
                 $data['CS_Yuyanjs']=$row[0]->CS_Yuyanjs;
                 $data['CS_DiquMode']=$row[0]->CS_DiquMode;
                 $data['CS_Diquks']=$row[0]->CS_Diquks;
                 $data['CS_Diqujs']=$row[0]->CS_Diqujs;
                 $data['CS_PlayMode']=$row[0]->CS_PlayMode;
                 $data['CS_Playks']=$row[0]->CS_Playks;
                 $data['CS_Playjs']=$row[0]->CS_Playjs;
                 $data['CS_Danceks']=$row[0]->CS_Danceks;
                 $data['CS_Dancejs']=$row[0]->CS_Dancejs;
                 $data['CS_LaiyuanMode']=$row[0]->CS_LaiyuanMode;
                 $data['CS_Laiyuanks']=$row[0]->CS_Laiyuanks;
                 $data['CS_Laiyuanjs']=$row[0]->CS_Laiyuanjs;
                 $data['CS_LrcTh']=$row[0]->CS_LrcTh;
                 $data['CS_DanceTh']= $row[0]->CS_DanceTh;
                 $data['CS_Playlinkks']=$row[0]->CS_Playlinkks;
                 $data['CS_Playlinkjs']=$row[0]->CS_Playlinkjs;

                 if($data['CS_PicMode']==2){
                     $data['CS_Picks']= $row[0]->CS_Picks;
                     $data['CS_Picjs']= $row[0]->CS_Picjs;
                 }
                 if($data['CS_ZuozMode']==2) $data['CS_Zuozks']=$this->input->post('CS_Zuoz');

                 if($data['CS_PicMode']==1){
                    $Picurl=$this->CsdjAdmin->getArr($data['CS_Picks'],$data['CS_Picjs'],$Html);
                    if(empty($Picurl)) $this->CsdjAdmin->Admin_Url('<font color=red>获取图片列表出错！</font>','javascript:history.back();');
                    $data['CS_Picurl']=$Picurl;
                    $datap['CS_Pic']=$Picurl[0];
                    $this->session->set_userdata($datap); //写入缓存
                 }
                 if(substr($Linkurl[0],0,7)!="http://") $Linkurl[0]=$this->session->userdata('CS_Url').$Linkurl[0];
                 $data['CS_Html']=$this->CsdjAdmin->HtmlAll($Linkurl[0],$this->session->userdata('CS_Code'));
                 if(empty($data['CS_Html'])) $this->CsdjAdmin->Admin_Url('<font color=red>获取内容页出错！</font>','javascript:history.back();');

            }elseif($page==5){

                 $data['CS_Name']=$this->session->userdata('CS_Name');
                 $data['CS_Url']=$this->session->userdata('CS_Url');
                 $data['CS_Code']=$this->session->userdata('CS_Code');
                 $data['CS_SID']=$this->session->userdata('CS_SID');
                 $data['CS_CID']=$this->session->userdata('CS_CID');
                 $data['CS_PID']=$this->session->userdata('CS_PID');
                 $data['CS_Laiy']=$this->session->userdata('CS_Laiy');
                 $data['CS_Cjurl']=$this->session->userdata('CS_Cjurl');
                 $data['CS_Ksid']=$this->session->userdata('CS_Ksid');
                 $data['CS_Jsid']=$this->session->userdata('CS_Jsid');
                 $data['CS_FID']=$this->session->userdata('CS_FID');
                 $data['CS_User']=$this->session->userdata('CS_User');
                 $data['CS_CFID']=$this->session->userdata('CS_CFID');
                 $data['CS_PicID']=$this->session->userdata('CS_PicID');
                 $data['CS_DXID']=$this->session->userdata('CS_DXID');
                 $data['CS_RKID']=$this->session->userdata('CS_RKID');
                 $data['CS_Listks']=$this->session->userdata('CS_Listks');
                 $data['CS_Listjs']=$this->session->userdata('CS_Listjs');
                 $data['CS_Linkks']=$this->session->userdata('CS_Linkks');
                 $data['CS_Linkjs']=$this->session->userdata('CS_Linkjs');
                 $data['CS_PicMode']=$this->session->userdata('CS_PicMode');
                 $data['CS_Picks']=$this->session->userdata('CS_Picks');
                 $data['CS_Picjs']=$this->session->userdata('CS_Picjs'); 	         
                 $data['CS_Template']= $this->session->userdata('CS_Template');


                 $data['CS_Nameks']= $this->input->post('CS_Nameks');
                 $data['CS_Namejs']= $this->input->post('CS_Namejs');
                 $data['CS_Singerks']= $this->input->post('CS_Singerks');
                 $data['CS_Singerjs']= $this->input->post('CS_Singerjs');
                 if($this->session->userdata('CS_PicMode')==2){
                     $data['CS_Picks']= $this->input->post('CS_Picks');
                     $data['CS_Picjs']= $this->input->post('CS_Picjs');
                 }
                 $data['CS_Lrcks']= $this->input->post('CS_Lrcks');
                 $data['CS_Lrcjs']= $this->input->post('CS_Lrcjs');
                 $data['CS_YearMode']= $this->input->post('CS_YearMode');
                 $data['CS_Yearks']= $this->input->post('CS_Yearks');
                 $data['CS_Yearjs']= $this->input->post('CS_Yearjs');
                 $data['CS_ZuozMode']= $this->input->post('CS_ZuozMode');
                 $data['CS_Zuozks']= $this->input->post('CS_Zuozks');
                 $data['CS_Zuozjs']= $this->input->post('CS_Zuozjs');
                 $data['CS_DaoyMode']= $this->input->post('CS_DaoyMode');
                 $data['CS_Daoyks']= $this->input->post('CS_Daoyks');
                 $data['CS_Daoyjs']= $this->input->post('CS_Daoyjs');
                 $data['CS_TagsMode']= $this->input->post('CS_TagsMode');
                 $data['CS_Tagsks']= $this->input->post('CS_Tagsks');
                 $data['CS_Tagsjs']= $this->input->post('CS_Tagsjs');
                 $data['CS_YuyanMode']= $this->input->post('CS_YuyanMode');
                 $data['CS_Yuyanks']= $this->input->post('CS_Yuyanks');
                 $data['CS_Yuyanjs']= $this->input->post('CS_Yuyanjs');
                 $data['CS_DiquMode']= $this->input->post('CS_DiquMode');
                 $data['CS_Diquks']= $this->input->post('CS_Diquks');
                 $data['CS_Diqujs']= $this->input->post('CS_Diqujs');
                 $data['CS_PlayMode']= $this->input->post('CS_PlayMode');
                 $data['CS_Playks']= $this->input->post('CS_Playks');
                 $data['CS_Playjs']= $this->input->post('CS_Playjs');
                 $data['CS_Danceks']= $this->input->post('CS_Danceks');
                 $data['CS_Dancejs']= $this->input->post('CS_Dancejs');
                 $data['CS_LaiyuanMode']= $this->input->post('CS_LaiyuanMode');
                 $data['CS_Laiyuanks']= $this->input->post('CS_Laiyuanks');
                 $data['CS_Laiyuanjs']= $this->input->post('CS_Laiyuanjs');
                 $data['CS_LrcTh']= $this->input->post('CS_LrcTh');
                 $data['CS_DanceTh']= $this->input->post('CS_DanceTh');
                 $data['CS_Playlinkks']= $this->input->post('CS_Playlinkks');
                 $data['CS_Playlinkjs']= $this->input->post('CS_Playlinkjs');

                 if($data['CS_DiquMode']==2) $data['CS_Diquks']=$this->input->post('CS_Diqu');
                 if($data['CS_YuyanMode']==2) $data['CS_Yuyanks']=$this->input->post('CS_Yuyan');
                 if($data['CS_TagsMode']==2) $data['CS_Tagsks']=$this->input->post('CS_Tags');
                 if($data['CS_DaoyMode']==2) $data['CS_Daoyks']=$this->input->post('CS_Daoy');
                 if($data['CS_LaiyuanMode']==2) $data['CS_Laiyuanks']=$this->input->post('CS_Laiyuan');

                 $this->CsdjAdmin->Admin_Qx('36');
                 $this->CsdjDB->get_update('caiji',$row[0]->CS_ID,$data);

                 $data['CS_Diqu']=$this->input->post('CS_Diqu');
                 $data['CS_Yuyan']=$this->input->post('CS_Yuyan');
                 $data['CS_Tags']=$this->input->post('CS_Tags');
                 $data['CS_Daoy']=$this->input->post('CS_Daoy');
                 $data['CS_Laiyuan']=$this->input->post('CS_Laiyuan');
                 $data['CS_Zuoz']=$this->input->post('CS_Zuoz');
                 $data['CS_Year']=$this->input->post('CS_Year');


 	         $Html = $this->input->post('Content');

                 $data['CS_Name']= $this->CsdjAdmin->str_substr($data['CS_Nameks'],$data['CS_Namejs'],$Html);
                 $data['CS_Neir']= $this->CsdjAdmin->str_substr($data['CS_Lrcks'],$data['CS_Lrcjs'],$Html);
                 if($data['CS_TagsMode']==1){
                         $data['CS_Tags']= $this->CsdjAdmin->str_substr($data['CS_Tagsks'],$data['CS_Tagsjs'],$Html);
                 }elseif($data['CS_TagsMode']==0){
                         $data['CS_Tags']= $data['CS_Name'];
                 }else{
                         $data['CS_Tags']= $data['CS_Tagsks'];
                 }
                 if($data['CS_LaiyuanMode']==1){
                              $data['CS_Laiyuan']= $this->CsdjAdmin->str_substr($data['CS_Laiyuanks'],$data['CS_Laiyuanjs'],$Html);
                 }
                 if($this->session->userdata('CS_SID')==1){  //歌曲
                      $data['CS_Singer']= $this->CsdjAdmin->str_substr($data['CS_Singerks'],$data['CS_Singerjs'],$Html);
                 }elseif($this->session->userdata('CS_SID')==3){  //视频
                        if($data['CS_YearMode']==1){
                              $data['CS_Year']= $this->CsdjAdmin->str_substr($data['CS_Yearks'],$data['CS_Yearjs'],$Html,2);
                        }
                        if($data['CS_YuyanMode']==1){
                              $data['CS_Yuyan']= $this->CsdjAdmin->str_substr($data['CS_Yuyanks'],$data['CS_Yuyanjs'],$Html,2);
                        }
                        if($data['CS_DaoyMode']==1){
                              $data['CS_Daoy']= $this->CsdjAdmin->str_substr($data['CS_Daoyks'],$data['CS_Daoyjs'],$Html,2);
                        }
                        if($data['CS_ZuozMode']==1){
                              $data['CS_Zuoz']= $this->CsdjAdmin->str_substr($data['CS_Zuozks'],$data['CS_Zuozjs'],$Html,2);
                        }
                        $data['CS_Laiyuan']= $this->session->userdata('CS_Laiy');
                 }

                 if($data['CS_PlayMode']==1){ //绝对地址
                        $PHtml= $this->CsdjAdmin->str_substr($data['CS_Playks'],$data['CS_Playjs'],$Html);
                        $plink=$this->CsdjAdmin->getArr($data['CS_Playlinkks'],$data['CS_Playlinkjs'],$PHtml);
                        $CS_Dance="";
                        if($plink){
 	                       foreach ($plink as $rowp) { 
                                    $CS_Playlink=$this->CsdjAdmin->HtmlAll($rowp,$this->session->userdata('CS_Code'));
                                    $CS_Dance.=$this->CsdjAdmin->str_substr($data['CS_Danceks'],$data['CS_Dancejs'],$CS_Playlink)."$$$";
 	                       }
                               $CS_Dance.="]]]";
                               $CS_Dance=str_replace('$$$]]]','',$CS_Dance);
                               $data['CS_Dance']=str_replace("$$$","\r\n",$CS_Dance);
                        }
                 }else{
                        if($row[0]->CS_SID==3){
                            if($row[0]->CS_PlayMode>0){
                               $PHtml= $this->CsdjAdmin->str_substr($data['CS_Playks'],$data['CS_Playjs'],$Html);
                               $data['CS_Dance']=$this->CsdjAdmin->getArr($data['CS_Danceks'],$data['CS_Dancejs'],$PHtml,2);
                            }else{
                               $data['CS_Dance']=$this->CsdjAdmin->str_substr($data['CS_Danceks'],$data['CS_Dancejs'],$Html);
                            }
                        }else{
                               $data['CS_Dance']= $this->CsdjAdmin->str_substr($data['CS_Danceks'],$data['CS_Dancejs'],$Html);
                        }
                 }

                 if($this->session->userdata('CS_PicMode')==2){
                       $data['CS_Pic']= $this->CsdjAdmin->str_substr($data['CS_Picks'],$data['CS_Picjs'],$Html);
                       $datap['CS_Pic']=$data['CS_Pic'];
                       $this->session->set_userdata($datap); //写入缓存
                 }

                 //替换名称
                 if(!empty($data['CS_LrcTh'])){
                        $data['CS_Name']= $this->CsdjAdmin->collectRep($data['CS_Name'],$data['CS_LrcTh']);
                 }
                 //替换内容
                 if(!empty($data['CS_LrcTh'])){
                        $data['CS_Neir']= $this->CsdjAdmin->collectRep($data['CS_Neir'],$data['CS_LrcTh']);
                 }
                 //替换地址
                 if(!empty($data['CS_DanceTh'])){
                        $data['CS_Dance']= $this->CsdjAdmin->collectRep($data['CS_Dance'],$data['CS_DanceTh']);
                 }

            }elseif($page==6){

                 $data['CS_Name']="";
                 $data['CS_Url']="";
                 $data['CS_Code']="";
                 $data['CS_SID']="";
                 $data['CS_CID']="";
                 $data['CS_PID']="";
                 $data['CS_Laiy']="";
                 $data['CS_Cjurl']="";
                 $data['CS_Ksid']="";
                 $data['CS_Jsid']="";
                 $data['CS_FID']="";
                 $data['CS_User']="";
                 $data['CS_CFID']="";
                 $data['CS_PicID']="";
                 $data['CS_DXID']="";
                 $data['CS_RKID']="";
                 $data['CS_Listks']="";
                 $data['CS_Listjs']="";
                 $data['CS_Linkks']="";
                 $data['CS_Linkjs']="";
                 $data['CS_PicMode']="";
                 $data['CS_Picks']="";
                 $data['CS_Picjs']="";	         
                 $data['CS_Template']="";
                 $this->session->set_userdata($data); //清除缓存

                 $this->CsdjAdmin->Admin_Url('<font color=#0000ff>恭喜您，操作成功！</font>',site_url('admin/caiji/'),'ok');
            }
            $data['CS_ID']=$row[0]->CS_ID;
            $data['page']=$page;
            $data['xurl']=site_url('admin/caiji/edit/'.$row[0]->CS_ID)."?page=".($page+1);
            $this->load->view('admin/caiji_list',$data);

        }

	public function del()
	{
            $this->CsdjAdmin->Admin_Qx('36');
	    $id = $this->uri->segment(4);
            if(empty($id)) $this->CsdjAdmin->Admin_Url('<font color=red>参数错误，ID为空！</font>','javascript:history.back();');
            $this->CsdjDB->get_del('caiji',$id);
            $this->CsdjAdmin->Admin_Url('<font color=#0000ff>恭喜您，删除成功！</font>',site_url('admin/caiji/'),'ok');
        }

	public function pldel()
	{
            $this->CsdjAdmin->Admin_Qx('36');
 	    $ids = $this->input->post('CS_ID');
            if(empty($ids)) $this->CsdjAdmin->Admin_Url('<font color=red>参数错误，ID为空！</font>','javascript:history.back();');
            $id=implode(',', $ids);
            $this->db->query("delete from ".CS_SqlPrefix."caiji where CS_ID in (".$id.")");
            $this->CsdjAdmin->Admin_Url('<font color=#0000ff>恭喜您，删除成功！</font>',site_url('admin/caiji/'),'ok');
        }

	public function deldata()
	{
            $this->CsdjAdmin->Admin_Qx('37');
	    $id = $this->uri->segment(4);
            if(empty($id)) $this->CsdjAdmin->Admin_Url('<font color=red>参数错误，ID为空！</font>','javascript:history.back();');
            $this->CsdjDB->get_del('cjdata',$id);
            $this->CsdjAdmin->Admin_Url('<font color=#0000ff>恭喜您，删除成功！</font>',$_SERVER['HTTP_REFERER'],'ok');
        }

	public function pldeldata()
	{
            $this->CsdjAdmin->Admin_Qx('37');
 	    $ids = $this->input->post('CS_ID');
            if(empty($ids)) $this->CsdjAdmin->Admin_Url('<font color=red>参数错误，ID为空！</font>','javascript:history.back();');
            $id=implode(',', $ids);
            $this->db->query("delete from ".CS_SqlPrefix."cjdata where CS_ID in (".$id.")");
            $this->CsdjAdmin->Admin_Url('<font color=#0000ff>恭喜您，删除成功！</font>',$_SERVER['HTTP_REFERER'],'ok');
        }

	public function delyrk()
	{
            $this->CsdjAdmin->Admin_Qx('37');
            $this->db->query("delete from ".CS_SqlPrefix."cjdata where CS_ZID=1");
            $this->CsdjAdmin->Admin_Url('<font color=#0000ff>恭喜您，删除成功！</font>',$_SERVER['HTTP_REFERER'],'ok');
        }

	public function daochu()
	{
            $this->CsdjAdmin->Admin_Qx('36');
	    $id = $this->uri->segment(4);
            if(empty($id)) $this->CsdjAdmin->Admin_Url('<font color=red>参数错误，ID为空！</font>',site_url('admin/caiji/'));

            $sql="SELECT * FROM ".CS_SqlPrefix."caiji where cs_id=".$id."";
	    $row=$this->CsdjDB->get_all($sql);
	    if(!$row){
                 $this->CsdjAdmin->Admin_Url('<font color=red>该记录不存在！</font>',site_url('admin/caiji/'));
            }else{
                 $rule="<CSCMS_CS_Name>".$row[0]->CS_Name."</CSCMS_CS_Name>\r\n";
                 $rule.="<CSCMS_CS_Url>".$row[0]->CS_Url."</CSCMS_CS_Url>\r\n";
                 $rule.="<CSCMS_CS_Code>".$row[0]->CS_Code."</CSCMS_CS_Code>\r\n";
                 $rule.="<CSCMS_CS_SID>".$row[0]->CS_SID."</CSCMS_CS_SID>\r\n";
                 $rule.="<CSCMS_CS_CID>".$row[0]->CS_CID."</CSCMS_CS_CID>\r\n";
                 $rule.="<CSCMS_CS_PID>".$row[0]->CS_PID."</CSCMS_CS_PID>\r\n";
                 $rule.="<CSCMS_CS_Laiy>".$row[0]->CS_Laiy."</CSCMS_CS_Laiy>\r\n";
                 $rule.="<CSCMS_CS_Cjurl>".$row[0]->CS_Cjurl."</CSCMS_CS_Cjurl>\r\n";
                 $rule.="<CSCMS_CS_Ksid>".$row[0]->CS_Ksid."</CSCMS_CS_Ksid>\r\n";
                 $rule.="<CSCMS_CS_Jsid>".$row[0]->CS_Jsid."</CSCMS_CS_Jsid>\r\n";
                 $rule.="<CSCMS_CS_FID>".$row[0]->CS_FID."</CSCMS_CS_FID>\r\n";
                 $rule.="<CSCMS_CS_User>".$row[0]->CS_User."</CSCMS_CS_User>\r\n";
                 $rule.="<CSCMS_CS_CFID>".$row[0]->CS_CFID."</CSCMS_CS_CFID>\r\n";
                 $rule.="<CSCMS_CS_PicID>".$row[0]->CS_PicID."</CSCMS_CS_PicID>\r\n";
                 $rule.="<CSCMS_CS_DXID>".$row[0]->CS_DXID."</CSCMS_CS_DXID>\r\n";
                 $rule.="<CSCMS_CS_RKID>".$row[0]->CS_RKID."</CSCMS_CS_RKID>\r\n";
                 $rule.="<CSCMS_CS_Listks>".$row[0]->CS_Listks."</CSCMS_CS_Listks>\r\n";
                 $rule.="<CSCMS_CS_Listjs>".$row[0]->CS_Listjs."</CSCMS_CS_Listjs>\r\n";
                 $rule.="<CSCMS_CS_Linkks>".$row[0]->CS_Linkks."</CSCMS_CS_Linkks>\r\n";
                 $rule.="<CSCMS_CS_Linkjs>".$row[0]->CS_Linkjs."</CSCMS_CS_Linkjs>\r\n";
                 $rule.="<CSCMS_CS_PicMode>".$row[0]->CS_PicMode."</CSCMS_CS_PicMode>\r\n";
                 $rule.="<CSCMS_CS_Picks>".$row[0]->CS_Picks."</CSCMS_CS_Picks>\r\n";
                 $rule.="<CSCMS_CS_Picjs>".$row[0]->CS_Picjs."</CSCMS_CS_Picjs>\r\n";
                 $rule.="<CSCMS_CS_Nameks>".$row[0]->CS_Nameks."</CSCMS_CS_Nameks>\r\n";
                 $rule.="<CSCMS_CS_Namejs>".$row[0]->CS_Namejs."</CSCMS_CS_Namejs>\r\n";
                 $rule.="<CSCMS_CS_SingerMode>".$row[0]->CS_SingerMode."</CSCMS_CS_SingerMode>\r\n";
                 $rule.="<CSCMS_CS_Singerks>".$row[0]->CS_Singerks."</CSCMS_CS_Singerks>\r\n";
                 $rule.="<CSCMS_CS_Singerjs>".$row[0]->CS_Singerjs."</CSCMS_CS_Singerjs>\r\n";
                 $rule.="<CSCMS_CS_PicMode>".$row[0]->CS_PicMode."</CSCMS_CS_PicMode>\r\n";
                 $rule.="<CSCMS_CS_Lrcks>".$row[0]->CS_Lrcks."</CSCMS_CS_Lrcks>\r\n";
                 $rule.="<CSCMS_CS_Lrcjs>".$row[0]->CS_Lrcjs."</CSCMS_CS_Lrcjs>\r\n";
                 $rule.="<CSCMS_CS_YearMode>".$row[0]->CS_YearMode."</CSCMS_CS_YearMode>\r\n";
                 $rule.="<CSCMS_CS_Yearks>".$row[0]->CS_Yearks."</CSCMS_CS_Yearks>\r\n";
                 $rule.="<CSCMS_CS_Yearjs>".$row[0]->CS_Yearjs."</CSCMS_CS_Yearjs>\r\n";
                 $rule.="<CSCMS_CS_ZuozMode>".$row[0]->CS_ZuozMode."</CSCMS_CS_ZuozMode>\r\n";
                 $rule.="<CSCMS_CS_Zuozks>".$row[0]->CS_Zuozks."</CSCMS_CS_Zuozks>\r\n";
                 $rule.="<CSCMS_CS_Zuozjs>".$row[0]->CS_Zuozjs."</CSCMS_CS_Zuozjs>\r\n";
                 $rule.="<CSCMS_CS_DaoyMode>".$row[0]->CS_DaoyMode."</CSCMS_CS_DaoyMode>\r\n";
                 $rule.="<CSCMS_CS_Daoyks>".$row[0]->CS_Daoyks."</CSCMS_CS_Daoyks>\r\n";
                 $rule.="<CSCMS_CS_Daoyjs>".$row[0]->CS_Daoyjs."</CSCMS_CS_Daoyjs>\r\n";
                 $rule.="<CSCMS_CS_TagsMode>".$row[0]->CS_TagsMode."</CSCMS_CS_TagsMode>\r\n";
                 $rule.="<CSCMS_CS_Tagsks>".$row[0]->CS_Tagsks."</CSCMS_CS_Tagsks>\r\n";
                 $rule.="<CSCMS_CS_Tagsjs>".$row[0]->CS_Tagsjs."</CSCMS_CS_Tagsjs>\r\n";
                 $rule.="<CSCMS_CS_YuyanMode>".$row[0]->CS_YuyanMode."</CSCMS_CS_YuyanMode>\r\n";
                 $rule.="<CSCMS_CS_Yuyanks>".$row[0]->CS_Yuyanks."</CSCMS_CS_Yuyanks>\r\n";
                 $rule.="<CSCMS_CS_Yuyanjs>".$row[0]->CS_Yuyanjs."</CSCMS_CS_Yuyanjs>\r\n";
                 $rule.="<CSCMS_CS_DiquMode>".$row[0]->CS_DiquMode."</CSCMS_CS_DiquMode>\r\n";
                 $rule.="<CSCMS_CS_Diquks>".$row[0]->CS_Diquks."</CSCMS_CS_Diquks>\r\n";
                 $rule.="<CSCMS_CS_Diqujs>".$row[0]->CS_Diqujs."</CSCMS_CS_Diqujs>\r\n";
                 $rule.="<CSCMS_CS_PlayMode>".$row[0]->CS_PlayMode."</CSCMS_CS_PlayMode>\r\n";
                 $rule.="<CSCMS_CS_Playks>".$row[0]->CS_Playks."</CSCMS_CS_Playks>\r\n";
                 $rule.="<CSCMS_CS_Playjs>".$row[0]->CS_Playjs."</CSCMS_CS_Playjs>\r\n";
                 $rule.="<CSCMS_CS_Playlinkks>".$row[0]->CS_Playlinkks."</CSCMS_CS_Playlinkks>\r\n";
                 $rule.="<CSCMS_CS_Playlinkjs>".$row[0]->CS_Playlinkjs."</CSCMS_CS_Playlinkjs>\r\n";
                 $rule.="<CSCMS_CS_Danceks>".$row[0]->CS_Danceks."</CSCMS_CS_Danceks>\r\n";
                 $rule.="<CSCMS_CS_Dancejs>".$row[0]->CS_Dancejs."</CSCMS_CS_Dancejs>\r\n";
                 $rule.="<CSCMS_CS_LaiyuanMode>".$row[0]->CS_LaiyuanMode."</CSCMS_CS_LaiyuanMode>\r\n";
                 $rule.="<CSCMS_CS_Laiyuanks>".$row[0]->CS_Laiyuanks."</CSCMS_CS_Laiyuanks>\r\n";
                 $rule.="<CSCMS_CS_Laiyuanjs>".$row[0]->CS_Laiyuanjs."</CSCMS_CS_Laiyuanjs>\r\n";
                 $rule.="<CSCMS_CS_LrcTh>".$row[0]->CS_LrcTh."</CSCMS_CS_LrcTh>\r\n";
                 $rule.="<CSCMS_CS_DanceTh>".$row[0]->CS_DanceTh."</CSCMS_CS_DanceTh>";

                 $this->load->helper('download');
                 force_download($row[0]->CS_Name.".txt", $rule); 
            }
        }

	public function caijigo()
	{
	    $id = $this->uri->segment(4);
 	    $ac = $this->input->get('ac');
 	    $CjCount = $this->input->get('CjCount');
 	    $page = $this->input->get('page');
 	    $xid = $this->input->get('xid');
            if(empty($page)) $page=1;
            if(empty($Cgid)) $Cgid=1;
            if(empty($Sbid)) $Sbid=1;
            if(empty($CjCount)) $CjCount=0;

            if($ac!='ceshi'){
                  $this->CsdjAdmin->Admin_Qx('37');
            }
            if(empty($id)) $this->CsdjAdmin->Admin_Url('<font color=red>参数错误，ID为空！</font>',site_url('admin/caiji/'));

            $sql="SELECT * FROM ".CS_SqlPrefix."caiji where cs_id=".$id."";
	    $row=$this->CsdjDB->get_all($sql);
	    if(!$row){
                 $this->CsdjAdmin->Admin_Url('<font color=red>该记录不存在！</font>',site_url('admin/caiji/'));
            }
            $datac['CS_Url']=$row[0]->CS_Url;
            $this->session->set_userdata($datac); //写入缓存

            if($row[0]->CS_DXID==1){
                  if(empty($xid)) $xid=$row[0]->CS_Jsid;
                  $CS_Cjurl =str_replace('{$id}',$xid,$row[0]->CS_Cjurl);
                  $ids=$xid;
                  $xid=($xid-1);
            }else{
                  if(empty($xid)) $xid=$row[0]->CS_Ksid;
                  $CS_Cjurl =str_replace('{$id}',$xid,$row[0]->CS_Cjurl);
                  $ids=$xid;
                  $xid=($xid+1);
            }
	    $Content=$this->CsdjAdmin->HtmlAll($CS_Cjurl,$row[0]->CS_Code);//读取列表文件
	    if(empty($Content)) {
		 $this->CsdjAdmin->Admin_Url('<font color=red>获取列表地址出错！</font>',site_url('admin/caiji/'));
	    }

	    $Liststr = $this->CsdjAdmin->str_substr(trim($row[0]->CS_Listks),trim($row[0]->CS_Listjs),$Content);//截取列表开始--结束
	    if(empty($Liststr)) {
		 $this->CsdjAdmin->Admin_Url('<font color=red>获取列表内容出错！</font>',site_url('admin/caiji/'));
	    }
            $dLinkArr= $this->CsdjAdmin->getArr(trim($row[0]->CS_Linkks),trim($row[0]->CS_Linkjs),$Liststr);//获取到连接地址 返回数组
	    if(empty($dLinkArr)) {
		 $this->CsdjAdmin->Admin_Url('<font color=red>获取连接地址出错！</font>',site_url('admin/caiji/'));
	    }
            $CS_Pic='';
            if($row[0]->CS_PicMode==1){  //采集图片
               $PicArr=$this->CsdjAdmin->getArr(trim($row[0]->CS_Picks),trim($row[0]->CS_Picjs),$Liststr);//获取到图片地址 返回数组
               $CS_Pic=$PicArr[$CjCount];
            }
            if(!empty($CS_Pic) && substr($CS_Pic,0,7)!='http://') $CS_Pic=$row[0]->CS_Url.$CS_Pic;

            $pagejs=$row[0]->CS_Jsid-$row[0]->CS_Ksid;
            $LinkCount=count($dLinkArr);//连接总数

             if($page>($pagejs+1)){ //采集完毕
                   echo "<script>setTimeout('ReadGo();',3000);function ReadGo(){window.location='".site_url('admin/caiji/')."'}</script>";
                   exit("<br><br><font style=\"color:#0000ff\">&nbsp;&nbsp;&nbsp;&nbsp;恭喜您，所有记录采集完毕...！</font>");
             }

              echo " <LINK href=\"".base_url()."csdj/admin/images/admin.css\" type=\"text/css\" rel=\"stylesheet\"><table align=\"center\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\" bordercolor=\"#C4DFF4\" width=\"950\" style=\"border-collapse:collapse;\">
        	     <tr><td class=\"title\" height=\"30\" colspan=\"2\" align=\"left\" class=\"td_title\">&nbsp;&nbsp;正在采集 <font color=#0000ff>".$row[0]->CS_Name."</font> 第<font color=red>".$page."</font>页列表,共<font color=red>".($pagejs+1)."</font>页,当前页共<font color=red>".$LinkCount."</font>条数据,已经采集<font color=red>".($CjCount+1)."</font>条 — <a href=\"".site_url('admin/caiji/')."\">紧急停止</a></td>
                     </tr> ";
                    if(substr($dLinkArr[$CjCount],0,7)!='http://') $dLinkArr[$CjCount]=$row[0]->CS_Url.$dLinkArr[$CjCount];
                    $cjsdata['CS_Url']=$dLinkArr[$CjCount];
                    $DanceContent=$this->CsdjAdmin->HtmlAll($dLinkArr[$CjCount],$row[0]->CS_Code);//读取内容文件
                    if(empty($DanceContent)) {
                          $cjsdata['CS_ZID']=1;
                          echo " <tr><td class=\"title\" height=\"30\" colspan=\"2\">获取内容页".$dLinkArr[$CjCount]."出错，没有获取到内容，采集失败！</td></tr>";
                          
                    }else{

	                  $CS_Name = $this->CsdjAdmin->str_substr(trim($row[0]->CS_Nameks),trim($row[0]->CS_Namejs),$DanceContent);  //名称
	                  $CS_Neir = $this->CsdjAdmin->str_substr(trim($row[0]->CS_Lrcks),trim($row[0]->CS_Lrcjs),$DanceContent);  //内容

                          $CS_Diqu=$row[0]->CS_Diquks;
                          $CS_Yuyan=$row[0]->CS_Yuyanks;
                          $CS_Tags=$row[0]->CS_Tagsks;
                          $CS_Daoy=$row[0]->CS_Daoyks;
                          $CS_Laiyuan=$row[0]->CS_Laiyuanks;
                          $CS_Zuoz=$row[0]->CS_Zuozks;
                          $CS_Year=$row[0]->CS_Yearks;

                          if($row[0]->CS_LaiyuanMode==1){
                                       $CS_Laiyuan= $this->CsdjAdmin->str_substr(trim($row[0]->CS_Laiyuanks),trim($row[0]->CS_Laiyuanjs),$DanceContent);
                          }
                          if($row[0]->CS_TagsMode==1){
                                  $CS_Tags= $this->CsdjAdmin->str_substr(trim($row[0]->CS_Tagsks),trim($row[0]->CS_Tagsjs),$DanceContent);
                          }elseif($row[0]->CS_TagsMode==0){
                                  $CS_Tags= $CS_Name;
                          }
                          if($row[0]->CS_SID==1){  //歌曲
                               $CS_Singer= $this->CsdjAdmin->str_substr(trim($row[0]->CS_Singerks),trim($row[0]->CS_Singerjs),$DanceContent);
                          }elseif($row[0]->CS_SID==3){  //视频
                                 if($row[0]->CS_YearMode==1){
                                       $CS_Year= $this->CsdjAdmin->str_substr(trim($row[0]->CS_Yearks),trim($row[0]->CS_Yearjs),$DanceContent,2);
                                 }
                                 if($row[0]->CS_YuyanMode==1){
                                       $CS_Yuyan= $this->CsdjAdmin->str_substr(trim($row[0]->CS_Yuyanks),trim($row[0]->CS_Yuyanjs),$DanceContent,2);
                                 }         
                                 if($row[0]->CS_DaoyMode==1){
                                       $CS_Daoy= $this->CsdjAdmin->str_substr(trim($row[0]->CS_Daoyks),trim($row[0]->CS_Daoyjs),$DanceContent,2);
                                 }
                                 if($row[0]->CS_ZuozMode==1){
                                       $CS_Zuoz= $this->CsdjAdmin->str_substr(trim($row[0]->CS_Zuozks),trim($row[0]->CS_Zuozjs),$DanceContent,2);
                                 }
                                 $CS_Laiyuan=$row[0]->CS_Laiy;

                          }
                          if($row[0]->CS_PlayMode==1){ //绝对地址
                                 $PHtml= $this->CsdjAdmin->str_substr(trim($row[0]->CS_Playks),trim($row[0]->CS_Playjs),$DanceContent);
                                 $plink=$this->CsdjAdmin->getArr(trim($row[0]->CS_Playlinkks),trim($row[0]->CS_Playlinkjs),$PHtml);
                                 $CS_Dance="";
                                 if($plink){
 	                             foreach ($plink as $rowp) { 
                                          $CS_Playlink=$this->CsdjAdmin->HtmlAll($rowp,$row[0]->CS_Code);
                                          $CS_Dance.=$this->CsdjAdmin->str_substr(trim($row[0]->CS_Danceks),trim($row[0]->CS_Dancejs),$CS_Playlink,2)."$$$";
 	                             }
                                     $CS_Dance.="]]]";
                                     $CS_Dance=str_replace('$$$]]]','',$CS_Dance);
                                     $CS_Dance=str_replace("$$$","\r\n",$CS_Dance);
                                 }
                          }else{
                               if($row[0]->CS_SID==3){
                                   if($row[0]->CS_PlayMode>0){
                                         $PHtml= $this->CsdjAdmin->str_substr(trim($row[0]->CS_Playks),trim($row[0]->CS_Playjs),$DanceContent);
                                         $CS_Dance=$this->CsdjAdmin->getArr(trim($row[0]->CS_Danceks),trim($row[0]->CS_Dancejs),$PHtml,2);
                                   }else{
                                         $CS_Dance=$this->CsdjAdmin->str_substr(trim($row[0]->CS_Danceks),trim($row[0]->CS_Dancejs),$DanceContent);
                                   }
                               }else{
                                      $CS_Dance= $this->CsdjAdmin->str_substr(trim($row[0]->CS_Danceks),trim($row[0]->CS_Dancejs),$DanceContent);
                               }
                          }
                          if($row[0]->CS_PicMode==2){
                             $CS_Pic = $this->CsdjAdmin->str_substr(trim($row[0]->CS_Picks),trim($row[0]->CS_Picjs),$DanceContent);
                          }
                          //替换名称
                          if(!empty($row[0]->CS_LrcTh)){
                                 $CS_Name= $this->CsdjAdmin->collectRep($CS_Name,$row[0]->CS_LrcTh);
                          }
                          //替换内容
                          if(!empty($row[0]->CS_LrcTh)){
                                 $CS_Neir= $this->CsdjAdmin->collectRep($CS_Neir,$row[0]->CS_LrcTh);
                          }
                          //替换地址
                          if(!empty($row[0]->CS_DanceTh)){
                                 $CS_Dance= $this->CsdjAdmin->collectRep($CS_Dance,$row[0]->CS_DanceTh);
                          }

                          if($CS_Daoy==0) $CS_Daoy="佚名";
                          if($CS_Yuyan==0) $CS_Yuyan="未知";
                          if($CS_Diqu==0) $CS_Diqu="未知";
                          if($CS_Year==0) $CS_Year="未知";
                          if($CS_Laiyuan=='0') $CS_Laiyuan="未知";
                          $CS_Name=str_replace("'","",$CS_Name);

                          $cjsdata['CS_ZID']=0;
                          if($row[0]->CS_SID==2){  //文章
                                    $cjsdata['CS_SID']=2;
                                    if(empty($CS_Neir) || empty($CS_Name)){
                                        $cjsdata['CS_ZID']=1;
                                        echo " <tr><td colspan=\"2\"><b style=\"color:red\">&nbsp;&nbsp;".$dLinkArr[$CjCount]."没有获取到“标题”或者“内容”，采集失败！</b></td></tr>";
                                    }else{
                                        
	                                echo "
                                         <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">文章标题：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Name</td>
                                        </tr>
                                        <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">图片地址：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Pic</td>
                                        </tr>
                                        <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">文章来源：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Laiyuan</td>
                                        </tr>
                                        <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">关键词：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Tags</td>
                                        </tr>
                                         <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">文章内容：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Neir</td>
                                        </tr>
                                        ";
                                    }

                          }elseif($row[0]->CS_SID==1){  //歌曲
                                    $cjsdata['CS_SID']=1;
                                    if(empty($CS_Dance) || empty($CS_Name)){
                                        $cjsdata['CS_ZID']=1;
                                        echo "<tr><td colspan=\"2\"><b style=\"color:red\">&nbsp;&nbsp;".$dLinkArr[$CjCount]."没有获取到歌曲名称或者歌曲地址，采集失败！</b></td></tr>";
                                    }else{
                                        
	                                echo "
                                        <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">歌曲名称：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Name</td>
                                        </tr>
                                        <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">图片地址：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Pic</td>
                                        </tr>
                                        <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">所属歌手：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Singer</td>
                                        </tr>
                                        <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">关键词：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Tags</td>
                                        </tr>
                                        <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">歌曲地址：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Dance</td>
                                        </tr>
                                         <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">歌词/介绍：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Neir</td>
                                        </tr>
                                        ";
                                    }
                          }elseif($row[0]->CS_SID==3){  //视频
                                    $cjsdata['CS_SID']=3;
                                    if(empty($CS_Dance) || empty($CS_Name)){
                                        $cjsdata['CS_ZID']=1;
                                        echo "<tr><td colspan=\"2\"><b style=\"color:red\">&nbsp;&nbsp;".$dLinkArr[$CjCount]."没有获取到视频名称或者视频地址，采集失败！</b></td></tr>";
                                    }else{
                                        
	                                echo "
                                        <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">视频名称：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Name</td>
                                        </tr>
                                        <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">图片地址：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Pic</td>
                                        </tr>
                                        <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">视频来源：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Laiyuan</td>
                                        </tr>
                                        <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">视频演员：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Zuoz</td>
                                        </tr>
                                        <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">视频导演：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Daoy</td>
                                        </tr>
                                        <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">视频语言：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Yuyan</td>
                                        </tr>
                                        <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">视频地区：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Diqu</td>
                                        </tr>
                                        <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">发行年份：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Year</td>
                                        </tr>
                                        <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">关键词：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Tags</td>
                                        </tr>
                                        <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">视频地址：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Dance</td>
                                        </tr>
                                         <tr>
                                           <td width=\"10%\" height=\"30\" align=\"right\">视频介绍：</td>
                                           <td width=\"90%\" height=\"30\" align=\"left\" style=\"padding-left:10px;\">$CS_Neir</td>
                                        </tr>
                                        ";
                                    }
                          }

                   if($ac=='ceshi'){ //测试不入库
                          $title="测试采集，不入库~！";
                   }else{

                          //写入采集记录
                          $cjsdata['CS_Name']=$CS_Name;
                          $cjsdata['CS_Names']=$row[0]->CS_Name;
                          $cjsdata['CS_CID']=$row[0]->CS_CID;
                          $this->CsdjDB->get_insert('cjlist',$cjsdata);


                          if($row[0]->CS_SID==3){  //视频
                                 $dance="";
                                 $arr=explode("\r\n",$CS_Dance);
                                 for($j=0;$j<count($arr);$j++){
                                       if(($j+1)<10){
                                           $jj="0".($j+1);
                                       }else{
                                           $jj=$j+1;
                                       }
                                       $dance.="第".$jj."集$".$arr[$j]."$".$row[0]->CS_Laiy."###";
                                 }
                                 $dance.="]]]";
                                 $dance=str_replace('###]]]','',$dance);
                                 $CS_Dance=str_replace("###","\r\n",$dance);
                          }

                          //---------------------------入库---------------------------------------
                          $data['CS_Name']=$CS_Name;
                          $data['CS_CID']=$row[0]->CS_CID;
                          $data['CS_User']=$row[0]->CS_User;
                          $data['CS_Content']=$CS_Neir;
                          $data['CS_Template']=$row[0]->CS_Template;
                          $data['CS_Tags']=$CS_Tags;
                          $data['CS_AddTime']=date('Y-m-d H:i:s');
                     
                          //------------------------判断保存图片----------------------------------
                          if($row[0]->CS_PicID==1 && $cjsdata['CS_ZID']==0){
                             $picname="";
                             if(!empty($CS_Pic)){
                                  $picdata = @file_get_contents($CS_Pic); // 读文件内容
                                  $picfolder ="./attachment/vod/";
                                  $picname=date('Ymd')."/".date('Ymd').time().mt_rand(1,100).".jpg";
                                  if(!empty($picdata)){
                                     write_file($picfolder.$picname, $picdata);
                                  }
                             }
                             $data['CS_Pic']=$picname;
                          }else{
                             $data['CS_Pic']=$CS_Pic;
                          }

                          if($row[0]->CS_SID==3){
                             $data['CS_FID']=$row[0]->CS_FID;
                             $data['CS_PlayUrl']=$CS_Dance;
                             $data['CS_Yany']=$CS_Zuoz;
                             $data['CS_Daoy']=$CS_Daoy;
                             $data['CS_Year']=$CS_Year;
                             $data['CS_Laiy']=$CS_Laiyuan;
                          }elseif($row[0]->CS_SID==1){
                             $data['CS_FID']=$row[0]->CS_FID;
                             $data['CS_PID']=$row[0]->CS_PID;
                             $data['CS_PlayUrl']=$CS_Dance;
							 if($row[0]->CS_RKID==0){
							       $data['CS_Yany']=trim($CS_Singer);
							 }else{
								   //判断歌手是否存在
								   if(!empty($CS_Singer)){
								         $rows=$this->db->query("SELECT CS_ID FROM ".CS_SqlPrefix."singer where CS_Name='".trim($CS_Singer)."'")->row();
								         if($rows){
							                    $data['CS_SingerID']=$rows->CS_ID;
								         }else{
									            $adds['CS_Name']=trim($CS_Singer);
									            $adds['CS_CID']=1;
									            $adds['CS_AddTime']=date('Y-m-d H:i:s');
										        $singerid=$this->CsdjDB->get_insert('singer',$adds);
							                    $data['CS_SingerID']=intval($singerid);
								         }
							             $data['CS_Singer']=trim($CS_Singer);
								   }
							 }
                          }

                          if($row[0]->CS_RKID==1){ //入未审核库
                                 $data['CS_YID']=1;
                                 //------------------判断数据是否存在------------------------
                                 if($row[0]->CS_SID==1){
                                 $data['CS_DownUrl1']=$CS_Dance;
                                         $sql="SELECT * FROM ".CS_SqlPrefix."dance where CS_Name='".$CS_Name."'";
	                                 $rows=$this->CsdjDB->get_all($sql); 
	                                 if($rows){
                                                if($row[0]->CS_CFID==0){  //不入库
                                                     $title="数据已经存在，不入库~！";
                                                }elseif($row[0]->CS_CFID==1){  //新增
                                                     $this->CsdjDB->get_insert('dance',$data);
                                                     $title="入库成功~！";
                                                }elseif($row[0]->CS_CFID==2){  //覆盖
                                                     $this->CsdjDB->get_update('dance',$rows[0]->CS_ID,$data);
                                                     $title="数据已存在，智能覆盖成功~！";
                                                }
	                                 }else{
                                                $this->CsdjDB->get_insert('dance',$data);
                                                $title="入库成功~！";
                                         }
                                 }elseif($row[0]->CS_SID==2){
                                         $data['CS_Laiyuan']=$CS_Laiy;
                                         $sql="SELECT * FROM ".CS_SqlPrefix."news where CS_Name='".$CS_Name."'";
	                                 $rows=$this->CsdjDB->get_all($sql); 
	                                     if($rows){
                                                if($row[0]->CS_CFID==0){  //不入库
                                                     $title="数据已经存在，不入库~！";
                                                }elseif($row[0]->CS_CFID==1){  //新增
                                                     $this->CsdjDB->get_insert('news',$data);
                                                     $title="入库成功~！";
                                                }elseif($row[0]->CS_CFID==2){  //覆盖
                                                     $this->CsdjDB->get_update('news',$rows[0]->CS_ID,$data);
                                                     $title="数据已存在，智能覆盖成功~！";
                                                }
	                                 }else{
                                                $this->CsdjDB->get_insert('news',$data);
                                                $title="入库成功~！";
                                         }
                                 }else{
                                         $data['CS_DownUrl']=$CS_Dance;
                                         $sql="SELECT * FROM ".CS_SqlPrefix."vod where CS_Name='".$CS_Name."'";
	                                 $rows=$this->CsdjDB->get_all($sql); 
	                                 if($rows){
                                                if($row[0]->CS_CFID==0){  //不入库
                                                     $title="数据已经存在，不入库~！";
                                                }elseif($row[0]->CS_CFID==1){  //新增
                                                     $this->CsdjDB->get_insert('vod',$data);
                                                     $title="入库成功~！";
                                                }elseif($row[0]->CS_CFID==2){  //覆盖
                                                     $this->CsdjDB->get_update('vod',$rows[0]->CS_ID,$data);
                                                     $title="数据已存在，智能覆盖成功~！";
                                                }
	                                 }else{
                                                $this->CsdjDB->get_insert('vod',$data);
                                                $title="入库成功~！";
                                         }
                                 }
                          }elseif($row[0]->CS_RKID==2 && Web_Mode==3){ //入未并生成

                                 //------------------判断数据是否存在------------------------
                                 if($row[0]->CS_SID==1){
                                         $data['CS_DownUrl1']=$CS_Dance;
                                         $sql="SELECT * FROM ".CS_SqlPrefix."dance where CS_Name='".$CS_Name."'";
	                                 $rows=$this->CsdjDB->get_all($sql); 
	                                 if($rows){
                                                if($row[0]->CS_CFID==0){  //不入库
                                                     $title="数据已经存在，不入库~！";
                                                }elseif($row[0]->CS_CFID==1){  //新增
                                                     $this->CsdjDB->get_insert('dance',$data);
                                                     $title="入库成功~！";
                                                }elseif($row[0]->CS_CFID==2){  //覆盖
                                                     $this->CsdjDB->get_update('dance',$rows[0]->CS_ID,$data);
                                                     $title="数据已存在，智能覆盖成功~！";
                                                }
	                                 }else{
                                                $this->CsdjDB->get_insert('dance',$data);
                                                $title="入库成功~！";
                                         }

                                         //---------------生成------------------------
                                         $sql="SELECT * FROM ".CS_SqlPrefix."dance where CS_Name='".$CS_Name."' and CS_PlayUrl='".$CS_Dance."'";
	                                 $rows=$this->CsdjDB->get_all($sql); 
	                                 if($rows){
                                               $htmllink=$this->CsdjSkins->LinkUrl('play','dance','id',1,$rows[0]->CS_ID,1,1);
                                               $htmllink="http://".Web_Url.Web_Path.substr($htmllink,1)."?cs=html";
                                               $neir=$this->CsdjAdmin->HtmlAll($htmllink);

                                               $html=".".$this->CsdjSkins->LinkUrl('play','dance','id',1,$rows[0]->CS_ID);
                                               $html=$this->CsdjAdmin->gethtmls($html); //补全HTML地址
                                               write_file($html, $neir);
                                         }
                                         //---------------生成END------------------------
                                 }elseif($row[0]->CS_SID==2){
                                         $sql="SELECT * FROM ".CS_SqlPrefix."news where CS_Name='".$CS_Name."'";
	                                 $rows=$this->CsdjDB->get_all($sql); 
	                                 if($rows){
                                                if($row[0]->CS_CFID==0){  //不入库
                                                     $title="数据已经存在，不入库~！";
                                                }elseif($row[0]->CS_CFID==1){  //新增
                                                     $this->CsdjDB->get_insert('news',$data);
                                                     $title="入库成功~！";
                                                }elseif($row[0]->CS_CFID==2){  //覆盖
                                                     $this->CsdjDB->get_update('news',$rows[0]->CS_ID,$data);
                                                     $title="数据已存在，智能覆盖成功~！";
                                                }
	                                 }else{
                                                $this->CsdjDB->get_insert('news',$data);
                                                $title="入库成功~！";
                                         }
                                         //---------------生成------------------------
                                         $sql="SELECT * FROM ".CS_SqlPrefix."news where CS_Name='".$CS_Name."'";
	                                 $rows=$this->CsdjDB->get_all($sql); 
	                                 if($rows){
                                               $htmllink=$this->CsdjSkins->LinkUrl('show','news','id',1,$rows[0]->CS_ID,1,1);
                                               $htmllink="http://".Web_Url.Web_Path.substr($htmllink,1)."?cs=html";
                                               $neir=$this->CsdjAdmin->HtmlAll($htmllink);

                                               $html=".".$this->CsdjSkins->LinkUrl('show','news','id',1,$rows[0]->CS_ID);
                                               $html=$this->CsdjAdmin->gethtmls($html); //补全HTML地址
                                               write_file($html, $neir);
                                         }
                                         //---------------生成END------------------------
                                 }else{
                                         $data['CS_DownUrl']=$CS_Dance;
                                         $sql="SELECT * FROM ".CS_SqlPrefix."vod where CS_Name='".$CS_Name."'";
	                                 $rows=$this->CsdjDB->get_all($sql); 
	                                 if($rows){
                                                if($row[0]->CS_CFID==0){  //不入库
                                                     $title="数据已经存在，不入库~！";
                                                }elseif($row[0]->CS_CFID==1){  //新增
                                                     $this->CsdjDB->get_insert('vod',$data);
                                                     $title="入库成功~！";
                                                }elseif($row[0]->CS_CFID==2){  //覆盖
                                                     $this->CsdjDB->get_update('vod',$rows[0]->CS_ID,$data);
                                                     $title="数据已存在，智能覆盖成功~！";
                                                }
	                                 }else{
                                                $this->CsdjDB->get_insert('vod',$data);
                                                $title="入库成功~！";
                                         }

                                         //---------------生成------------------------
                                         $sql="SELECT * FROM ".CS_SqlPrefix."vod where CS_Name='".$CS_Name."'";
	                                 $row=$this->CsdjDB->get_all($sql); 
	                                 if($rows){
                                               $htmllink=$this->CsdjSkins->LinkUrl('show','vod','id',1,$rows[0]->CS_ID,1,1);
                                               $htmllink="http://".Web_Url.Web_Path.substr($htmllink,1)."?cs=html";
                                               $neir=$this->CsdjAdmin->HtmlAll($htmllink);

                                               $html=".".$this->CsdjSkins->LinkUrl('show','vod','id',1,$rows[0]->CS_ID);
                                               $html=$this->CsdjAdmin->gethtmls($html); //补全HTML地址
                                               write_file($html, $neir);
                                         }
                                         //---------------生成END------------------------
                                 }
                          }else{ //入临时库
                               $data['CS_SID']=$row[0]->CS_SID;
                               $data['CS_DownUrl']=$CS_Dance;

                               //------------------判断数据是否存在------------------------
                               $sql="SELECT * FROM ".CS_SqlPrefix."cjdata where CS_Name='".$CS_Name."'";
	                       $rows=$this->CsdjDB->get_all($sql); 
	                       if($rows){
                                        if($row[0]->CS_CFID==0){  //不入库
                                             $title="数据已经存在，不入库~！";
                                        }elseif($row[0]->CS_CFID==1){  //新增
                                             $this->CsdjDB->get_insert('cjdata',$data);
                                             $title="入库成功~！";
                                        }elseif($row[0]->CS_CFID==2){  //覆盖
                                             $this->CsdjDB->get_update('cjdata',$rows[0]->CS_ID,$data);
                                             $title="数据已存在，智能覆盖成功~！";
                                        }
	                       }else{
                                        $this->CsdjDB->get_insert('cjdata',$data);
                                        $title="入库成功~！";
                               }
                          }
                          //修改采集时间
                          $cjdata['CS_AddTime']=date('Y-m-d H:i:s');
                          $this->CsdjDB->get_update('caiji',$id,$cjdata);
                   }


                          if($CjCount==$LinkCount-1){ //当前页采集完毕
                                    echo "<tr><td colspan=\"2\"><font style=\"color:#0000ff\">&nbsp;&nbsp;".$title.",暂停3秒继续...</font></td></tr></table>";
                                    die("<script>setTimeout('ReadGo();',1000);function ReadGo(){window.location='".site_url('admin/caiji/caijigo/'.$id.'/')."?ac=".$ac."&page=".($page+1)."&xid=".$xid."'}</script>");
                          }else{
                                    echo "<tr><td colspan=\"2\"><font style=\"color:#0000ff\">&nbsp;&nbsp;".$title.",暂停1秒继续...</font></td></tr></table>";
                                    die("<script>setTimeout('ReadGo();',0000);function ReadGo(){window.location='".site_url('admin/caiji/caijigo/'.$id.'/')."?ac=".$ac."&CjCount=".($CjCount+1)."&page=".$page."&xid=".$ids."'}</script>");
                          }
                    }
        }

	public function drsave()
	{
            $this->CsdjAdmin->Admin_Qx('36');
 	    $fs = $this->input->post('fs');
 	    $CS_Neir = $this->input->post('CS_Neir');
            if($fs=='2'){

               $config['upload_path'] = './attachment/other/'.date('Ymd').'/';
               $config['allowed_types'] = 'text';
	       !is_dir($config['upload_path']) && mkdir($config['upload_path'], 0755, true);  //创建目录
               $config['encrypt_name'] = TRUE;  //重命名

               $this->load->library('upload', $config);
                       if ( ! $this->upload->do_upload()){
                            $error = array('error' => $this->upload->display_errors());
                            exit($error['error']);
                       } else {
                            if(!file_exists($config['upload_path'].'index.html')){
	                          @file_put_contents($config['upload_path'].'index.html','cscms');
                            }
                            $data = $this->upload->data();
                            $Filename=$data['full_path'];
                            $CS_Neir=@file_get_contents($Filename);
                       }
            }

            if(empty($CS_Neir)) $this->CsdjAdmin->Admin_Url('<font color=red>内容不能为空！</font>',site_url('admin/caiji/daoru/'));

	    $regArr=explode("\n",$CS_Neir);
	    for($i=0;$i<count($regArr);$i++){
                $ziduan=$this->CsdjAdmin->str_substr('<CSCMS_','>',$regArr[$i]);
                $neir=$this->CsdjAdmin->str_substr("<CSCMS_".$ziduan.">","</CSCMS_".$ziduan.">",$regArr[$i]);
                if(!empty($ziduan)){
                      $data2[$ziduan]=$neir;
                }
            }
            $this->CsdjDB->get_insert('caiji',$data2);
            $this->CsdjAdmin->Admin_Url('<font color=#0000ff>恭喜您，导入成功！</font>',site_url('admin/caiji/'),'ok');
        }
}

