<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------

namespace Home\Model;
use Think\Model;

/**
 * 分类模型
 */
class ProtectLogModel extends Model{

    protected $_validate = array(

    );

    protected $_auto = array(
    );

    /**
     * 构造函数
     * @param string $name 模型名称
     * @param string $tablePrefix 表前缀
     * @param mixed $connection 数据库连接信息
     */
    public function __construct($name = '', $tablePrefix = '', $connection = '') {
        /* 设置默认的表前缀 */
        $this->tablePrefix ='tab_';
        /* 执行构造方法 */
        parent::__construct($name, $tablePrefix, $connection);
    }


    /**
     * 按照时间分组统计注册总数
     * @param string           $field          需要的字段
     * @param string           $where          sql条件
     * @param string           $group          sqlGroup条件
     * @param string           $order          sql排序
     * @param string           $page           页数
     * @param string           $row            每页几条
     * @return array            详细数据
     * @author 鹿文学
     */
    public function getProtectLog($field = '*', $where = [], $group = '', $order='',$page = 0, $row = 0) {

        if ($page) {
            $data = $this->field($field)
                ->where($where)
                ->page($page,$row)
                ->group($group)
                ->order($order)
                ->select();
        } else {
            $data = $this->field($field)
                ->where($where)
                ->group($group)
                ->order($order)
                ->select();
        }

        return $data;
    }


}