123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- /*
- * @Author: wang jun
- * @Date: 2021-09-03 16:25:59
- * @Last Modified by: wang jun
- * @Last Modified time: 2021-09-03 17:50:56
- */
- namespace app\index\model;
- use think\Model;
- class smscoderecordmodel extends Model
- {
- protected $table = 't_smscoderecord';
- /***
- * 20210903
- * wj
- * 添加验证码
- */
- public function insinfo($arr)
- {
- $this->setAttr('id', null)->isUpdate(false)->allowField(true)->save($arr);
- return $this->id;
- }
- /***
- * 20210903
- * wj
- * 根据条件获取数据
- */
- public function getinfo($where, $row = true)
- {
- $query = $this->where($where);
- if ($row) {
- $info = $query->find();
- } else {
- $info = $query->select();
- }
- return $info;
- }
- /***
- * 20210903
- * wj
- * 根据id条件获取数据
- */
- public function getinfobyid($id)
- {
- $where['id'] = $id;
- $info = $this->where($where)->find();
- return $info;
- }
- /***
- * 20210903
- * wj
- * 删除已用验证码
- */
- public function deletebyid($id)
- {
- $where['id'] = $id;
- $result = $this->where($where)->delete();
- return $result;
- }
- public function getlastinfo($where)
- {
- $info = $this->where($where)->limit(1)->order('id', 'desc')->find();
- return $info;
- }
- }
|