| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace app\service\model;
- use think\Model;
- /**
- * 用户模型
- */
- class Users extends Model
- {
- /**
- * 单个数据筛选
- *
- * @access public
- * @param mixed $field 字段
- * @param mixed $where 条件
- * @return array 返回类型
- */
- public function findUsers($field, $where=[])
- {
- $result = $this->field($field);
- if (empty($where) === false) {
- $result = $result->where($where);
- }
- $result = $result->find();
- return $result;
- }//end findUsers()
- /**
- * 数据修改
- *
- * @access public
- * @param mixed $data 数据
- * @param mixed $where 条件
- * @return array 返回类型
- */
- public function updateUsers($where, $data)
- {
- $result = $this->where($where)->update($data);
- return $result;
- }//end updateUsers()
- /**
- * 单个数据筛选
- *
- * @access public
- * @param mixed $field 字段
- * @param mixed $where 条件
- * @param mixed $join 关联
- * @return array 返回类型
- */
- public function findInfo($field, $where=[], $join=[])
- {
- $result = $this->field($field);
- if (empty($join) === false) {
- $result = $result->alias('a');
- foreach ($join as $k => $v) {
- $result = $result->join($k, $v);
- }
- }
- if (empty($where) === false) {
- $result = $result->where($where);
- }
- $result = $result->find();
- return $result;
- }//end findUsers()
- }
|