<?php
namespace app\index\controller;
use think\facade\View;
use think\facade\Request;
use think\facade\Db;

class Data extends Base{
	
    public function index(){
		exit;
		$m1['arctype_id']=4;
		$m1['is_delete']=0;
		$list =Db::name('jc_archives')->where($m1)->order('sort asc')->select()->toArray();
		
		foreach($list as $k=>$c){
			$kz[$k]=Db::name('jc_archives_article')->where('archives_id',$c['id'])->find();
			$list[$k]['content']=htmlspecialchars_decode($kz[$k]['content']);
			$list[$k]['jianjie']=$kz[$k]['jianjie'];
			$list[$k]['stp']=$kz[$k]['stp'];
		}

		//dump($list);exit;

		
		foreach($list as $k=>$c){
			
			$data['pid']=26;
			$data['title']=$c['title'];
			$data['pic']=$c['pic'];
			$data['article_time']=$c['pubdate'];
			$data['is_effect']=1;
			$data['is_delete']=1;
			$data['create_time']=$c['time'];
			$data['sort']=$k+1;
			$data['admin_id']=1;
			$data['number']=0;
			$data['end_time']=0;
			
			$id=Db::name('article')->insertGetId($data);
			
			$data1['aid']=$id;
			$data1['jianjie']=$c['jianjie'];
			$data1['content']=$c['content'];
			$pid=Db::name('article_article')->insertGetId($data1);
		}
		dump($list);
		//exit;
		
		
		return View::fetch();
    }

}