<?php
/**
 * Created by PhpStorm
 * User:林志杰
 * Email:598287049@qq.com
 * Motto:纵有疾风起,人生不言弃!
 * Time:2020/2/8 17:39
 */

declare(strict_types=1);

namespace app\common\lib;


class Time
{
    /**
     * 用户登录token保存时长
     * @param int $type
     * @return int
     */
    public static function userLoginExpiresTime(int $type = 2): int
    {
        $type = !in_array($type, [1, 2]) ? 2 : $type;
        if ($type === 1) {
            $day = 7;
        } elseif ($type === 2) {
            $day = 30;
        }
        return $day * 24 * 3600;
    }
}