<?php
namespace wstmart\common\model;
use think\Db;
/**
 * ============================================================================
 * 验证处理类
 */
class AuthFamily extends Base{
	protected $table  = '';
    public function __construct(){
    	parent::__construct();
      	$this->table = Db::name('auth_family_report'); 
    }
    public function setTable($tableName='auth_family_personal'){
    	$this->table = Db::name($tableName); 
    }
	public function getStatusTextAttr($value,$data){
        $status = [-1=>'已拒绝',0=>'待审核',1=>'已通过'];
        return $status[$data['status']];
    }
	/**
	 * 获取单条信息
	 * @param  [type] $where [description]
	 * @param  string $field [description]
	 * @return [type]        [description]
	 */
	public function getInfo($where,$field='*'){
		$where['dataFlag'] = 1;
		return $this->table->where($where)->field($field)->find();
	}
	/**
	 * 获取单条信息
	 * @param  [type] $where [description]
	 * @param  string $field [description]
	 * @return [type]        [description]
	 */
	public function getField($where,$field='id'){
		$where['dataFlag'] = 1;
		return $this->table->where($where)->value($field);
	}
	/**
	 * 获取多条信息
	 * @param  [type] $where [description]
	 * @param  string $field [description]
	 * @return [type]        [description]
	 */
	public function getList($where,$field='id'){
		$where['dataFlag'] = 1; 
		return $this->table->where($where)->field($field)->select();;
	}
	/**
	 * 获取多条信息
	 * @param  [type] $where [description]
	 * @param  string $field [description]
	 * @return [type]        [description]
	 */
	public function getSelect($where,$field='id'){
		$where['dataFlag'] = 1; 
		return $this->table->where($where)->field($field)->paginate(input('pageSize/d',10))->toArray();;
	}
	/**
	 * 插入单条信息
	 * @param  string $data [description]
	 * @return [type]        [description]
	 */
	public function insertInfo($data){
		$data['createTime'] = time();
		return $this->table->insert($data);
	}
	/**
	 * 更新单条信息
	 * @param  [type] $where [description]
	 * @param  string $data [description]
	 * @return [type]        [description]
	 */
	public function updateInfo($where,$data){
		return $this->table->where($where)->update($data);
	}
	
}