diff --git a/docs/picture.md b/docs/picture.md index 34c6da015a..f21e31ca78 100644 --- a/docs/picture.md +++ b/docs/picture.md @@ -151,3 +151,9 @@ pageClass: routes ### 主题 + +## Bing 壁纸 + +### 每日壁纸 + + diff --git a/lib/router.js b/lib/router.js index 9ca43f9513..23da5298b1 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1316,6 +1316,9 @@ router.get('/enclavebooks/category/:id?', require('./routes/enclavebooks/categor router.get('/dsndsht23/:subforumid', require('./routes/dsndsht23/index')); router.get('/dsndsht23', require('./routes/dsndsht23/index')); +// Bing壁纸 +router.get('/bing', require('./routes/bing/index')); + // MaxNews - DotA 2 router.get('/maxnews/dota2', require('./routes/maxnews/dota2')); diff --git a/lib/routes/bing/index.js b/lib/routes/bing/index.js new file mode 100644 index 0000000000..9940137cb6 --- /dev/null +++ b/lib/routes/bing/index.js @@ -0,0 +1,25 @@ +const axios = require('@/utils/axios'); + +module.exports = async (ctx) => { + const response = await axios({ + method: 'get', + baseURL: 'https://cn.bing.com', + url: '/HPImageArchive.aspx', + params: { + format: 'js', + idx: 0, + n: 7, + mkt: 'zh-CN', + }, + }); + const data = response.data; + ctx.state.data = { + title: 'Bing每日壁纸', + link: `https://cn.bing.com/`, + item: data.images.map((item) => ({ + title: item.copyright, + description: ``, + link: item.copyrightlink, + })), + }; +};