mirror of
https://github.com/KOP-XIAO/QuantumultX.git
synced 2026-01-25 21:25:09 +00:00
Update weather.js
This commit is contained in:
27
weather.js
27
weather.js
@@ -1,21 +1,16 @@
|
|||||||
const weaapi = "https://www.tianqiapi.com/api/?version=v6"
|
const weaapi = "https://www.tianqiapi.com/api/?version=v6"
|
||||||
|
$request.url(weaapi);
|
||||||
|
|
||||||
$httpClient.get(weaapi, function(error, response, data){
|
var body = $response.body;
|
||||||
if (error){
|
var obj = JSON.parse(body);
|
||||||
console.log(error);
|
|
||||||
$done();
|
var city = "所在城市: " + obj.city;
|
||||||
} else {
|
var wea = "天气状况: " + obj.wea + " 当前" + obj.tem + "℃ " + obj.tem2 + "℃~" + obj.tem1 + "℃";
|
||||||
var obj = JSON.parse(data);
|
var air = "当前风力: " + obj.win + obj.win_speed + " 风速" + obj.win_meter + "\n空气指数: " + obj.air + " " + obj.air_level + "\n友情提示: " + obj.air_tips + "\n更新时间: " + obj.date + " "+ obj.update_time;
|
||||||
console.log(obj);
|
let wmation = [city,wea,air];
|
||||||
var city = "所在城市: " + obj.city;
|
$notify("Weather Situation:", wmation[0]+ wmation[1]+ wmation[2]);
|
||||||
var wea = "天气状况: " + obj.wea + " 当前" + obj.tem + "℃ " + obj.tem2 + "℃~" + obj.tem1 + "℃";
|
|
||||||
var air = "当前风力: " + obj.win + obj.win_speed + " 风速" + obj.win_meter + "\n空气指数: " + obj.air + " " + obj.air_level + "\n友情提示: " + obj.air_tips + "\n更新时间: " + obj.date + " "+ obj.update_time;
|
$done(body);
|
||||||
let wmation = [city,wea,air];
|
|
||||||
$notify("Weather Situation:", wmation[0]+ wmation[1]+ wmation[2]);
|
|
||||||
$done();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user