123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <?php
- /**
- * Created by PhpStorm.
- * User: TianFeng
- * Date: 2019-03-20
- * Time: 12:37
- */
- namespace Home\Controller;
- use Think\Controller;
- include '../Common/function.php';
- include '/var/www/html/jdxf/Public/vendor/WxJDK/JSSDK.php';
- class MaintenanceController extends ComController{
- public function index(){
- // print_r($_SESSION['phone']);
- $data=I();
- // print_r($data);
- $sql="select * from ytiot_t_maintenance_person where phone='".$data['phone']."'";//.$_SESSION['phone'];//17621295894";
- $res=add66($sql);
- // print_r($res);
- if($res!=null){
- // print_r($sql);
- // exit();
- $a='';
- $a1='';
- foreach ($res as $key=>$value){
- $a.="'".$value['company_code']."',";
- $a1.="'".$value['id']."',";
- }
- $b=rtrim($a, ',');
- $b1=rtrim($a1, ',');
- // print_r($b);
- $time=date("Y-m-d");
- $sql1="select * from ytiot_t_maintenance_plan where personnel in(".$b1.") and planned_date='".$time."'";//and compamy_code in(".$b.")"
- $res1=add66($sql1);
- // print_r($res1);exit();
- $lx1='';
- foreach ($res1 as $key=>$value){
- $sql2="select * from ytiot_t_route2 where id=".$value['route'];
- $res2=add($sql2);
- // print_r($res2);
- $lx=$res2[0]['route'];
- $res1[$key]['route_name']=$res2[0]['route_name'];
- $lx1=explode(",",$lx);
- // print_r(count(explode(",",$lx)));
- for ($i=0; $i<count(explode(",",$lx)); $i++){
- // print_r('测试1:'.$lx1[$i]);
- $sql4="select * from ytiot_t_maintenance where id=".$lx1[$i];
- $res4=add($sql4);
- $sql3="select * from ytiot_t_maintenance_record where point_position=".$res4[0]['id']." and personnel=".$value['personnel']." and inspection_time like '".$time."%' and route=".$res2[0]['id']." and company_code=".$value['company_code'];
- $res3=add($sql3);
- // print_r($res4);
- $res5[$key]['dw'][$i]['xj_name']=$res4[0]['xj_name'];
- $res5[$key]['dw'][$i]['address']=$res4[0]['address'];
- $res5[$key]['dw'][$i]['label']=$res4[0]['label'];
- $res5[$key]['dw'][$i]['xjd_id']=$res4[0]['id'];
- $res5[$key]['route_name']=$res1[$key]['route_name'];
- $res5[$key]['id']=$res1[$key]['id'];
- $res5[$key]['completion_status']=round($res1[$key]['completion_status']);
- $res5[$key]['company']=$res1[$key]['company_code'];
- if(empty($res3)){
- $res5[$key]['dw'][$i]['pd']=0;
- }else{
- $res5[$key]['dw'][$i]['pd']=1;
- }
- }
- }
- //微信扫一扫
- # 引入
- // Vendor('WxJDK.JSSDK');
- # 公众号获取
- $appid = C('APPID');
- # 公众号获取
- $appSecret = C('SECRET');
- # 实例化
- $wx = new \JSSDK($appid,$appSecret);
- # 获取参数
- $info = $wx-> getWxConfig();
- # 传参页面
- $this -> assign('wxConfig',$info);
- // dump($res5,'1','<pre></pre>','0');
- // print_r($res5);
- // print_r($res5);
- // echo $data['companyid'];
- // print_t($data);
- // $this->assign('company',$data['companyid']);
- $this->assign('res5',$res5);
- //
- $this->display('Index/maintenance_system');
- }else{
- // $res5=array();
- // $this->assign('res5',$res5);
- //
- $this->display('Index/maintenance_system');
- }
- }
- }
|