|
@@ -22,11 +22,46 @@ class CronAction extends Action {
|
|
|
echo "LicensePlate empty!".PHP_EOL;
|
|
|
continue;
|
|
|
}
|
|
|
- //过期预约车牌,释放到公选池
|
|
|
+
|
|
|
+
|
|
|
+ //检测车牌是否已生成待开户订单,已生成的丢弃,未生成释放到公选池
|
|
|
+ $cond = array(
|
|
|
+ 'LicensePlate' => $info['LicensePlate'],
|
|
|
+ 'OrderStatus' => C('订单状态_待开户')
|
|
|
+ );
|
|
|
+ $order_info = M('jms_order')->where($cond)->field('LicensePlate,OrderStatus')->find();
|
|
|
+ if(!$order_info){
|
|
|
+ $cond = array(
|
|
|
+ 'LicensePlate' => $info['LicensePlate'],
|
|
|
+ 'OrderStatus' => C('订单状态_已开户')
|
|
|
+ );
|
|
|
+ $order_info = M('jms_order')->where($cond)->field('LicensePlate,OrderStatus')->find();
|
|
|
+ }
|
|
|
+ if($order_info && $order_info['OrderStatus'] === C('订单状态_待开户')){
|
|
|
+ echo 'LicensePlate: '.$info['LicensePlate'].' has waiting order,discard!'.PHP_EOL;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if($order_info && $order_info['OrderStatus'] === C('订单状态_已开户')){
|
|
|
+ echo 'LicensePlate: '.$info['LicensePlate'].' has finish order,discard!'.PHP_EOL;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ //过期的预约车牌,释放到公选池
|
|
|
if(time()>$info['ExpireTime']){
|
|
|
- $plate_preselect_pool -> add($info['LicensePlate']);
|
|
|
+ $result = $plate_preselect_pool -> add($info['LicensePlate']);
|
|
|
+ if(!$result){
|
|
|
+ echo 'LicensePlate: '.$info['LicensePlate'].' push to plate_preselect_pool failed!'.PHP_EOL;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
echo 'LicensePlate: '.$info['LicensePlate'].' timeout, push to plate_preselect_pool'.PHP_EOL;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ //没有过期的,放回队列
|
|
|
+ $result = $plate_preselect_pool -> push($info);
|
|
|
+ if(!$result){
|
|
|
+ echo 'info push to plate_preselect_pool failed!'.PHP_EOL;
|
|
|
+ continue;
|
|
|
}
|
|
|
+ usleep(1000);
|
|
|
}while(time()-$start<60);
|
|
|
|
|
|
|