|
@@ -6,6 +6,7 @@ use catcher\base\CatchRequest as Request;
|
|
|
use catcher\CatchResponse;
|
|
|
use catcher\base\CatchController;
|
|
|
use catchAdmin\device\model\Station as stationModel;
|
|
|
+use catchAdmin\device\model\RfRecord as rfRecordModel;
|
|
|
use catchAdmin\device\model\StationPhoto;
|
|
|
use catcher\Utils;
|
|
|
use catcher\library\excel\Excel;
|
|
@@ -16,10 +17,12 @@ use PDO;
|
|
|
class Station extends CatchController
|
|
|
{
|
|
|
protected $stationModel;
|
|
|
+ protected $rfRecordModel;
|
|
|
|
|
|
- public function __construct(StationModel $stationModel)
|
|
|
+ public function __construct(StationModel $stationModel,rfRecordModel $rfRecordModel)
|
|
|
{
|
|
|
$this->stationModel = $stationModel;
|
|
|
+ $this->rfRecordModel = $rfRecordModel;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -29,54 +32,65 @@ class Station extends CatchController
|
|
|
*/
|
|
|
public function index(Request $request)
|
|
|
{
|
|
|
- // header('Content-Type: text/html; charset=utf-8');
|
|
|
- // header('Content-Type: text/html; charset=gb2312');
|
|
|
- $param=$request->param();
|
|
|
- // var_dump($param);
|
|
|
- $cond=[];
|
|
|
- if($param['shortcode']){
|
|
|
- $cond['DEVICE_CODE']=['like',$param['shortcode']];
|
|
|
- }
|
|
|
- if($param['name']){
|
|
|
- $param['name'] = mb_convert_encoding($param['name'], 'GBK','UTF-8');
|
|
|
- $cond['DEVICE_NAME']=['like',$param['name']];
|
|
|
- }
|
|
|
- $count=queryOracleCount('DSSC2.ADM_DEV',$cond);
|
|
|
+ $field = $request->get('field')?:'id';
|
|
|
+ $order = $request->get('order')?:'desc';
|
|
|
+ $where=[];
|
|
|
+ $param=$request->param();
|
|
|
+ if($param['shortcode']){
|
|
|
+ $where[]=['a.DEVICE_CODE','like','%'.$param['shortcode'].'%'];
|
|
|
+ }
|
|
|
+ if($param['name']){
|
|
|
+ $where[]=['a.DEVICE_NAME','like','%'.$param['name'].'%'];
|
|
|
+ }
|
|
|
+
|
|
|
+ return CatchResponse::paginate($this->stationModel->getStationList($field,$order,$where));
|
|
|
+ // $param=$request->param();
|
|
|
+ // // var_dump($param);
|
|
|
+ // $cond=[];
|
|
|
+ // if($param['shortcode']){
|
|
|
+ // $cond['DEVICE_CODE']=['like',$param['shortcode']];
|
|
|
+ // }
|
|
|
+ // if($param['name']){
|
|
|
+ // $param['name'] = mb_convert_encoding($param['name'], 'GBK','UTF-8');
|
|
|
+ // $cond['DEVICE_NAME']=['like',$param['name']];
|
|
|
+ // }
|
|
|
+ // $count=queryOracleCount('DSSC2.ADM_DEV',$cond);
|
|
|
|
|
|
- $cond['page']=isset($param['page'])?$param['page']:1;
|
|
|
- $cond['limit']=isset($param['limit'])?$param['limit']:10;
|
|
|
- $rows=queryOracleSelect('DSSC2.ADM_DEV',$cond,'a.ID,a.IS_ONLINE,a.LOGIN_NAME,a.DEVICE_CODE,a.DEVICE_NAME,a.OWNER_CODE,a.DEVICE_IP,a.DEVICE_PORT,to_char(a.UPDATE_DATE,\'yyyy-mm-dd hh24:mi:ss\') UPDATE_DATE');
|
|
|
+ // $cond['page']=isset($param['page'])?$param['page']:1;
|
|
|
+ // $cond['limit']=isset($param['limit'])?$param['limit']:10;
|
|
|
+ // $rows=queryOracleSelect('DSSC2.ADM_DEV',$cond,'a.ID,a.IS_ONLINE,a.LOGIN_NAME,a.DEVICE_CODE,a.DEVICE_NAME,a.OWNER_CODE,a.DEVICE_IP,a.DEVICE_PORT,to_char(a.UPDATE_DATE,\'yyyy-mm-dd hh24:mi:ss\') UPDATE_DATE');
|
|
|
|
|
|
|
|
|
- foreach($rows as &$val){
|
|
|
- $val['DEVICE_NAME'] = mb_convert_encoding($val['DEVICE_NAME'], 'UTF-8', 'GBK');
|
|
|
- $val['IS_ONLINE_TEXT']=$val['IS_ONLINE']?'在线':'离线';
|
|
|
- // $val['UPDATE_DATE'] = mb_convert_encoding($val['UPDATE_DATE'], 'UTF-8', 'GBK');
|
|
|
- // $val['CREATE_DATE'] = mb_convert_encoding($val['CREATE_DATE'], 'UTF-8', 'GBK');
|
|
|
- $findCond=[
|
|
|
- 'DEVICE_CODE'=>['=',$val['DEVICE_CODE']]
|
|
|
- ];
|
|
|
- $info=queryOracleFind('DSSC2.ADM_DEV_RFID_CHN',$findCond);
|
|
|
- $val['longitude']=$info['GPS_X'];
|
|
|
- $val['latitude']=$info['GPS_Y'];
|
|
|
+ // foreach($rows as &$val){
|
|
|
+ // $val['DEVICE_NAME'] = mb_convert_encoding($val['DEVICE_NAME'], 'UTF-8', 'GBK');
|
|
|
+ // $val['IS_ONLINE_TEXT']=$val['IS_ONLINE']?'在线':'离线';
|
|
|
+ // // $val['UPDATE_DATE'] = mb_convert_encoding($val['UPDATE_DATE'], 'UTF-8', 'GBK');
|
|
|
+ // // $val['CREATE_DATE'] = mb_convert_encoding($val['CREATE_DATE'], 'UTF-8', 'GBK');
|
|
|
+ // $findCond=[
|
|
|
+ // 'DEVICE_CODE'=>['=',$val['DEVICE_CODE']]
|
|
|
+ // ];
|
|
|
+ // $info=queryOracleFind('DSSC2.ADM_DEV_RFID_CHN',$findCond);
|
|
|
+ // $val['longitude']=$info['GPS_X'];
|
|
|
+ // $val['latitude']=$info['GPS_Y'];
|
|
|
|
|
|
- }
|
|
|
+ // }
|
|
|
|
|
|
- $response=[
|
|
|
- 'code'=>10000,
|
|
|
- 'message'=>'查询成功',
|
|
|
- 'count'=>$count,
|
|
|
- 'data'=>$rows,
|
|
|
- 'current'=>isset($param['page'])?(int)$param['page']:1,
|
|
|
- 'limit'=>isset($param['limit'])?(int)$param['limit']:10,
|
|
|
- ];
|
|
|
- return $response;
|
|
|
- // $field = $request->get('field')?:'id';
|
|
|
- // $order = $request->get('order')?:'desc';
|
|
|
- // return CatchResponse::paginate($this->stationModel->getStationList($field,$order));
|
|
|
+ // $response=[
|
|
|
+ // 'code'=>10000,
|
|
|
+ // 'message'=>'查询成功',
|
|
|
+ // 'count'=>$count,
|
|
|
+ // 'data'=>$rows,
|
|
|
+ // 'current'=>isset($param['page'])?(int)$param['page']:1,
|
|
|
+ // 'limit'=>isset($param['limit'])?(int)$param['limit']:10,
|
|
|
+ // ];
|
|
|
+ // return $response;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public function getdeviceListByStation(Request $request){
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
$params=$request->param();
|
|
|
if(!$params['station_code']){
|
|
|
return CatchResponse::success('');
|
|
@@ -98,9 +112,6 @@ class Station extends CatchController
|
|
|
$cond['page']=isset($param['page'])?$param['page']:1;
|
|
|
$cond['limit']=isset($param['limit'])?$param['limit']:10;
|
|
|
$rows=queryOracleSelect('DSSC2.W_DW_RF_RECORD',$cond,'a.RF_FLAGID,a.RF_STAT,to_char(a.RF_DATE,\'yyyy-mm-dd hh24:mi:ss\') RF_DATE');
|
|
|
- foreach($rows as &$val){
|
|
|
- $val['RF_DATE'] = mb_convert_encoding($val['RF_DATE'], 'UTF-8', 'GBK');
|
|
|
- }
|
|
|
$response=[
|
|
|
'code'=>10000,
|
|
|
'message'=>'查询成功',
|
|
@@ -110,6 +121,27 @@ class Station extends CatchController
|
|
|
'limit'=>isset($params['limit'])?(int)$params['limit']:10,
|
|
|
];
|
|
|
return $response;
|
|
|
+
|
|
|
+
|
|
|
+ // $cond=[];
|
|
|
+ // $params=$request->param();
|
|
|
+ // if(!$params['station_code']){
|
|
|
+ // return CatchResponse::success('');
|
|
|
+ // }
|
|
|
+ // if($params['station_code']){
|
|
|
+ // $cond[]=['RF_ID','=',$params['station_code']];
|
|
|
+ // }
|
|
|
+ // $start_time = date('Y-m-d 00:00:00',time());
|
|
|
+ // $end_time = date('Y-m-d 23:59:59',time());
|
|
|
+
|
|
|
+ // if(isset($params['timeRange']) && $params['timeRange'] != ''){
|
|
|
+ // $start_time=date('Y-m-d H:i:s',strtotime($params['timeRange'][0]));
|
|
|
+ // $end_time=date('Y-m-d H:i:s',strtotime($params['timeRange'][1]));
|
|
|
+ // $cond[]=['RF_DATE','between',[$start_time,$end_time]];
|
|
|
+ // }
|
|
|
+ // $list=$this->rfRecordModel->getList($cond);
|
|
|
+
|
|
|
+ // return CatchResponse::paginate($list);
|
|
|
|
|
|
}
|
|
|
/**
|