<?php

namespace app\index\controller;
use app\index\controller\Base;
use think\Db;
class Tree extends Base
{
public function index()
{
$edate=date("Y-m-d");
$sdate=date('Y-m-d',strtotime("$edate -1 month"));
$this->assign('sdate',$sdate);
$this->assign('edate',$edate);
return $this->fetch();
}
public function tabs()
{
return $this->fetch('tabs');
}
public function get_ajax(){
$data = Db::query("SELECT DISTINCT concat('b',bdzid) id,bmc name,0 as pId from vw_sb
UNION DISTINCT SELECT concat('j',jgid) id,jmc name,concat('b',bdzid) pId from vw_sb
UNION DISTINCT SELECT concat('z',zid) id,zmc name,concat('j',jgid) pId from vw_sb
UNION DISTINCT SELECT concat('m',id) id,name,concat('z',zid) pId from vw_sb");
echo  json_encode($data);
}
public function ajax($id){
$data = Db::table('vw_sb')->where('id',$id)->find();
echo $data['mtid'];
}
}
?>