Skip to content

Commit a1cc082

Browse files
committed
1 parent d1f4374 commit a1cc082

1 file changed

Lines changed: 21 additions & 11 deletions

File tree

‎Task/moji.js‎

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
支持boxjs手动修改位置,可直接输入中文地区名
3-
3+
更新时间 2020-12-09 14:12
44
*/
55
const $ = new Env('墨迹天气')
66
const City = encodeURIComponent($.getdata('city')||"北京")
@@ -117,26 +117,35 @@ function showmsg() {
117117
sundown = $.weather.data.sunset.sundown
118118
daytemp = $.weather.data.forecast_day[0].temp_low.value+"℃"+"-"+$.weather.data.forecast_day[0].temp_high.value+"℃"
119119
$.desc = " 当天温度: "+daytemp+" 当前温度🌡:"+nowtemp+"\n "+nowweather +icon+" 风速🌪:"+ nowwindval + "\n 空气质量🌬:"+aqidesc+" 湿度☔️:"+nowhum+"\n 日出时间:"+sunrise+"\n 日落时间:"+sundown+"\n"
120-
$.desc += !daylys ? "【每周天气】\n":""
121-
120+
if(daylys== 'true'){
121+
$.desc += "【每周天气】\n"
122+
}
122123
for ( Dayweather of $.weather.data.forecast_day){
123124
date = Dayweather.predict_date+ " " +Dayweather.predict_week // 日期
124125
Daysweather = Dayweather.weather_desc_day //当日天气
125126
Winds = Dayweather.wind_desc_day.winddir+Dayweather.wind_desc_day.value+ Dayweather.wind_desc_day.unit //当日风速
126127
temps = Dayweather.temp_low.value+Dayweather.temp_low.unit+"至"+Dayweather.temp_high.value+Dayweather.temp_high.unit //当日温度
127-
//console.log(reduction)
128-
!reduction ? $.log(" "+ date+" "+Daysweather+" "+ temps+" "+Winds):""
129-
$.desc += !daylys ? " "+date+" "+Daysweather+" "+ temps+" "+Winds+"\n":""
128+
if(reduction== 'true') {$.log(" "+ date+" "+Daysweather+" "+ temps+" "+Winds)
129+
}
130+
if(daylys== 'true'){
131+
$.desc += " "+date+" "+Daysweather+" "+ temps+" "+Winds+"\n"
132+
}
130133
};
131-
$.desc += hourlys ? "【小时预报】\n":""
134+
if(hourlys == 'true'){
135+
$.desc += "【小时预报】\n"
136+
}
132137
for ( Hourlyweather of $.weather.data.hourly){
133138
hours = Hourlyweather.temperature.hour
134139
hourweather = Hourlyweather.temperature.condition
135140
hourWinds = Hourlyweather.wind.wind_desc.winddir+Hourlyweather.wind.wind_desc.value+ Hourlyweather.wind.wind_desc.unit
136141
hourtemps = Hourlyweather.temperature.temp.value+Hourlyweather.temperature.temp.unit
137-
$.desc += hourlys ? " "+hours+":00 "+hourweather+" "+ hourtemps+" "+hourWinds +"\n":""
138-
!reduction ? $.log(" "+hours+":00 "+hourweather+" "+ hourtemps+" "+hourWinds):""
139-
142+
143+
if(hourlys == 'true'){
144+
$.desc += " "+hours+":00 "+hourweather+" "+ hourtemps+" "+hourWinds +"\n"
145+
}
146+
if(reduction == 'true') {
147+
$.log(" "+hours+":00 "+hourweather+" "+ hourtemps+" "+hourWinds)
148+
}
140149
}
141150
if ($.index.code == 0){
142151
$.desc += !indexs ? "【生活指数】\n":""
@@ -146,7 +155,8 @@ for ( Hourlyweather of $.weather.data.hourly){
146155
indexLevelDesc =indexdata.indexLevelDesc
147156
indexDesc = indexdata.indexDesc
148157
$.desc += !indexs ? " "+indexType+": "+indexLevel+"级 "+ indexLevelDesc+"\n":""
149-
!reduction ? console.log("\n "+indexType+" "+indexLevel+"级 "+ indexLevelDesc+"\n"+indexDesc ):"";
158+
if(reduction == 'true'){ console.log("\n "+indexType+" "+indexLevel+"级 "+ indexLevelDesc+"\n"+indexDesc )
159+
}
150160
}
151161
}
152162
$.sub = "【今日天气】"

0 commit comments

Comments
 (0)