精简时间判断代码

This commit is contained in:
丑小鸦
2023-07-28 21:31:31 +08:00
committed by GitHub
parent b2a461ae13
commit 2c9d4314d6

View File

@@ -206,8 +206,8 @@ function loadWidget() {
modelTexturesId = localStorage.getItem("modelTexturesId"); modelTexturesId = localStorage.getItem("modelTexturesId");
if (modelId === null) { if (modelId === null) {
// 首次访问加载 指定模型 的 指定材质 // 首次访问加载 指定模型 的 指定材质
const now = new Date(); const hour = new Date().getHours();
if(now.getHours()>=20 || now.getHours()<8){ if(hour>=20 || hour<8){
modelId = 1; // 夜间模型ID modelId = 1; // 夜间模型ID
}else{ }else{
modelId = 0; // 白天模型ID modelId = 0; // 白天模型ID