Преглед изворни кода

增加生成电子车牌函数;增强字段校验

git пре 5 година
родитељ
комит
47671dcaaf
2 измењених фајлова са 22 додато и 6 уклоњено
  1. 0 1
      Home/Lib/Action/ApiAction.class.php
  2. 22 5
      Home/Lib/Action/CronAction.class.php

+ 0 - 1
Home/Lib/Action/ApiAction.class.php

@@ -282,7 +282,6 @@ class ApiAction extends Action {
 		} else {
 			$StolenDate = date('Y-m-d');
 		}
-		$this->api_fail(C('FAIL'),$stolenCityId);
 		if(M('jms_baojing')->where(array('LicensePlate' => $vehicle_info['LicensePlate'],'StolenState'=>0))->find()){
 			$this->api_fail(C('FAIL'),'报警信息已经存在');
 		}

+ 22 - 5
Home/Lib/Action/CronAction.class.php

@@ -71,9 +71,11 @@ class CronAction extends Action {
 		$plateLocalPath = Redis('jyzl_wait_upload2oss_eplate');
 		while( (time() - $start) < 60 ){
 			$data = $plateLocalPath->pop();
-			var_dump($data);
-			json_decode($data,true);
-			var_dump($data);
+			if(!$data){
+				echo 'no more data, waiting for next mesaage.'.PHP_EOL;
+				continue;
+			}
+			
 			if($data){
 				//TEST
 				$fileName = 'gravatar.jpg';
@@ -105,6 +107,20 @@ class CronAction extends Action {
 	
  
 	public  function test_function(  ){
+		$vehicleInfo = array(
+			'LicensePlate' => 'LY100021',
+			'VehicleColor' => '白色',
+			'FullName' => '张三', 
+			'Address' => '浙江杭州滨江195号',
+			'FrameNumber' => '123456789',
+			'MotorNumber' => '233456789', 
+			'VehicleBrand'=> '雅迪z123', 
+			'RegistrationTime' => '2019-05-15 12:12:00'
+		);
+		$localPath = $this->createLocalElectronicPlate($vehicleInfo);
+		echo $localPath .PHP_EOL;
+		exit;
+		
 		$plate = 'BJ000100';
 		$pendingElectricPlate = Redis("jyzl_wait_create_eplate","queue");
 		$licensePlate = $plate;
@@ -297,11 +313,12 @@ class CronAction extends Action {
 			echo "VehicleBrand empty!".PHP_EOL;
 			return false;
 		}
-		if(strtotime($params['RegistrationTime']) < 1546272000){
+		$regist_time = strtotime($params['RegistrationTime']);
+		if($regist_time < 1546272000){
 			echo "RegistrationTime invalid! RegistrationTime: ".$params['RegistrationTime'].PHP_EOL;
 			return false;
 		}
-		$date = date('Y-m-d',$params['RegistrationTime']);
+		$date = date('Y-m-d',$regist_time);
 		if(!$date){
 			echo "date empty! RegistrationTime: ".$params['RegistrationTime'].PHP_EOL;
 			return false;