Update route.ts

This commit is contained in:
Vaica committed 2026-06-22 13:08:34 +08:00
1 parent 8cd35ca127
commit e36c99476a
1 file changed
+18 -8
+18 -8
View File
@@ -118,14 +118,24 @@ export async function POST(request: NextRequest) {
const rawContent = (a.content as string) || "";
const { html, imageUrls } = mdToWechatHtml(rawContent, slug);
const result: Record<string, unknown> = {
title: a.title,
author: a.author,
const result: {
title: string;
author: string;
content: string;
content_source_url?: string;
thumb_media_url?: string;
thumb_media_id?: string;
show_cover_pic: number;
need_open_comment: number;
content_image_urls?: { original_url: string }[];
} = {
title: String(a.title || ""),
author: String(a.author || ""),
content: html,
content_source_url: a.content_source_url,
thumb_media_url: a.thumb_media_url,
show_cover_pic: a.show_cover_pic ?? 1,
need_open_comment: a.need_open_comment ?? 0,
content_source_url: a.content_source_url as string | undefined,
thumb_media_url: a.thumb_media_url as string | undefined,
show_cover_pic: (a.show_cover_pic as number) ?? 1,
need_open_comment: (a.need_open_comment as number) ?? 0,
};
if (imageUrls.length > 0) {
@@ -135,7 +145,7 @@ export async function POST(request: NextRequest) {
return result;
});
const result = await syncWechat(processedArticles);
const result = await syncWechat(processedArticles as any);
return NextResponse.json(result);
} catch (error: unknown) {
const msg = error instanceof Error ? error.message : "Unknown error";