<?php
/*
* 项目: iOrange(橘子)
* 作者: 离家出走(yzxh24)
* Email: yzxh24@gmail.com
* 主页: www.iorange.cc
*/
/* vim: set ts=4 sw=4: */
class Robbuild extends Model
{
    public static function table()
    {
        return 'ig_robbuild';
    }

    public static function checkIsRobFloor($awardfloors, $floor)
    {
        $awardfloors = explode(',', $awardfloors);
		$floor = intval($floor);
		if ($floor < 1 || ! S::isArray($awardfloors))
        {
            return false;
        }

		foreach ($awardfloors as $v)
        {
            if ($v == $floor)
            {
				return $floor;
			}
            
			if (strrpos($v, '*') !== false)
            {
				$contents = str_replace('*', '\d*', $v);
				if (preg_match ("/^$contents$/", $floor))
                {
					return $floor;
				}
			}
		}

		return false;
	}
}