<?php
namespace Biz\Datetime;
/**
 * basetime
 */
class DateYears extends BaseTime {
	/**
	 * 时间信息获取
	 * @var string
	 */
	public function parseTime($params){
		$res = $this->GetTimesYear($params[0]);
		return $res;
	}

    //获取指定日期起始时间:年
    public function GetTimesYear($type){
        $cury =  date('Y-1-1',time());
        if($type == 'pre'){
            $res['start'] = date('Y-m-d 00:00:00',strtotime($cury.'-1year'));
            $res['end'] = date('Y-m-d 23:59:59',strtotime($cury.'-1day'));
        }else if($type=='cur'){
            $res['start'] = date('Y-01-01 00:00:00',time());
            $res['end'] = date('Y-m-d 23:59:59',strtotime($cury.'+1year-1day'));
        }else{
            $res['start'] = date('Y-m-d 00:00:00',strtotime($cury.'+1year'));
            $res['end'] = date('Y-m-d 23:59:59',strtotime($cury.'+2year-1day'));
        }
        return $res;
    }
}