作者 郭鑫

需求修改

@@ -237,6 +237,28 @@ class UserneedController extends CommonController @@ -237,6 +237,28 @@ class UserneedController extends CommonController
237 } 237 }
238 // 加数据库 238 // 加数据库
239 $data = $request->Post(); 239 $data = $request->Post();
  240 + if(empty($data['code'])){
  241 + Db::rollback();
  242 + $this->apiResponse('0','验证码不能为空');
  243 + }else{
  244 + $code = $data['code'];
  245 + }
  246 + $where_code['tel'] = $data['tel'];
  247 + $where_code['type'] = 3;
  248 + $where_code['create_time'] = array('egt',(time()-300));
  249 + $find_code = Db::name('Code')->where($where_code)->order('create_time desc')->field('code')->find();
  250 + if(!$find_code){
  251 + Db::rollback();
  252 + $this->apiResponse('0','验证码错误,请重新获取');
  253 + }
  254 + if($code != $find_code['code']){
  255 + Db::rollback();
  256 + $this->apiResponse('0','验证码错误,请重新获取');
  257 + }else{
  258 + $updateCode['status'] = 9;
  259 + Db::name('Code')->where($where_code)->update($updateCode);
  260 + }
  261 +
240 // 保证金 262 // 保证金
241 $city = $data['city']; 263 $city = $data['city'];
242 $area = $data['area']; 264 $area = $data['area'];