fix(route): 华尔街见闻实时快讯图片 (#10925)

This commit is contained in:
Ethan Shen
2022-09-28 00:09:13 +00:00
committed by GitHub
parent a1faf40098
commit b0216ca3de
2 changed files with 18 additions and 1 deletions
+7 -1
View File
@@ -1,5 +1,7 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
const { art } = require('@/utils/render');
const path = require('path');
const titles = {
global: '要闻',
@@ -30,9 +32,13 @@ module.exports = async (ctx) => {
.map((item) => ({
link: item.uri,
title: item.title || item.content_text,
description: item.content + (item.content_more ?? ''),
pubDate: parseDate(item.display_time * 1000),
author: item.author?.display_name ?? '',
description: art(path.join(__dirname, 'templates/description.art'), {
description: item.content,
more: item.content_more,
images: item.images,
}),
}));
ctx.state.data = {
@@ -0,0 +1,11 @@
{{ if description }}
{{@ description }}
{{ /if }}
{{ if more }}
{{@ more }}
{{ /if }}
{{ if images }}
{{ each images image }}
<img src="{{ image.uri }}" width="{{ image.width }}" height="{{ image.height }}">
{{ /each }}
{{ /if }}