天气查询
其他 官方文档
获取昨天,今后5天的天气情况,以及本日的穿衣指数,化妆指数,感冒指数,洗车指数,运动指数,运动指数,紫外线强度指数等
基本说明:
接口地址:http://aider.meizu.com/app/weather/listWeather
返回格式:json
请求方式:get/post
请求示例:http://aider.meizu.com/app/weather/listWeather?cityIds=101240101
请求参数说明:
名称 类型 必填 说明
cityIds string 必填 城市的id详情
返回参数说明:
名称 类型 说明
- - 见json
JSON返回示例:
{
	"code": "200",
	"message": "",
	"redirect": "",
	"value": [{
		"alarms": [],
		"city": "南昌",
		"cityid": 101240101,
		"indexes": [{
			"abbreviation": "ct",
			"alias": "",
			"content": "预计今日天气炎热,建议穿着薄款,透气的衣物。推荐:T恤、裙装、短裤等。",
			"level": "半袖",
			"name": "穿衣指数"
		}, {
			"abbreviation": "pp",
			"alias": "",
			"content": "预计今日湿度较高,油性皮肤注意,要做控油措施。",
			"level": "防出油",
			"name": "化妆指数"
		}, {
			"abbreviation": "gm",
			"alias": "",
			"content": "感冒高发期,尽量避免外出,外出戴口罩防护。",
			"level": "高发",
			"name": "感冒指数"
		}, {
			"abbreviation": "xc",
			"alias": "",
			"content": "预计今日不宜洗车,未来24小时可能有雨或风力较大,如果在此期间洗车,雨水或灰尘可能会再次弄脏您的爱车。",
			"level": "不适宜",
			"name": "洗车指数"
		}, {
			"abbreviation": "yd",
			"alias": "",
			"content": "预计今日整体气象条件较差,不适宜户外锻炼,建议居家运动。",
			"level": "很不适宜",
			"name": "运动指数"
		}, {
			"abbreviation": "uv",
			"alias": "",
			"content": "属弱紫外线辐射天气,无需特别防护。若长期在户外,建议涂擦SPF 在8-12 之间的防晒护肤品。",
			"level": "最弱",
			"name": "紫外线强度指数"
		}],
		"pm25": {
			"advice": "0",
			"aqi": "65",
			"citycount": 399,
			"cityrank": 4,
			"co": "0.9",
			"color": "0",
			"level": "0",
			"no2": "4",
			"o3": "33",
			"pm10": "80",
			"pm25": "41",
			"quality": "良",
			"so2": "5",
			"timestamp": "",
			"upDateTime": "2021-06-18 09:05:05"
		},
		"provinceName": "江西省",
		"realtime": {
			"img": "2",
			"sD": "86",
			"sendibleTemp": "34",
			"temp": "29",
			"time": "2021-06-18 09:07:01",
			"wD": "西风",
			"wS": "1级",
			"weather": "阴",
			"ziwaixian": "N/A"
		},
		"weatherDetailsInfo": {
			"publishTime": "2021-06-18 09:00:00",
			"weather3HoursDetailsInfos": [{
				"endTime": "2021-06-18 13:00:00",
				"highestTemperature": "29",
				"img": "2",
				"isRainFall": "",
				"lowerestTemperature": "29",
				"precipitation": "0",
				"startTime": "2021-06-18 10:00:00",
				"wd": "",
				"weather": "阴",
				"ws": ""
			}, {
				"endTime": "2021-06-18 16:00:00",
				"highestTemperature": "29",
				"img": "2",
				"isRainFall": "",
				"lowerestTemperature": "29",
				"precipitation": "0",
				"startTime": "2021-06-18 13:00:00",
				"wd": "",
				"weather": "阴",
				"ws": ""
			}, {
				"endTime": "2021-06-18 19:00:00",
				"highestTemperature": "28",
				"img": "2",
				"isRainFall": "",
				"lowerestTemperature": "28",
				"precipitation": "0",
				"startTime": "2021-06-18 16:00:00",
				"wd": "",
				"weather": "阴",
				"ws": ""
			}, {
				"endTime": "2021-06-18 22:00:00",
				"highestTemperature": "27",
				"img": "2",
				"isRainFall": "",
				"lowerestTemperature": "27",
				"precipitation": "0",
				"startTime": "2021-06-18 19:00:00",
				"wd": "",
				"weather": "阴",
				"ws": ""
			}, {
				"endTime": "2021-06-19 01:00:00",
				"highestTemperature": "26",
				"img": "2",
				"isRainFall": "",
				"lowerestTemperature": "26",
				"precipitation": "0",
				"startTime": "2021-06-18 22:00:00",
				"wd": "",
				"weather": "阴",
				"ws": ""
			}, {
				"endTime": "2021-06-19 04:00:00",
				"highestTemperature": "25",
				"img": "2",
				"isRainFall": "",
				"lowerestTemperature": "25",
				"precipitation": "0",
				"startTime": "2021-06-19 01:00:00",
				"wd": "",
				"weather": "阴",
				"ws": ""
			}, {
				"endTime": "2021-06-19 07:00:00",
				"highestTemperature": "26",
				"img": "2",
				"isRainFall": "",
				"lowerestTemperature": "26",
				"precipitation": "0",
				"startTime": "2021-06-19 04:00:00",
				"wd": "",
				"weather": "阴",
				"ws": ""
			}]
		},
		"weathers": [{
			"date": "2021-06-18",
			"img": "4",
			"sun_down_time": "19:17",
			"sun_rise_time": "05:19",
			"temp_day_c": "33",
			"temp_day_f": "91.4",
			"temp_night_c": "25",
			"temp_night_f": "77.0",
			"wd": "",
			"weather": "雷阵雨",
			"week": "星期五",
			"ws": ""
		}, {
			"date": "2021-06-19",
			"img": "9",
			"sun_down_time": "19:17",
			"sun_rise_time": "05:19",
			"temp_day_c": "29",
			"temp_day_f": "84.2",
			"temp_night_c": "24",
			"temp_night_f": "75.2",
			"wd": "",
			"weather": "大雨",
			"week": "星期六",
			"ws": ""
		}, {
			"date": "2021-06-20",
			"img": "7",
			"sun_down_time": "19:17",
			"sun_rise_time": "05:19",
			"temp_day_c": "26",
			"temp_day_f": "78.8",
			"temp_night_c": "23",
			"temp_night_f": "73.4",
			"wd": "",
			"weather": "小雨",
			"week": "星期日",
			"ws": ""
		}, {
			"date": "2021-06-21",
			"img": "2",
			"sun_down_time": "19:17",
			"sun_rise_time": "05:19",
			"temp_day_c": "27",
			"temp_day_f": "80.6",
			"temp_night_c": "23",
			"temp_night_f": "73.4",
			"wd": "",
			"weather": "阴",
			"week": "星期一",
			"ws": ""
		}, {
			"date": "2021-06-22",
			"img": "0",
			"sun_down_time": "19:17",
			"sun_rise_time": "05:19",
			"temp_day_c": "30",
			"temp_day_f": "86.0",
			"temp_night_c": "21",
			"temp_night_f": "69.8",
			"wd": "",
			"weather": "晴",
			"week": "星期二",
			"ws": ""
		}, {
			"date": "2021-06-23",
			"img": "0",
			"sun_down_time": "19:17",
			"sun_rise_time": "05:19",
			"temp_day_c": "31",
			"temp_day_f": "87.8",
			"temp_night_c": "23",
			"temp_night_f": "73.4",
			"wd": "",
			"weather": "晴",
			"week": "星期三",
			"ws": ""
		}, {
			"date": "2021-06-17",
			"img": "7",
			"sun_down_time": "19:17",
			"sun_rise_time": "05:19",
			"temp_day_c": "35",
			"temp_day_f": "95.0",
			"temp_night_c": "27",
			"temp_night_f": "80.6",
			"wd": "",
			"weather": "小雨",
			"week": "星期四",
			"ws": ""
		}]
	}]
}
服务级错误码参照
错误码 说明
500 系统繁忙
完整教学代码示例
<?php
/**
 * Created by PhpStorm.
 * User: FZS
 * Time: 2021/07/03 19:26
 */
class freeApi
{
    private $apiUrl;

    public function __construct()
    {
        $this->apiUrl = 'http://aider.meizu.com/app/weather/listWeather?cityIds=101240101';
    }

    /**
     * 获取结果
     * @return array
     */
    public function getResult()
    {
        return file_get_contents($this->apiUrl);
    }
}
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

const (
	APIURL   = "http://aider.meizu.com/app/weather/listWeather?cityIds=101240101"
)

func main() {
	queryUrl := fmt.Sprintf("%s",APIURL)
	resp, err := http.Get(queryUrl)
	if err != nil {
		log.Println(err)
		return
	}

	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)

	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println(string(body))
}