<?php

/**
 * @Author: 思睿软件
 * @Date:   2020-01-12 13:47:04
 * @Last Modified by:   xjx
 * @Last Modified time: 2020-01-12 14:34:14
 */
namespace siruisoft\common\model;

use siruisoft\common\model\ModelBase;

class UserVip extends ModelBase{

	protected $name ='user_vip';

	protected $ctag  ='user_vip';

	function getAll(){
		$ckey = 'user_vip';
		$rows = tag_cache($this->ctag,$ckey);
		if($rows) return $rows;
		$rows = $this->where('is_del',0)->order('sort ASC')->select();
		if($rows){
			$rows = $rows->toArray();
			tag_cache($this->ctag,$ckey,$rows);
		}
		return $rows;
	}


	/**
	 * [getMaxLevel 获取当前最大级别]
	 * @Author   思睿软件
	 * @DateTime 2020-02-08T20:01:04+0800
	 * @Version  1.0
	 * @return   [type]                   [description]
	 */
	function getMaxLevel(){
		$all = $this->getAll();
		$max =0;
		foreach ($all as $key => $value) {
			if($value['sort']>$max){
				$max = $value['sort'];
			}
		}
		return $max;
	}


		
}