Browse Source

alarmMsg 相关

git 5 years ago
parent
commit
7595955812
2 changed files with 70 additions and 1 deletions
  1. 31 0
      Home/Common/pub_func.php
  2. 39 1
      Home/Lib/Action/NoticeAction.class.php

+ 31 - 0
Home/Common/pub_func.php

@@ -28,12 +28,43 @@
 	
  
 	function mockProduce(  ){
+		/*
 		$msg_data = '{
 		  "type":9,
 		  "title":"群推消息",
 		  "content":"这是一个广播"
 		}';
 		kafkaProducer('gps_location_data',$msg_data);
+		
+		// jyzl gps
+		$msg_data = array(
+			'DeviceId' => FFFFFF123122,
+			'State' => 1,
+			'Speed' => 1.2,
+			'Longitude' => 121.20638,
+			'Latitude' => 30.18852,
+			'DeviceTime' => date('Y-m-d H:i:s'),
+			'LBS' => 'LBS',
+			'Direction' => 's',
+		);
+		kafkaProducer('gps_location_data',$msg_data);*/
+		
+		// fly 轨迹数据
+		$msg_data = array(
+			'StationCode' => '30B5F101237D',
+			"Longitude" => "120.600889",
+			"Latitude" => "30.191478",
+			"Address" => "华城·和瑞科技广场(长河路475号)",
+			'StationType' => 0,
+			"CityId" => "2902",
+			"StationName" => "基站名称",
+			"AddTime" => date('Y-m-d H:i:s',strtotime('-3 minutes')),
+			"VehicleNumber" => "86412717AC",
+			"VehicleStatus" =>  "1",
+			"SignalCount" => 88,
+			"OnlineTime" => date('Y-m-d H:i:s',strtotime('-2 minutes'))
+		);
+		kafkaProducer('fly_vroute_data',$msg_data);
 	}
 	
  

+ 39 - 1
Home/Lib/Action/NoticeAction.class.php

@@ -129,9 +129,14 @@ class NoticeAction extends Action {
 			\Rlfd\Alarm\PushTypeEnum::LOWWER_BATTERY_ALARM,// C('LOWWER_BATTERY_ALARM'),  // 3-低电量告警
 			\Rlfd\Alarm\PushTypeEnum::SHAKE_ALARM,// C('SHAKE_ALARM'),			// 4-震动报警
 			\Rlfd\Alarm\PushTypeEnum::SHIFT_ALARM,// C('SHIFT_ALARM'),			// 5-位移报警
-			\Rlfd\Alarm\PushTypeEnum::LOCK_VEHICLE_ALARM,// C('LOCK_VEHICLE_ALARM'),   // 6-锁车告警
+			\Rlfd\Alarm\PushTypeEnum::LOCK_VEHICLE_ALARM,// C('LOCK_VEHICLE_ALARM'),   // 99-锁车告警
 			\Rlfd\Alarm\PushTypeEnum::STOLEN_ALARM,// C('STOLEN_ALARM'),       // 7-被盗告警
 			\Rlfd\Alarm\PushTypeEnum::FENCE_ALARM,// C('FENCE_ALARM'),        // 8-电子围栏告警
+			
+			\Rlfd\Alarm\PushTypeEnum::CRASH_ALARM,
+			\Rlfd\Alarm\PushTypeEnum::HIGHVOLTAGE_ALARM,
+			\Rlfd\Alarm\PushTypeEnum::TAKEAPART_ALARM,//拆动报警
+			\Rlfd\Alarm\PushTypeEnum::TURN_ALARM,//翻转报警
 		);
 		if(!is_array($msg_data)){
 			return array( 'success' => false , 'message' => 'invalid message data format!'.$msg_data);
@@ -146,6 +151,9 @@ class NoticeAction extends Action {
 			if(!$ctlRes['success']){
 				return $ctlRes;
 			}
+			
+			
+			
 			//  取车辆数据
 			$where = array('DeviceNumber|GpsDeviceNumber' => $msg_data['device_number']);
 			$fields= 'CityId,LicensePlate,FullName,JgClientRegistrationId';
@@ -278,6 +286,18 @@ class NoticeAction extends Action {
 			$cache = 'last_fence_alarm_';
 		}
 		
+		if($msg_data['type'] == \Rlfd\Alarm\PushTypeEnum::OUTAGE_ALARM ){
+			$interval = C('OUTAGE_ALARM_INTERVAL_SECOND') ? C('OUTAGE_ALARM_INTERVAL_SECOND') : 300;
+			$type = '断电告警';
+			$cache = 'last_outage_alarm_';
+		}
+		
+		if($msg_data['type'] == \Rlfd\Alarm\PushTypeEnum::FENCE_ALARM ){
+			$interval = C('HIGHVOLTAGE_ALARM_INTERVAL_SECOND') ? C('HIGHVOLTAGE_ALARM_INTERVAL_SECOND') : 300;
+			$type = '高电压报警';
+			$cache = 'last_highvoltage_alarm_';
+		}
+		
 		if($msg_data['type'] == \Rlfd\Alarm\PushTypeEnum::SHIFT_ALARM ){
 			$redis = Redis('czapp_lock_status', 'hash');
 			$lockStatus = $redis->get($msg_data['device_number']);
@@ -295,6 +315,24 @@ class NoticeAction extends Action {
 			$type = '锁车报警';
 			$cache = 'last_lock_alarm_';
 		}
+		
+		if($msg_data['type'] == \Rlfd\Alarm\PushTypeEnum::TAKEAPART_ALARM ){
+			$interval = C('TAKEAPART_ALARM_INTERVAL_SECOND') ? C('TAKEAPART_ALARM_INTERVAL_SECOND') : 120;
+			$type = '拆动报警';
+			$cache = 'last_takeapart_alarm_';
+		}
+		
+		if($msg_data['type'] == \Rlfd\Alarm\PushTypeEnum::TAKEAPART_ALARM ){
+			$interval = C('CRASH_ALARM_INTERVAL_SECOND') ? C('CRASH_ALARM_INTERVAL_SECOND') : 120;
+			$type = '碰撞报警';
+			$cache = 'last_crash_alarm_';
+		}
+		
+		if($msg_data['type'] == \Rlfd\Alarm\PushTypeEnum::TURN_ALARM ){
+			$interval = C('TURN_ALARM_INTERVAL_SECOND') ? C('TURN_ALARM_INTERVAL_SECOND') : 120;
+			$type = '翻转报警';
+			$cache = 'last_turn_alarm_';
+		}
 		//	\Rlfd\Alarm\PushTypeEnum::SHIFT_ALARM,// C('SHIFT_ALARM'),			// 5-位移报警
 		//	\Rlfd\Alarm\PushTypeEnum::LOCK_VEHICLE_ALARM,// C('LOCK_VEHICLE_ALARM'),   // 6-锁车告警