optimize directory structure

This commit is contained in:
DIYgod
2018-12-26 18:35:10 +08:00
parent c68251e461
commit 38a90e29b0
475 changed files with 52 additions and 52 deletions

View File

@@ -0,0 +1,49 @@
const axios = require('../../../utils/axios');
module.exports = async (ctx) => {
const platform = ctx.params.platform;
const APIUrl = `https://bugly.qq.com/v2/changeLog?pid=${platform}&type=1`;
let webUrl = '';
if (platform === '1') {
webUrl = 'https://bugly.qq.com/docs/release-notes/release-android-bugly/';
} else if (platform === '2') {
webUrl = 'https://bugly.qq.com/docs/release-notes/release-ios-bugly/';
}
let title = '';
if (platform === '1') {
title = '腾讯 Bugly Android SDK 更新日志';
} else if (platform === '2') {
title = '腾讯 Bugly iOS SDK 更新日志';
}
const res = await axios({
method: 'get',
url: APIUrl,
headers: {
Referer: webUrl,
},
});
const resultItem = res.data.ret.versionList.map(function(changelog) {
const item = {};
item.title = changelog.version + ' ' + changelog.createTime;
let itemDesc = '';
changelog.description.desc.forEach(function(desc) {
itemDesc += desc;
itemDesc += '\n';
});
item.description = itemDesc;
item.guid = changelog.version + changelog.createTime;
item.link = webUrl;
return item;
});
ctx.state.data = {
title: title,
link: webUrl,
item: resultItem,
};
};