Verifycode.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. namespace We7\Table\Uni;
  7. class Verifycode extends \We7Table {
  8. protected $tableName = 'uni_verifycode';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'uniacid',
  12. 'receiver',
  13. 'verifycode',
  14. 'total',
  15. 'createtime',
  16. 'failed_count',
  17. );
  18. protected $default = array(
  19. 'uniacid' => '',
  20. 'receiver' => '',
  21. 'verifycode' => '',
  22. 'total' => '',
  23. 'createtime' => '',
  24. 'failed_count' => '',
  25. );
  26. public function getByReceiverVerifycode($uniacid, $receiver, $verifycode) {
  27. if (!empty($verifycode)) {
  28. $this->query->where('verifycode', $verifycode);
  29. }
  30. $row = $this->query
  31. ->where('receiver', $receiver)
  32. ->where('uniacid', $uniacid)
  33. ->getall();
  34. return $row[0];
  35. }
  36. public function getFailedCountByReceiver($receiver) {
  37. return $this->query
  38. ->where('receiver', $receiver)
  39. ->getcolumn('failed_count');
  40. }
  41. public function updateFailedCount($receiver) {
  42. $sql = "update " . tablename('uni_verifycode') . " set failed_count=failed_count + '1' where receiver = :receiver";
  43. return pdo_query($sql, array(':receiver' => $receiver));
  44. }
  45. }