Procházet zdrojové kódy

check addressstolen

git před 6 roky
rodič
revize
f89171ae4f

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

@@ -149,6 +149,7 @@ class ApiAction extends Action {
 		
 		$lastLocReis = Redis('rfld_gps_last_location','hash');
 		$lastLoction = $lastLocReis->get($gpsNumber);
+		//var_dump($lastLoction);
 		if($lastLoction){
 			$lastLoction = json_decode($lastLoction, true);
 			$alterVehLoction = \Jms\Algo\Geometry::convertBd09ToGcj02($lastLoction['GpsLatitude'], $lastLoction['GpsLongitude']);	

+ 62 - 3
Home/Lib/Action/CronAction.class.php

@@ -20,9 +20,22 @@ class CronAction extends Action {
 			$licensPlate = $pendingElectricPlate->pop();
 			if($licensPlate){
 				echo 'pop licensPlate:'.$licensPlate.PHP_EOL;
-				$field = 'LicensPlate,VehicleColor, FullName, Address, FrameNumber, MotorNumber, VehicleBrand';
-				$vehicleInfo = M('jms_vehicle')->where(array('LicensPlate' => $licensPlate))->field($field);
-				$localPath = '生成函数';
+				$field = 'LicensPlate,VehicleColor, FullName, Address, FrameNumber, MotorNumber, VehicleBrand, RegistrationTime';
+				$vehicleInfo = M('jms_vehicle')->where(array('LicensPlate' => $licensPlate))->field($field)->find();
+				if(!$vehicleInfo){
+					echo 'vehicleInfo not existed,$licensPlate = '.$licensPlate .PHP_EOL;
+					continue;
+				}
+				$localPath = $this->createLocalElectronicPlate($vehicleInfo);
+				if(!$localPath){
+					echo 'createLocalElectronicPlate failed,$licensPlate = '.$licensPlate .PHP_EOL;
+					//生成失败的重新放回队列
+					$result = $pendingElectricPlate->add($licensPlate);
+					if(!$result){
+						echo 'pendingElectricPlate->add() failed,$licensPlate = '.$licensPlate .PHP_EOL;
+					}
+					continue;
+				}
 				$up2ossWait = json_encode(array('licensPlate' => $licensPlate, 'localPath' => $localPath));
 				$plateLocalPath->push($up2ossWait);
 			}
@@ -238,5 +251,51 @@ class CronAction extends Action {
 		kafkaProducer('gps_location_data',$msg_data);
 	}
 	
+ 
+	private  function createLocalElectronicPlate( $params ){
+		$license_plate = $params['LicensPlate'];//LicensPlate,VehicleColor, FullName, Address, FrameNumber, MotorNumber, VehicleBrand
+		$vehicle_color = $params['VehicleColor'];
+		$real_name = $params['FullName'];
+		$address = $params['Address'];
+		$cjh = $params['FrameNumber'];
+		$djh = $params['MotorNumber'];
+		$cph = $params['VehicleBrand'];
+		$date = date('Y-m-d',$params['RegistrationTime']);
+		$reg_date = $date;
+		$fz_date = $date;
+		$fz_org = "包头市公安局";
+		
+		$im = imagecreatetruecolor(500, 278);           // 设置画布
+		//$bg = imagecreatefromjpeg('bg.jpg');   // 设置背景图片
+		$bg = imagecreatefromjpeg('./Public/images/front.jpg');   // 设置背景图片
+		imagecopy($im,$bg,0,0,0,0,500,278);             // 将背景图片拷贝到画布相应位置
+		imagedestroy($bg);                              // 销毁背景图片
+		$font = './Public/font/stsong.ttf';               // 设置字体             // 设置字体,这里可以指向ttf文件
+		$blacka = imagecolorallocate($im, 15, 23, 25);  // 颜色
+		
+		/* 写入内容 */
+		imagettftext($im, 12, 0, 135, 66, $blacka, $font,$license_plate );       // 车牌号
+		imagettftext($im, 12, 0, 335, 66, $blacka, $font,$vehicle_color );       // 车辆颜色
+		imagettftext($im, 12, 0, 135, 96, $blacka, $font,$real_name );       // 姓名
+		imagettftext($im, 12, 0, 135, 128, $blacka, $font,$address );       // 住址
+		imagettftext($im, 12, 0, 135, 160, $blacka, $font,$cjh );       // 车架号
+		imagettftext($im, 12, 0, 335, 160, $blacka, $font,$djh );       // 电机号
+		imagettftext($im, 12, 0, 263, 192, $blacka, $font,$cph );       // 厂牌型号
+		imagettftext($im, 11, 0, 260, 222, $blacka, $font,$reg_date );       // 注册日期
+		imagettftext($im, 11, 0, 376, 222, $blacka, $font,$fz_date );       // 发证期
+		imagettftext($im, 12, 0, 263, 255, $blacka, $font,$fz_org );       // 发证机关
+		
+		
+		$img_file = "./images/myplate.jpg";
+		$result = imagejpeg($im, $img_file);     // 生成jpeg格式图片
+		imagedestroy($im);  // 销毁图片
+		if(!$result){
+			echo "生成电子车牌失败";
+			exit;
+		}
+		
+		echo '生成电子车牌完成';
+	}
+	
 
 }

binární
Public/font/stsong.ttf


binární
Public/images/back.jpg


binární
Public/images/front.jpg


+ 1 - 1
czapp

@@ -1 +1 @@
-Subproject commit d971c25d4df783ef6f905a82c2887686e1a4558e
+Subproject commit 0962e8fa9b3acbd52eceb4ad2ab92c5255544bb4