作者 zhaozzwei

更新 YuyueController.php

@@ -127,14 +127,12 @@ class YuyueController extends UserBaseController @@ -127,14 +127,12 @@ class YuyueController extends UserBaseController
127 } else { 127 } else {
128 $data['teach_id'] = intval($tech_id); 128 $data['teach_id'] = intval($tech_id);
129 $data['uid'] = session('user.id'); 129 $data['uid'] = session('user.id');
130 - $data['status'] = array('neq','3');  
131 130
  131 + $w['uid'] = session('user.id');
  132 + $w['status'] = array('neq','3');
132 //预约订单完成后才可以再次预约 133 //预约订单完成后才可以再次预约
133 - $rr = Db::name('yuyue')->where($data)->order('create_time', 'desc')->find();  
134 - unset($data['status']);  
135 - $ytime = strtotime($rr['yuyue_day'].''.$rr['yuyue_end'].':00');  
136 - $tt = time();  
137 - if ( $ytime >$tt) { 134 + $rr = Db::name('yuyue')->where($w)->find();
  135 + if ( $rr) {
138 return json(['code' => '0', 'msg' => '您好,您有待学车预约']); 136 return json(['code' => '0', 'msg' => '您好,您有待学车预约']);
139 } 137 }
140 138
@@ -144,9 +142,9 @@ class YuyueController extends UserBaseController @@ -144,9 +142,9 @@ class YuyueController extends UserBaseController
144 $data['yuyue_begin'] = session('yuyue_pre.begin'); 142 $data['yuyue_begin'] = session('yuyue_pre.begin');
145 143
146 $ress = Db::name('yuyue')->where($data)->find(); 144 $ress = Db::name('yuyue')->where($data)->find();
147 - if($ress){  
148 - return json(['code'=>'0','msg'=>'抱歉,您已经预约过']);  
149 - } 145 +// if($ress){
  146 +// return json(['code'=>'0','msg'=>'抱歉,您已经预约过']);
  147 +// }
150 $data['status'] = '1'; 148 $data['status'] = '1';
151 $data['create_time'] = time(); 149 $data['create_time'] = time();
152 150
@@ -281,12 +279,15 @@ class YuyueController extends UserBaseController @@ -281,12 +279,15 @@ class YuyueController extends UserBaseController
281 $data['yuyue_begin'] = $begin; 279 $data['yuyue_begin'] = $begin;
282 $data['yuyue_end'] = $end; 280 $data['yuyue_end'] = $end;
283 $data['yuyue_week'] = $week; 281 $data['yuyue_week'] = $week;
284 - $data['status'] = array('neq','3');  
285 - $ress = Db::name('yuyue')->where($data)->find();  
286 - unset($data['status']);  
287 - if($ress){  
288 - return json(['code'=>'0','msg'=>'抱歉,您已经预约过']); 282 +
  283 + $w['uid'] = session('user.id');
  284 + $w['status'] = array('neq','3');
  285 + //预约订单完成后才可以再次预约
  286 + $rr = Db::name('yuyue')->where($w)->find();
  287 + if ( $rr) {
  288 + return json(['code' => '0', 'msg' => '您好,您有待学车预约']);
289 } 289 }
  290 +
290 $data['status'] = 1; 291 $data['status'] = 1;
291 $data['create_time'] = time(); 292 $data['create_time'] = time();
292 293