chore: format

This commit is contained in:
DIYgod 2019-11-11 12:17:50 +08:00
parent 77c5ce4571
commit 79f68e5254
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
2 changed files with 13 additions and 8 deletions

View File

@ -40,13 +40,15 @@ module.exports = async (ctx) => {
let list;
if (id !== '1934') {
// 非社区的数据处理多了callback需要截取
const response = (await got({
method: 'get',
url: apiUrl + id,
headers: {
Referer: refererUrl,
},
})).data.trim();
const response = (
await got({
method: 'get',
url: apiUrl + id,
headers: {
Referer: refererUrl,
},
})
).data.trim();
try {
const jsonString = response.slice(9, -2);
list = JSON.parse(jsonString).data.result;

View File

@ -1,6 +1,9 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const map = new Map([['1', { name: '今日推荐' }], ['2', { name: '精选' }]]);
const map = new Map([
['1', { name: '今日推荐' }],
['2', { name: '精选' }],
]);
module.exports = async (ctx) => {
const typeid = ctx.params.typeid || '2';
const OutName = map.get(typeid).name;