Commit b13a192e authored by hujun's avatar hujun

增加验证码检测

parent b03ed940
...@@ -469,4 +469,33 @@ class Member extends Basic ...@@ -469,4 +469,33 @@ class Member extends Basic
return $this->response($data['status'], $data['msg'], $data['data']); return $this->response($data['status'], $data['msg'], $data['data']);
} }
/**
* 检查验证码
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function check_code() {
$code = $this->params['code'];
$phone = $this->params['phone'];
$data['status'] = 101;
$data['data'] = array();
$data['msg'] = '';
$note = new NoteLog();
$note_data = $note->field('id,code,send_time')->where([
'phone'=> $phone,
'code' => $code,
'is_success' => 1,
])->whereTime('send_time', '>',time()-300)->find();
if ($note_data) {
$data['status'] = 200;
}
return $this->response($data['status'], $data['msg'], $data['data']);
}
} }
\ No newline at end of file
...@@ -77,6 +77,7 @@ Route::group('api', [ ...@@ -77,6 +77,7 @@ Route::group('api', [
//get //get
'sendSms/:phone' => [ 'api/member/sendSms', [ 'method' => 'get' ] ], //发送短信 'sendSms/:phone' => [ 'api/member/sendSms', [ 'method' => 'get' ] ], //发送短信
'sendSms' => [ 'api/member/sendSms', [ 'method' => 'get' ] ], //发送短信 'sendSms' => [ 'api/member/sendSms', [ 'method' => 'get' ] ], //发送短信
'check_code' => [ 'api/member/check_code', [ 'method' => 'get' ] ], //检测短信
'index' => [ 'api/member/index', [ 'method' => 'get' ] ], 'index' => [ 'api/member/index', [ 'method' => 'get' ] ],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment