123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- /*
- * @Author: wang jun
- * @Date: 2021-09-27 08:39:30
- * @Last Modified by: wang jun
- * @Last Modified time: 2021-09-27 10:40:35
- */
- namespace app\index\model;
- use think\Model;
- class workermodel extends Model
- {
- protected $table = 't_worker';
- public function insertData($data)
- {
- $id = $this->insertGetId($data);
- return empty($id) ? false : $id;
- }
- public function getInfo($where, $field = "*", $row = true)
- {
- $info = $this->field($field)->where($where);
- if ($row) {
- $info = $info->find();
- } else {
- $info = $info->select();
- }
- return empty($info) ? false : $info;
- }
- public function updateinfo($where, $updateData)
- {
- $row = $this->where($where)->update($updateData);
- return empty($row) ? false : $row;
- }
- public function deleteinfo($where)
- {
- $row = $this->where($where)->delete();
- return empty($row) ? false : $row;
- }
- /***
- * 获取全部字段名
- * 20211103
- * wj
- */
- public function gettablefields()
- {
- $sql = "desc " . $this->table;
- $fiekds = $this->query($sql);
- return $fiekds;
- }
- }
|