<?php 
namespace Common\Model;
use Think\Model;
class UrlModel extends Model
{
	protected $_validate = array(
		array('alias','require', '调用名必须填写！',1),
		array('locator','require','替换规则必须填写！',1),
		array('rule_key','require','路由规则必须填写！',1),
		array('rule_var','require','对应方法必须填写！',1),
	);
	//获取列表
	public function get_list($map='',$page=false,$sort='',$num='')
	{
		$limit=$num?$num:10;
		if ($page)
		{
			$count      = $this->where($map)->count();
			$Page		= pager($count,$limit);
			$limit      = $Page->firstRow.','.$Page->listRows;
			$page_str   = $Page->fshow();
		}
		$result = $this->where($map)->order($sort)->limit($limit)->select();
		foreach ($result as $key => $v){
				//$v['addtime_str']=daterange($v['addtime'],'',"#000");
				$list[]=$v;
		}
		$return['list']=$list;
		if ($page){
		$return['count']=$count;
		}else{
		$return['count']=count($list);
		}
		$return['page']=$page_str;
		//print_r($return);
		return $return;
	}
	 
	 
	 
}
?>