作者 郭鑫

需求修改

@@ -190,7 +190,7 @@ class UserController extends CommonController @@ -190,7 +190,7 @@ class UserController extends CommonController
190 $code = $request->param('code'); 190 $code = $request->param('code');
191 $where_code['tel'] = $data['tel']; 191 $where_code['tel'] = $data['tel'];
192 $where_code['type'] = 1; 192 $where_code['type'] = 1;
193 - $where_code['create_time'] = array('lt',(time()+300)); 193 + $where_code['create_time'] = array('egt',(time()-300));
194 $find_code = Db::name('Code')->where($where_code)->order('create_time desc')->field('code')->find(); 194 $find_code = Db::name('Code')->where($where_code)->order('create_time desc')->field('code')->find();
195 if(!$find_code){ 195 if(!$find_code){
196 Db::rollback(); 196 Db::rollback();
@@ -113,7 +113,30 @@ class UserneedController extends CommonController @@ -113,7 +113,30 @@ class UserneedController extends CommonController
113 return json(array('code'=>0,'message'=>$validate->getError())); 113 return json(array('code'=>0,'message'=>$validate->getError()));
114 } 114 }
115 // 加数据库 115 // 加数据库
  116 +
116 $data = $request->Post(); 117 $data = $request->Post();
  118 + if(empty($data['code'])){
  119 + Db::rollback();
  120 + $this->apiResponse('0','验证码不能为空');
  121 + }else{
  122 + $code = $data['code'];
  123 + }
  124 + $where_code['tel'] = $data['tel'];
  125 + $where_code['type'] = 3;
  126 + $where_code['create_time'] = array('egt',(time()-300));
  127 + $find_code = Db::name('Code')->where($where_code)->order('create_time desc')->field('code')->find();
  128 + if(!$find_code){
  129 + Db::rollback();
  130 + $this->apiResponse('0','验证码错误,请重新获取');
  131 + }
  132 + if($code != $find_code['code']){
  133 + Db::rollback();
  134 + $this->apiResponse('0','验证码错误,请重新获取');
  135 + }else{
  136 + $updateCode['status'] = 9;
  137 + Db::name('Code')->where($where_code)->update($updateCode);
  138 + }
  139 +
117 // 保证金 140 // 保证金
118 $city = $data['city']; 141 $city = $data['city'];
119 $area = $data['area']; 142 $area = $data['area'];