/**
* 规则
*/
const time_rule = [
{ rule: (hours: number) => hours >= 6 && hours <= 10, intro: "早上好 ⛅" },
{ rule: (hours: number) => hours >= 10 && hours <= 14, intro: "中午好 🌞" },
{ rule: (hours: number) => hours >= 14 && hours <= 18, intro: "下午好 🌞" },
{ rule: (hours: number) => hours >= 18 && hours <= 24, intro: "早上好 ⛅" },
{ rule: (hours: number) => hours >= 0 && hours <= 6, intro: "凌晨好 🌛" },
];
/**
* 根据当前时间段获取欢迎语
* @returns
*/
export function getTimeState() {
const cur_hours = new Date().getHours();
return time_rule.filter((t) => t.rule(cur_hours))[0].intro;
}