You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
646 B

3 years ago
  1. <?php
  2. namespace Api\Model;
  3. use Api\Model\BaseModel;
  4. /**
  5. *
  6. * @author star7th
  7. */
  8. class CaptchaModel extends BaseModel {
  9. public function check($captcha_id , $captcha, $none =''){
  10. $time = time() ;
  11. $captcha_array = $this->where(" captcha_id = '$captcha_id' and expire_time > $time ")->find();
  12. if ($captcha_array['captcha'] && $captcha_array['captcha'] == $captcha) {
  13. //检查完就设置该验证码过期
  14. $this->where(" captcha_id = '$captcha_id'")->save(array("expire_time"=>0));
  15. return true ;
  16. }else{
  17. //删除掉所有过期的二维码
  18. //$this->where(" expire_time < '$time' ")->delete();
  19. }
  20. return false;
  21. }
  22. }