We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
按书籍中做了各种配置后,本地跑起来后报错,加载失败,请稍后再试
经排查,需要进入一下几步操作
client/project.config.json
appid
appid missing
server/cloud-functions/he-weather/index.js
const API_URL = 'https://free-api.heweather.net/s6/weather' const request = require('request') /*<jdists import="../../inline/utils.js" />*/ /*<remove>*/ const $ = require('../../inline/utils') /*</remove>*/ exports.main = async (event) => { const {lat,lon} = event let location = `${lat},${lon}` let params = { location, key: '-----------------' //替换为密钥 // t: Math.floor(Date.now() / 1e3), // unit: 'm' } // 生成签名 // params.sign = $.generateSignature(params) let query = [] for (let i in params) { query.push(`${i}=${encodeURIComponent(params[i])}`) } let url = API_URL + '?' + query.join('&') console.log(url) return new Promise((resolve, reject) => { request.get(url, (error, response, body) => { console.log(body) if (error || response.statusCode !== 200) { reject(error) } else { try { let rs = $.handlerData(JSON.parse(body)) console.log(rs) resolve(rs) } catch (e) { reject(e) } } }) }) }
The text was updated successfully, but these errors were encountered:
可以提交个pr啊~
Sorry, something went wrong.
No branches or pull requests
按书籍中做了各种配置后,本地跑起来后报错,加载失败,请稍后再试
经排查,需要进入一下几步操作
client/project.config.json
文件中需要添加appid
, 否则会报appid missing
的错误server/cloud-functions/he-weather/index.js
文件需要修改为如下。key替换为自己的密钥。否则会拿不到天气数据。因为和风天气的接口改了。
接口是https://www.heweather.com/documents/api/s6/weather-all。
返回的数据结构和以前一样。
The text was updated successfully, but these errors were encountered: