<?php
namespace app\admin\controller;
use think\Controller;
use think\Db;
class Wtree extends Common
{

    public function index()
    {
        return $this->fetch('wtree');
    }

    public function table1(){
        $date=Db::query("select paramindex from rptparamindex");
        $this->assign('date',$date);
        return $this->fetch('table1');
    }
    public function tabs()
    {
        return $this->fetch('tabs');
    }
    public function get_ajax(){
        $data = Db::query("SELECT DISTINCT 'b'||bdzid id,bmc name,0 as pId from vw_sb UNION SELECT DISTINCT 'j'||jgid id,jmc name,'b'||bdzid pId from vw_sb UNION SELECT DISTINCT 'z'||zid id,zmc name,'j'||jgid pId from vw_sb UNION SELECT DISTINCT 'm'||id id,name,'z'||zid pId from vw_sb");
        echo  json_encode($data);
    }
    public function ajax($id){
         $data1 = Db::table('vw_sb')->where('id',$id)->find();
        echo $data1['mtid'];
    }

}
