smscoderecordmodel.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /*
  3. * @Author: wang jun
  4. * @Date: 2021-09-03 16:25:59
  5. * @Last Modified by: wang jun
  6. * @Last Modified time: 2021-09-03 17:50:56
  7. */
  8. namespace app\index\model;
  9. use think\Model;
  10. class smscoderecordmodel extends Model
  11. {
  12. protected $table = 't_smscoderecord';
  13. /***
  14. * 20210903
  15. * wj
  16. * 添加验证码
  17. */
  18. public function insinfo($arr)
  19. {
  20. $this->setAttr('id', null)->isUpdate(false)->allowField(true)->save($arr);
  21. return $this->id;
  22. }
  23. /***
  24. * 20210903
  25. * wj
  26. * 根据条件获取数据
  27. */
  28. public function getinfo($where, $row = true)
  29. {
  30. $query = $this->where($where);
  31. if ($row) {
  32. $info = $query->find();
  33. } else {
  34. $info = $query->select();
  35. }
  36. return $info;
  37. }
  38. /***
  39. * 20210903
  40. * wj
  41. * 根据id条件获取数据
  42. */
  43. public function getinfobyid($id)
  44. {
  45. $where['id'] = $id;
  46. $info = $this->where($where)->find();
  47. return $info;
  48. }
  49. /***
  50. * 20210903
  51. * wj
  52. * 删除已用验证码
  53. */
  54. public function deletebyid($id)
  55. {
  56. $where['id'] = $id;
  57. $result = $this->where($where)->delete();
  58. return $result;
  59. }
  60. public function getlastinfo($where)
  61. {
  62. $info = $this->where($where)->limit(1)->order('id', 'desc')->find();
  63. return $info;
  64. }
  65. }