aqicn.org waqi.info的app版 微信公众账号版
- 支持按照地理位置推荐
- 支持早晨定时提醒和消息推送
- 支持发送朋友圈
- https://www.npmjs.com/package/aqicn 非官方 npm api
- http://aqicn.org/data-platform/register/
- http://aqicn.org/aqicn/json/android/beijing/json
- http://aqicn.org/faq/2015-07-28/air-quality-widget-new-improved-feed/
- http://feed.aqicn.org/feed/beijing/en/feed.v1.js
- 在虚拟机 CentOS6.4 中搭建 lavaral 的环境。
- 创建命令行工具,每小时定时 query 数据,
- 保存每小时数据,
- 根据 web 访问现状,目前考虑要到每半点,即 6:30,7:30 等类似时间再去 query 接口数据。怀疑目前接口计算需要时间。
根据 https://bitbucket.org/snippets/hatewx/MA5jz/--------
数据源:各地区环境监测中心,美国等使馆监测数据,自愿者使用指定设备上传的数据 访问限制:无 开放:非,网友自己找到,可能是他们自身APP使用的web api 费用:无 特点:数据准确,丰富,可靠,4小时更新一次,使用GeoNames city数据,查询可靠。在API稳定的情况下,可不搭建服务器。 API doc: http://aqicn.org/aqicn/json/android/beijing/json
http://www.geonames.org some demo http://www.geonames.org/maps/showOnMap?q=beijing&country=CN
主要是读到如下代码部分不是很顺畅,不是很了解 promise chain 的概念 
*** 涉及知识点 *** node.js react react-native CommonJS ES6 *** 学习到的关键词 ***
- ES6
- promise chain
- 浅谈Javascript中Promise对象的实现 https://segmentfault.com/a/1190000000684654
- Javascript Promise模式——相当酷的Callback Hell终结者 https://www.phodal.com/blog/javascript-promise/
- css box model: flex box 即 flex 布局 相关文章:
- Flex 布局教程:语法篇 http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html
- https://css-tricks.com/snippets/css/a-guide-to-flexbox/
- https://scotch.io/tutorials/a-visual-guide-to-css3-flexbox-properties
- https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Introduction_to_the_CSS_box_model
- https://developer.mozilla.org/en-US/docs/Web/CSS/display
- https://developer.mozilla.org/en-US/docs/Web/CSS/position
- https://developer.mozilla.org/en-US/docs/Web/CSS/float
- CommonJS
- react-native https://facebook.github.io/react-native/docs/tutorial.html#content
- ES6 http://es6.ruanyifeng.com/#docs/destructuring
初步了解了相关概念,之前欠缺的前端的概念差很多。最近也听了两期「内核恐慌」的博客关于 React 相关的主题。感觉欠缺的还是很多的,而且,前端相关的知识迭代速度非常快。需要不断 update。
下一步,在补充相关前端知识的基础上,晚上对前端工具链的了解。
-
lavarel 搭建框架
-
调用底层代码定时 curl 获取 json 数据
- 现有JSON 数据格式:
-
存储到数据库中。
- 数据库表设计:
接口访问时间:2016-03-26 21:34:57 接口对应实时数据界面展示:
接口数据:
{
"aqi": 34, // 最新时刻 PM2.5指标(最新更新时间:下面 time 值)
"time": 1458993600, // 2016/3/26 20:00:00 ?? 为什么差一个小时
"uhour": "21", // 小时
"utime": "Sat 21:00", // 时间
"utimecn": "星期六21:00", // 中国时间
"utimejp": "土曜日21:00", // 日本时间
"info": "(on Sat 21:00)Temp:15C", // 目前天气情况预测值
"infocn": "(星期六21:00)温度:15C",
"infojp": "(土曜日21:00)温度:15C",
"historic": { // 历史数据:数据均为每小时1条,按照当前时间倒序排序
"PM2.5": [
34,
61,
46,
59,
46,
61,
42,
55,
46,
50,
57,
42,
57,
50,
42,
50,
38,
42,
42,
57,
114,
122,
124,
117,
112,
70,
61,
78,
74,
55,
72,
63,
63,
57,
57,
59,
63,
85,
142,
142,
114,
80,
55,
57,
61,
63,
87,
89,
89,
89
],
"PM10": {
"1": 30,
"2": 39,
"3": 30,
"4": 25,
"5": 29,
"6": 24,
"7": 21,
"8": 23,
"9": 26,
"10": 34,
"11": 51,
"12": 41,
"13": 29,
"14": 27,
"15": 20,
"16": 18,
"17": 16,
"18": 17,
"19": 18,
"20": 42,
"21": 61,
"22": 66,
"23": 56,
"24": 54,
"25": 53,
"26": 30,
"27": 20,
"28": 35,
"29": 16,
"31": 20,
"32": 20,
"33": 20,
"34": 24,
"35": 32,
"36": 31,
"37": 27,
"38": 73,
"39": 87,
"40": 75,
"41": 34,
"42": 20,
"43": 31,
"44": 29,
"45": 36,
"46": 48,
"47": 55,
"48": 50,
"49": 42
},
"so2": {
"1": 2,
"2": 2,
"3": 2,
"4": 2,
"5": 2,
"6": 2,
"7": 3,
"8": 3,
"9": 3,
"10": 3,
"11": 3,
"12": 4,
"13": 3,
"14": 3,
"15": 2,
"16": 2,
"17": 2,
"18": 2,
"19": 2,
"20": 3,
"21": 4,
"22": 6,
"23": 4,
"24": 3,
"25": 3,
"26": 2,
"27": 2,
"28": 2,
"29": 2,
"30": 2,
"31": 3,
"32": 3,
"33": 3,
"34": 4,
"35": 3,
"36": 2,
"37": 4,
"38": 11,
"39": 14,
"40": 9,
"41": 3,
"42": 2,
"43": 2,
"44": 3,
"45": 3,
"46": 3,
"47": 4,
"48": 3,
"49": 3
},
"no2": {
"1": 19,
"2": 15,
"3": 11,
"4": 8,
"5": 6,
"6": 7,
"7": 7,
"8": 8,
"9": 7,
"10": 8,
"11": 9,
"12": 12,
"13": 17,
"14": 16,
"15": 13,
"16": 14,
"17": 17,
"18": 22,
"19": 22,
"20": 42,
"21": 47,
"22": 43,
"23": 34,
"24": 28,
"25": 24,
"26": 15,
"27": 9,
"28": 9,
"29": 5,
"31": 7,
"32": 8,
"33": 8,
"34": 9,
"35": 14,
"36": 19,
"37": 28,
"38": 38,
"39": 39,
"40": 38,
"41": 33,
"42": 28,
"43": 24,
"44": 27,
"45": 32,
"46": 31,
"47": 38,
"48": 27,
"49": 30
},
"co": {
"1": 3,
"2": 3,
"3": 3,
"4": 2,
"5": 2,
"6": 3,
"7": 3,
"8": 3,
"9": 3,
"10": 3,
"11": 3,
"12": 4,
"13": 4,
"14": 4,
"15": 3,
"16": 3,
"17": 3,
"18": 3,
"19": 4,
"20": 6,
"21": 6,
"22": 6,
"23": 6,
"24": 6,
"25": 5,
"26": 5,
"27": 4,
"29": 3,
"30": 3,
"31": 3,
"32": 1,
"33": 2,
"34": 4,
"35": 4,
"36": 5,
"37": 5,
"38": 13,
"39": 15,
"40": 9,
"41": 4,
"42": 4,
"43": 4,
"44": 5,
"45": 4,
"46": 5,
"47": 5,
"48": 5,
"49": 5
},
"O3": {
"1": 24,
"2": 33,
"3": 39,
"4": 42,
"5": 41,
"6": 42,
"7": 39,
"8": 38,
"9": 36,
"10": 34,
"11": 31,
"12": 27,
"13": 21,
"14": 21,
"15": 25,
"16": 24,
"17": 23,
"18": 16,
"19": 17,
"20": 16,
"21": 5,
"22": 10,
"23": 16,
"24": 22,
"25": 25,
"26": 31,
"27": 38,
"28": 39,
"29": 39,
"30": 43,
"31": 39,
"32": 34,
"33": 33,
"34": 32,
"35": 25,
"36": 19,
"37": 15,
"38": 4,
"39": 2,
"40": 4,
"41": 17,
"42": 16,
"43": 14,
"44": 15,
"45": 22,
"46": 19,
"47": 11,
"48": 22,
"49": 27
},
"t": { // 温度
"1": 15,
"2": 17,
"3": 17,
"4": 19,
"5": 20,
"6": 20,
"7": 19,
"8": 18,
"9": 17,
"10": 17,
"11": 15,
"12": 13,
"13": 12,
"14": 10,
"15": 3,
"16": 6,
"17": 4,
"18": 4,
"19": 5,
"20": 6,
"21": 5,
"22": 10,
"23": 12,
"24": 12,
"25": 8,
"26": 9,
"27": 12,
"28": 14,
"29": 15,
"30": 14,
"31": 14,
"32": 14,
"33": 14,
"34": 13,
"35": 11,
"36": 10,
"37": 8,
"38": 6,
"39": -1,
"40": 0,
"41": 3,
"42": 4,
"43": 4,
"44": 5,
"45": 8,
"46": 10,
"47": 8,
"48": 11,
"49": 10
},
"h": { // 湿度
"1": 17,
"2": 15,
"3": 13,
"4": 11,
"5": 12,
"6": 13,
"7": 13,
"8": 14,
"9": 15,
"10": 15,
"11": 20,
"12": 21,
"13": 24,
"14": 26,
"15": 41,
"16": 34,
"17": 39,
"18": 42,
"19": 36,
"20": 31,
"21": 33,
"22": 22,
"23": 18,
"24": 19,
"25": 34,
"26": 25,
"27": 18,
"28": 16,
"29": 15,
"30": 16,
"31": 17,
"32": 16,
"33": 16,
"34": 19,
"35": 21,
"36": 24,
"37": 32,
"38": 39,
"39": 64,
"40": 65,
"41": 41,
"42": 39,
"43": 42,
"44": 31,
"45": 23,
"46": 20,
"47": 23,
"48": 19,
"49": 20
},
"w": { // 风速(当前4m/s 北北西)
"1": 4,
"2": 5,
"3": 2,
"4": 1,
"5": 3,
"6": 2,
"7": 2,
"8": 2,
"9": 4,
"10": 7,
"11": 5,
"12": 5,
"13": 4,
"14": 4,
"15": 3,
"16": 4,
"17": 3,
"18": 2,
"19": 2,
"20": 3,
"21": 3,
"22": 2,
"23": 4,
"24": 4,
"25": 1,
"26": 1,
"27": 1,
"28": 1,
"29": 2,
"30": 1,
"31": 2,
"32": 5,
"33": 2,
"34": 4,
"35": 5,
"36": 4,
"37": 3,
"38": 3,
"39": 2,
"40": 1,
"41": 1,
"42": 2,
"43": 1,
"44": 2,
"45": 3,
"46": 4,
"47": 3,
"48": 4,
"49": 2
}
},
"ctemp": 15, // 当前摄氏度
"cpres": 1022, // 空气压力 毫巴 mbar 也做 mb https://zh.wikipedia.org/wiki/%E5%B7%B4
"nameen": "Beijing", // 英文地理位置名称
"namena": "北京", // 中文名称
"cwind": [ // 风速和方向 330度 即 北 北偏西的角度
4,
330
],
"wgt": "http://wgt.aqicn.org/aqiwgt/20160326/2MzIwNDMwNjIzMtR3Ss3MysxLBwA.png", // 当前缩略图
"ids": {
"key": "_c0rNzMrMSwcA",
"path": "beijing",
"url": "Beijing"
},
"forecast": { // 预测的天气预报,还是26号的
"en": "2° – 20° – Sunny",
"cn": "2° – 20° – Sunny",
"jp": "2° – 20° – Sunny",
"kr": "2° – 20° – Sunny",
"hk": "2° – 20° – Sunny",
"fr": "2° – 20° – Sunny",
"es": "2° – 20° – Sunny"
},
"wf": "1458914400,20,21,279,67;
10800,41,42,337,66;
10800,51,51,338,57;
10800,35,38,343,89;
10800,50,58,349,144;
10800,7,36,123,177;
10800,15,25,114,178;
10800,10,10,230,99;
10800,41,42,336,108;10800,50,50,330,90;10800,47,47,342,79;10800,38,41,346,109;10800,20,25,317,170;10800,30,38,244,194;10800,49,64,233,198;10800,41,41,207,135;10800,27,27,207,108;10800,22,25,165,87;10800,12,15,121,64;10800,8,8,98,131;10800,27,41,253,188;10800,42,58,257,225;10800,57,69,269,224;10800,67,80,353,165;10800,60,72,349,138;10800,59,59,349,118;10800,45,45,348,100;10800,33,41,350,132;10800,44,65,321,169;10800,59,79,303,192;10800,54,76,332,188;10800,37,37,1,134;10800,37,37,28,111;10800,23,26,53,88;10800,11,12,119,65;10800,29,41,198,111;10800,57,70,175,165;10800,80,103,198,209;10800,91,117,209,215;10800,69,84,159,163;10800,60,60,147,134;10800,63,76,150,128;10800,54,54,135,108;10800,56,71,160,133;10800,65,78,181,174;10800,84,112,202,229;10800,98,127,198,242;10800,87,149,173,198;10800,69,112,175,177;10800,11,14,15,132;10800,66,84,352,150;10800,61,85,6,104;10800,49,62,19,131;10800,25,30,95,159;10800,47,47,160,136;10800,33,38,300,115;10800,101,129,7,78;10800,57,92,344,76;10800,51,71,336,43;10800,52,111,339,63;10800,74,104,338,115;10800,71,95,328,144;10800,63,96,313,144;10800,48,48,295,98;10800,39,39,280,78;10800,39,39,274,63;10800,30,31,305,46;10800,20,24,280,91;10800,48,53,234,147",
"nearest": [
{
"pol": "pm25",
"nlo": "Beijing",
"nna": "北京",
"key": "_c0rNzMrMSwcA",
"t": 1458997200,
"v": "34",
"u": "Beijing",
"g": [
"39.954592",
"116.468117"
],
"x": 1451
},
{
"pol": "pm25",
"nlo": "Beijing US Embassy",
"nna": "北京美国大使馆",
"key": "_c0rNzMrMS9cPDU7NTUosLq4EAA",
"t": 1458997200,
"v": "34",
"u": "Beijing/USembassy",
"g": [
"39.954592",
"116.468117"
],
"x": 3303
},
{
"pol": "pm25",
"nlo": "Chaoyang Agricultural Exhibition Hall",
"nna": "朝阳农展馆",
"key": "_c0rNzMrMS9d_Nmfuyxmbn7bNebpx6stlbQA",
"t": 1458997200,
"v": "30",
"u": "Beijing/%E6%9C%9D%E9%98%B3%E5%86%9C%E5%B1%95%E9%A6%86",
"g": [
"39.937",
"116.461"
],
"x": 451
},
{
"pol": "pm25",
"nlo": "East Fourth Ring Road",
"nna": "东四环北路",
"key": "_c0rNzMrMS9d_smPO09mzn_etf9oz_cX29QA",
"t": 1458997200,
"v": "50",
"u": "Beijing/%E4%B8%9C%E5%9B%9B%E7%8E%AF%E5%8C%97%E8%B7%AF",
"g": [
"39.939",
"116.483"
],
"x": 480
},
{
"pol": "pm25",
"nlo": "Dongcheng Dongsi",
"nna": "东城东四",
"key": "_c0rNzMrMS9d_smPO0_l9IHL2bAA",
"t": 1458997200,
"v": "42",
"u": "Beijing/%E4%B8%9C%E5%9F%8E%E4%B8%9C%E5%9B%9B",
"g": [
"39.929",
"116.417"
],
"x": 446
},
{
"pol": "pm25",
"nlo": "Chaoyang Olympic Sports Center",
"nna": "朝阳奥体中心",
"key": "_ARoA5f9CZWlqaW5nL-acnemYs-WlpeS9k-S4reW_gw",
"t": 1458993600,
"v": "50",
"u": "Beijing/%E6%9C%9D%E9%98%B3%E5%A5%A5%E4%BD%93%E4%B8%AD%E5%BF%83",
"g": [
"39.982",
"116.397"
],
"x": 450
},
{
"pol": "pm25",
"nlo": "Qianmen E St, Dongcheng",
"nna": "前门东大街",
"key": "_c0rNzMrMS9d_2tn7cvqKJzvmPF2y_MXC6QA",
"t": 1458997200,
"v": "50",
"u": "Beijing/%E5%89%8D%E9%97%A8%E4%B8%9C%E5%A4%A7%E8%A1%97",
"g": [
"39.899",
"116.395"
],
"x": 476
},
{
"pol": "pm25",
"nlo": "Temple of Heaven, Dongcheng",
"nna": "东城天坛",
"key": "_c0rNzMrMS9d_smPO0_l9T5esfDp3NgA",
"t": 1458997200,
"v": "53",
"u": "Beijing/%E4%B8%9C%E5%9F%8E%E5%A4%A9%E5%9D%9B",
"g": [
"39.886",
"116.407"
],
"x": 447
},
{
"pol": "pm25",
"nlo": "Xizhimen N St",
"nna": "西直门北大街",
"key": "_ARoA5f9CZWlqaW5nL-ilv-ebtOmXqOWMl-Wkp-ihlw",
"t": 1458993600,
"v": "74",
"u": "Beijing/%E8%A5%BF%E7%9B%B4%E9%97%A8%E5%8C%97%E5%A4%A7%E8%A1%97",
"g": [
"39.954",
"116.349"
],
"x": 478
},
{
"pol": "pm25",
"nlo": "Yongdingmen Inner St",
"nna": "永定门内大街",
"key": "_ARoA5f9CZWlqaW5nL-awuOWumumXqOWGheWkp-ihlw",
"t": 1458997200,
"v": "34",
"u": "Beijing/%E6%B0%B8%E5%AE%9A%E9%97%A8%E5%86%85%E5%A4%A7%E8%A1%97",
"g": [
"39.876",
"116.394"
],
"x": 477
},
{
"pol": "pm25",
"nlo": "West Park officials",
"nna": "西城官园",
"key": "_c0rNzMrMS9d_sXT_0_l9T9fNeDp7LQA",
"t": 1458997200,
"v": "50",
"u": "Beijing/%E8%A5%BF%E5%9F%8E%E5%AE%98%E5%9B%AD",
"g": [
"39.929",
"116.339"
],
"x": 448
},
{
"pol": "pm25",
"nlo": "Wanshou Temple",
"nna": "西城万寿西宫",
"key": "_c0rNzMrMS9d_sXT_0_l9T3a0P12_H8RetxoA",
"t": 1458993600,
"v": "61",
"u": "Beijing/%E8%A5%BF%E5%9F%8E%E4%B8%87%E5%AF%BF%E8%A5%BF%E5%AE%AB",
"g": [
"39.878",
"116.352"
],
"x": 449
},
{
"pol": "pm25",
"nlo": "South Ring Road",
"nna": "南三环西路",
"key": "_c0rNzMrMS9d_2jv9yY7O533rXyzd_2L7egA",
"t": 1458997200,
"v": "74",
"u": "Beijing/%E5%8D%97%E4%B8%89%E7%8E%AF%E8%A5%BF%E8%B7%AF",
"g": [
"39.856",
"116.368"
],
"x": 479
},
{
"pol": "pm25",
"nlo": "Haidian Wanliu",
"nna": "海淀万柳",
"key": "_c0rNzMrMS9d_tnX7s-0NT3a0P5u_GQA",
"t": 1458997200,
"v": "42",
"u": "Beijing/%E6%B5%B7%E6%B7%80%E4%B8%87%E6%9F%B3",
"g": [
"39.987",
"116.287"
],
"x": 452
},
{
"pol": "pm25",
"nlo": "BDA",
"nna": "亦庄开发区",
"key": "_c0rNzMrMS9d_smvZ010tT_c0PO2f-LRnFwA",
"t": 1458993600,
"v": "78",
"u": "Beijing/%E4%BA%A6%E5%BA%84%E5%BC%80%E5%8F%91%E5%8C%BA",
"g": [
"39.795",
"116.506"
],
"x": 460
},
{
"pol": "pm25",
"nlo": "Tongzhou New Town",
"nna": "通州新城",
"key": "_c0rNzMrMS9d_2TDr6fZ5z6ZteDq_DwA",
"t": 1458997200,
"v": "97",
"u": "Beijing/%E9%80%9A%E5%B7%9E%E6%96%B0%E5%9F%8E",
"g": [
"39.886",
"116.663"
],
"x": 461
},
{
"pol": "pm25",
"nlo": "Fengtai garden",
"nna": "丰台花园",
"key": "_c0rNzMrMS9d_smPD0_4NL7o2Pp29FgA",
"t": 1458997200,
"v": "65",
"u": "Beijing/%E4%B8%B0%E5%8F%B0%E8%8A%B1%E5%9B%AD",
"g": [
"39.863",
"116.279"
],
"x": 455
},
{
"pol": "pm25",
"nlo": "Haidian Beijing Botanical Garden",
"nna": "海淀北京植物园",
"key": "_AR0A4v9CZWlqaW5nL-a1t-a3gOWMl-S6rOakjeeJqeWbrQ",
"t": 1458997200,
"v": "33",
"u": "Beijing/%E6%B5%B7%E6%B7%80%E5%8C%97%E4%BA%AC%E6%A4%8D%E7%89%A9%E5%9B%AD",
"g": [
"40.002",
"116.207"
],
"x": 454
}
]
}