<?php

namespace app\admin\controller;
use think\Controller;
use think\Db;
class Paramindexset extends Common
{
public function index()
{
return $this->fetch();
}
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=input('id');
$data1 = Db::table('vw_sb')->where('id',$id)->find();
echo $data1['mtid'];
}
public function config(){
$data = Db::query("SELECT * from modev where modevtid=5 and iedid = 3 ");
$num = 1;
for($i = 0;$i<count($data);$i++){
if($i==41||$i==83){
Db::query("update rptparamindex set tablename = 'data_etp_h', colname = 't2', eqmid = '".$data[$i]['id']."' where paramindex = 'ZXJC100LDZHJC/STMP".$num."\$"."MX"."\$"."Tmp"."\$"."mag"."\$"."f'");
$num = $num+1;
}else{
for($j = 0;$j<3;$j++){
Db::query("update rptparamindex set tablename = 'data_etp_h', colname = 't".($j+1)."', eqmid = '".$data[$i]['id']."' where paramindex = 'ZXJC100LDZHJC/STMP".$num."\$"."MX"."\$"."Tmp"."\$"."mag"."\$"."f'");
$num = $num+1;
}
}
}
}
}
?>