Code.php 762 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace app\index\model;
  3. use\think\Model;
  4. use think\Session;
  5. use think\cache\driver\Redis;
  6. use think\Loader;
  7. use think\Cache;
  8. class Code extends Model
  9. {
  10. /**
  11. * 添加验证码
  12. */
  13. public function addCode($data)
  14. {
  15. // // 添加验证码
  16. $addCode = $this->insert($data);
  17. }//end addCode()
  18. /**
  19. * 查询验证码
  20. */
  21. public function selectCode($safetyCodeKey)
  22. {
  23. // // 查询验证码
  24. $codeWhere['code_key'] = $safetyCodeKey;
  25. $code = $this
  26. ->field('code_key, code_time')
  27. ->where($codeWhere)
  28. ->find();
  29. return [
  30. 'code' => 1,
  31. 'msg' => '',
  32. 'data' => $code,
  33. ];
  34. }//end addCode()
  35. }