|
@@ -112,6 +112,10 @@ class ApiAction extends Action {
|
|
|
if(!$licenseplate){
|
|
|
json_fail('LicensePlate不存在!');
|
|
|
}
|
|
|
+ $res = $this->plate_verify($licenseplate);
|
|
|
+ if(!res){
|
|
|
+ json_fail('无效车牌,请重新选择!');
|
|
|
+ }
|
|
|
$openid = $data['Openid'];
|
|
|
if(!$openid){
|
|
|
json_fail('Openid不存在!');
|
|
@@ -201,6 +205,7 @@ class ApiAction extends Action {
|
|
|
public function reportPersonalOrderInfo( ){
|
|
|
header('Access-Control-Allow-Origin:*');
|
|
|
$data = $_POST;
|
|
|
+ $data['OpenId'] = $data['Openid'];
|
|
|
$appid = $data['AppId'];
|
|
|
if(!$appid){
|
|
|
json_fail('AppId不存在!');
|
|
@@ -287,28 +292,19 @@ class ApiAction extends Action {
|
|
|
$time = time() - (C('EXPIREIN')*60);
|
|
|
if($time > $info['Timestamp']){
|
|
|
json_fail('该车牌已经过期,请重选车牌');
|
|
|
- }else{
|
|
|
- $response = array(
|
|
|
- 'LicensePlate' => $licenseplate,
|
|
|
- 'ExpireIn' => C('EXPIREIN'),
|
|
|
- 'Timestamp' => $info['Timestamp']
|
|
|
- );
|
|
|
- json_success('上报预选车牌成功',$response);
|
|
|
}
|
|
|
}else{
|
|
|
//是否过期
|
|
|
$time = time() - (C('EXPIREIN')*60);
|
|
|
- if($time > $info['Timestamp']){
|
|
|
- $response = array(
|
|
|
- 'LicensePlate' => $licenseplate,
|
|
|
- 'ExpireIn' => C('EXPIREIN'),
|
|
|
- 'Timestamp' => $info['Timestamp']
|
|
|
- );
|
|
|
- json_success('上报预选车牌成功',$response);
|
|
|
- }else{
|
|
|
+ if($time < $info['Timestamp']){
|
|
|
json_fail('该车牌已被占用,请重新选牌!');
|
|
|
}
|
|
|
}
|
|
|
+ //检测车牌
|
|
|
+ $res = $this->plate_verify($licenseplate);
|
|
|
+ if(!res){
|
|
|
+ json_fail('无效车牌,请重新选择!');
|
|
|
+ }
|
|
|
$cond = array(
|
|
|
'LicensePlate'=>$data['LicensePlate'],
|
|
|
'OrderStatus'=>array('neq','2')
|
|
@@ -549,5 +545,22 @@ class ApiAction extends Action {
|
|
|
json_success('执行完毕');
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ private function plate_verify( $licenseplate ){
|
|
|
+ if(!$licenseplate){
|
|
|
+ json_fail('车牌不能为空!');
|
|
|
+ }
|
|
|
+ $cond = array(
|
|
|
+ 'LicensePlate'=>$licenseplate,
|
|
|
+ 'PreSelection'=>1
|
|
|
+ );
|
|
|
+ $res = M('jms_plate')->where($cond)->find();
|
|
|
+ if(!$res){
|
|
|
+ return false;
|
|
|
+ }else{
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|