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

class Ajax extends Base{
	
    public function article(){
		$list=\app\index\model\Ajax::article();
		$data =['type' =>1,'list' =>$list];
		return json($data);
    }

    public function article_teshu(){
		$list=\app\index\model\Ajax::article_teshu();
		$data =['type' =>1,'list' =>$list];
		return json($data);
    }

    public function label(){
		$tdata=Request::param();
		$field=$tdata['field'];
		$pid=$tdata['pid'];

		$map[] = ['field','=',$field];
		if(strlen($pid)==0){
		$map[] = ['pid','<>',0];
		}else{
		$map[] = ['pid','=',$pid];
		}
		$map[] = ['is_effect','=',1];

		$list=\app\common\model\Label::where($map)->order('sort asc')->select();
		$data =['type' =>1,'list' =>$list];
		return json($data);
    }

}
