<?php
namespace app\common\model;
use think\Model;
class Access extends Model
{
	public $page_info;

	/**
     * 接入信息管理
     */
    public function getAccessList($condition = array(), $field = '*', $page = 0, $order = 'access_id desc')
    {
        if ($page) {
            $access_list = db('access')->where($condition)->order($order)->paginate($page, false, ['query' => request()->param()]);
            $this->page_info = $access_list;
            return $access_list->items();
        } else {
            return db('access')->where($condition)->order($order)->select();
        }
    }

    /**
     * 新增接入
     */
    public function addAccess($data)
    {
        return db('access')->insertGetId($data);
    }

    /**
     * 编辑接入
     */
    public function editAccess($condition, $data)
    {
        return db('access')->where($condition)->update($data);
    }

    /**
     * 取单个接入
     */
    public function getAccessInfo($condition, $field = '*')
    {
        return db('access')->field($field)->where($condition)->find();
    }

    
    
}