...
|
...
|
@@ -2016,7 +2016,7 @@ class CommonController extends RestBaseController |
|
|
//年检检测
|
|
|
$where = ['project_id'=>$res['project_id'],'test_id'=>$res['id']];
|
|
|
$field = 'id,status,uid,spot_id,images,create_time';
|
|
|
$arr['years'] = $this->getInspectList($where,$field,$res['project_id'],'years',$res['create_time']);
|
|
|
$arr['years'] = $this->getTestYearsList($where,$field,$res['project_id'],'years',$res['create_time']);
|
|
|
|
|
|
//检测时间
|
|
|
$arr['test_time'] = $res['test_time'];
|
...
|
...
|
@@ -2067,13 +2067,68 @@ class CommonController extends RestBaseController |
|
|
return $res;
|
|
|
}
|
|
|
|
|
|
//获取日期时间戳
|
|
|
public function getDate($time){
|
|
|
$dateStr = date('Y-m-d',$time);
|
|
|
//获取0点的时间戳
|
|
|
$time1 = strtotime($dateStr);
|
|
|
//获取24点的时间戳
|
|
|
$time2 = strtotime($dateStr) + 86400;
|
|
|
$arr = [$time1,$time2];
|
|
|
return $arr;
|
|
|
}
|
|
|
|
|
|
//获取巡检列表
|
|
|
public function getInspectList($where,$field,$project_id,$table,$ins_time){
|
|
|
$time = date('Y-m-d',$ins_time);
|
|
|
$time1 = date('Y-m-d',$ins_time+86400);
|
|
|
$time = $this->getDate($ins_time);
|
|
|
$res = Db::name($table)
|
|
|
->where($where)
|
|
|
->whereTime('create_time', $time)
|
|
|
->field($field)
|
|
|
->select()
|
|
|
->toArray();
|
|
|
$arr1 = [];
|
|
|
foreach($res as &$value){
|
|
|
$value['create_time'] = date('Y/m/d',$value['create_time']);
|
|
|
}
|
|
|
//获取巡检点列表
|
|
|
$point_list = $this->getPoint(['p_id'=>$project_id],'id,point_name');
|
|
|
foreach($res as $k=>$value2) {
|
|
|
$arr1[$k]['point_id'] = $value2['point_id'];
|
|
|
//状态
|
|
|
$arr1[$k]['status'] = $value2['status'];
|
|
|
//巡检人
|
|
|
$user = $this->getUserById(['id' => $value2['uid']]);
|
|
|
if ($user) {
|
|
|
$arr1[$k]['user_login'] = $user['user_login'];
|
|
|
} else {
|
|
|
$arr1[$k]['user_login'] = '';
|
|
|
}
|
|
|
//图片
|
|
|
$arr1[$k]['images'] = $this->absolutionUrl($value2['images']);
|
|
|
}
|
|
|
foreach ($point_list as &$list_value){
|
|
|
$list_value['status'] = 2;
|
|
|
$list_value['user_login'] = '';
|
|
|
$list_value['images'] = [];
|
|
|
foreach($arr1 as $key1=>$value1){
|
|
|
//日检
|
|
|
if($value1['point_id'] == $list_value['id']){
|
|
|
$list_value['status'] = $value1['status'];
|
|
|
$list_value['user_login'] = $value1['user_login'];
|
|
|
$list_value['images'] = $value1['images'];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return $point_list;
|
|
|
}
|
|
|
|
|
|
//获取年检列表
|
|
|
public function getTestYearsList($where,$field,$project_id,$table,$ins_time){
|
|
|
$time = $this->getDate($ins_time);
|
|
|
$res = Db::name($table)
|
|
|
->where($where)
|
|
|
->whereTime('create_time', [$time,$time1])
|
|
|
->whereTime('create_time', $time)
|
|
|
->field($field)
|
|
|
->select()
|
|
|
->toArray();
|
...
|
...
|
@@ -2152,7 +2207,7 @@ class CommonController extends RestBaseController |
|
|
|
|
|
//巡检点状态
|
|
|
$arr1[$key1]['point'][$key]['status'] = 2;
|
|
|
// 巡检人
|
|
|
// 巡检人
|
|
|
$arr1[$key1]['point'][$key]['user_login'] = '';
|
|
|
//巡检图片
|
|
|
$arr1[$key1]['point'][$key]['images'] = [];
|
...
|
...
|
|