[天气API]实时降水、降雨量接口对接,预报未来2小时有没有下雨
接口请求地址: http://ykyrain.tianqiapi.com
请求参数
参数名 | 必选 | 类型 | 说明 | 备注(示例) |
---|---|---|---|---|
appid | 是 | string | 用户appid | 先注册开发账号 |
appsecret | 是 | string | 用户appsecret | |
version | 是 | string | 接口标识 | 固定值: rain |
lng | 是 | string | 经度 | 如: 119.545023 |
lat | 是 | string | 纬度 | 如: 36.044254 |
响应JSON
{
"errcode": 0,
"time": "2024-04-30 06:35:00",
"update_time": "2024-04-30 06:30:00",
"msg": "雨渐大,80分钟转为中雨",
"data": [
{
"time": "2024-04-30 06:45:00",
"level": "小雨",
"value": "0.15"
},
{
"time": "2024-04-30 06:50:00",
"level": "小雨",
"value": "0.09"
},
{
"time": "2024-04-30 06:55:00",
"level": "小雨",
"value": "0.07"
},
{
"time": "2024-04-30 07:00:00",
"level": "小雨",
"value": "0.09"
},
{
"time": "2024-04-30 07:05:00",
"level": "小雨",
"value": "0.12"
},
{
"time": "2024-04-30 07:10:00",
"level": "小雨",
"value": "0.15"
},
{
"time": "2024-04-30 07:15:00",
"level": "小雨",
"value": "0.17"
},
{
"time": "2024-04-30 07:20:00",
"level": "小雨",
"value": "0.18"
},
{
"time": "2024-04-30 07:25:00",
"level": "小雨",
"value": "0.18"
},
{
"time": "2024-04-30 07:30:00",
"level": "小雨",
"value": "0.16"
},
{
"time": "2024-04-30 07:35:00",
"level": "小雨",
"value": "0.09"
},
{
"time": "2024-04-30 07:40:00",
"level": "小雨",
"value": "0.05"
},
{
"time": "2024-04-30 07:45:00",
"level": "小雨",
"value": "0.03"
},
{
"time": "2024-04-30 07:50:00",
"level": "小雨",
"value": "0.05"
},
{
"time": "2024-04-30 07:55:00",
"level": "小雨",
"value": "0.07"
},
{
"time": "2024-04-30 08:00:00",
"level": "小雨",
"value": "0.12"
},
{
"time": "2024-04-30 08:05:00",
"level": "小雨",
"value": "0.2"
},
{
"time": "2024-04-30 08:10:00",
"level": "中雨",
"value": "0.27"
},
{
"time": "2024-04-30 08:15:00",
"level": "中雨",
"value": "0.29"
},
{
"time": "2024-04-30 08:20:00",
"level": "中雨",
"value": "0.3"
},
{
"time": "2024-04-30 08:25:00",
"level": "中雨",
"value": "0.25"
}
]
}
tips:接口需要注册自己的账号, 测试后开通接口权限
接口官方文档 http://tianqiapi.com/index/doc?version=v11
天气API获取未来30天气预报 | 中国天气网
该接口2小时更新一次,返回最近40日天气, 包含每日日期、农历日期、星期几、天气情况、白天天气、夜间天气、高温低温、日出日落时间、空气质量等,可按地名、城市编号、LBS、IP查询。
天气API接口获取气象台最新发布的气象预警数据 灾害预警接口
使用天气api接口获取济南地区或整个山东地区的所有城市气象灾害预警信息
thinkphp如何关闭 未定义数组索引 提示
打开application目录下的 common.php, 在顶部增加error_reporting(1^2);
微信小程序返回上一页代码 wx.navigateBack
有上一页的情况下正常返回上一页, 通过分享进入的, 返回到小程序首页
参考代码:
微信小程序预览图片代码 wx.previewImage
preview(event) {
var _this = this;
console.log(event.currentTarget.dataset.src)
let currentUrl = event.currentTarget.dataset.src
wx.previewImage({
current: currentUrl, // 当前显示图片的http链接
urls: _this.data.imglist// 需要预览的图片http链接列表, 如只预览当前图片, 赋值 [currentUrl]
})
},
微信小程序拨打电话代码 wx.makePhoneCall
callPhone() {
wx.makePhoneCall({
phoneNumber: '400-0088-888' //仅为示例,并非真实的电话号码
})
},
微信小程序复制到剪切板代码 setClipboardData,getClipboardData
copyweixin(){
wx.setClipboardData({
data: '15562679693',
success (res) {
wx.getClipboardData({
success (res) {
console.log(res.data) // data
}
})
}
})
}
Redis内存溢出 OOM command not allowed when used memory > ‘maxmemory‘
修改/usr/local/redis/etc/redis.conf
maxmemory 1GB
maxmemory-policy volatile-random
Redis的maxmemory_policy内存淘汰策略:
1、volatile-lru:只对设置了过期时间的key进行LRU(默认值)
2、allkeys-lru : 删除lru算法的key
3、volatile-random:随机删除即将过期key
4、allkeys-random:随机删除
5、volatile-ttl : 删除即将过期的
6、noeviction : 永不过期,返回错误