作者 郭鑫

需求修改

... ... @@ -190,7 +190,7 @@ class UserController extends CommonController
$code = $request->param('code');
$where_code['tel'] = $data['tel'];
$where_code['type'] = 1;
$where_code['create_time'] = array('lt',(time()+300));
$where_code['create_time'] = array('egt',(time()-300));
$find_code = Db::name('Code')->where($where_code)->order('create_time desc')->field('code')->find();
if(!$find_code){
Db::rollback();
... ...
... ... @@ -113,7 +113,30 @@ class UserneedController extends CommonController
return json(array('code'=>0,'message'=>$validate->getError()));
}
// 加数据库
$data = $request->Post();
if(empty($data['code'])){
Db::rollback();
$this->apiResponse('0','验证码不能为空');
}else{
$code = $data['code'];
}
$where_code['tel'] = $data['tel'];
$where_code['type'] = 3;
$where_code['create_time'] = array('egt',(time()-300));
$find_code = Db::name('Code')->where($where_code)->order('create_time desc')->field('code')->find();
if(!$find_code){
Db::rollback();
$this->apiResponse('0','验证码错误,请重新获取');
}
if($code != $find_code['code']){
Db::rollback();
$this->apiResponse('0','验证码错误,请重新获取');
}else{
$updateCode['status'] = 9;
Db::name('Code')->where($where_code)->update($updateCode);
}
// 保证金
$city = $data['city'];
$area = $data['area'];
... ...