From b7ad89b26931a094a73de36bedf9d5ee3f2bb608 Mon Sep 17 00:00:00 2001 From: jingrow Date: Tue, 15 Jul 2025 02:05:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=80=E4=BA=9B=E5=86=97?= =?UTF-8?q?=E4=BD=99=E7=9A=84api=E6=8E=A5=E5=8F=A3=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/auth.js | 10 ---------- app/api/get-category/route.js | 26 -------------------------- app/api/get-detailview-data/route.js | 26 -------------------------- app/api/get-listview-data/route.js | 27 --------------------------- app/api/get-site-settings/route.js | 20 -------------------- 5 files changed, 109 deletions(-) delete mode 100644 app/api/auth.js delete mode 100644 app/api/get-category/route.js delete mode 100644 app/api/get-detailview-data/route.js delete mode 100644 app/api/get-listview-data/route.js delete mode 100644 app/api/get-site-settings/route.js diff --git a/app/api/auth.js b/app/api/auth.js deleted file mode 100644 index 3efdf34..0000000 --- a/app/api/auth.js +++ /dev/null @@ -1,10 +0,0 @@ -// 获取Jingrow API认证头部(通用方法) -export function get_jingrow_api_headers() { - // 这里应根据实际情况实现获取token等逻辑 - const apiKey = process.env.JINGROW_API_KEY; - const apiSecret = process.env.JINGROW_API_SECRET; - return { - 'Authorization': `token ${apiKey}:${apiSecret}`, - 'Content-Type': 'application/json' - }; -} \ No newline at end of file diff --git a/app/api/get-category/route.js b/app/api/get-category/route.js deleted file mode 100644 index 41abd85..0000000 --- a/app/api/get-category/route.js +++ /dev/null @@ -1,26 +0,0 @@ -import axios from 'axios'; - -const JINGROW_SERVER_URL = process.env.JINGROW_SERVER_URL; -const JINGROW_SITE_NAME = process.env.JINGROW_SITE_NAME; - -export async function GET(request) { - try { - const { searchParams } = new URL(request.url); - const pagetype = searchParams.get('pagetype'); - const name = searchParams.get('name'); - if (!pagetype || !name) { - return Response.json({ error: 'Missing pagetype or name parameter' }, { status: 400 }); - } - - const response = await axios.get( - `${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_category`, - { params: { pagetype, name, site_name: JINGROW_SITE_NAME } } - ); - return Response.json(response.data, { status: response.status }); - } catch (error) { - return Response.json( - { error: error.message, detail: error?.response?.data || null }, - { status: 500 } - ); - } -} diff --git a/app/api/get-detailview-data/route.js b/app/api/get-detailview-data/route.js deleted file mode 100644 index b75da31..0000000 --- a/app/api/get-detailview-data/route.js +++ /dev/null @@ -1,26 +0,0 @@ -import axios from 'axios'; - -const JINGROW_SERVER_URL = process.env.JINGROW_SERVER_URL; -const JINGROW_SITE_NAME = process.env.JINGROW_SITE_NAME; - -export async function GET(request) { - try { - const { searchParams } = new URL(request.url); - const pagetype = searchParams.get('pagetype'); - const slug = searchParams.get('slug'); - if (!pagetype || !slug) { - return Response.json({ error: '缺少pagetype或slug参数' }, { status: 400 }); - } - const response = await axios.get( - `${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_detailview_data`, - { params: { pagetype, slug, site_name: JINGROW_SITE_NAME } } - ); - const data = response.data.message?.data || {}; - return Response.json({ data }); - } catch (error) { - return Response.json( - { error: error.message, detail: error?.response?.data || null }, - { status: 500 } - ); - } -} diff --git a/app/api/get-listview-data/route.js b/app/api/get-listview-data/route.js deleted file mode 100644 index c08d05e..0000000 --- a/app/api/get-listview-data/route.js +++ /dev/null @@ -1,27 +0,0 @@ -import axios from 'axios'; - -const JINGROW_SERVER_URL = process.env.JINGROW_SERVER_URL; -const JINGROW_SITE_NAME = process.env.JINGROW_SITE_NAME; - -export async function GET(request) { - try { - const { searchParams } = new URL(request.url); - const pagetype = searchParams.get('pagetype'); - const category = searchParams.get('category'); - const count = searchParams.get('count'); - if (!pagetype) { - return Response.json({ error: '缺少pagetype参数' }, { status: 400 }); - } - const response = await axios.get( - `${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_listview_data`, - { params: { pagetype, category, count, site_name: JINGROW_SITE_NAME } } - ); - const data = response.data.message?.data || []; - return Response.json({ data }); - } catch (error) { - return Response.json( - { error: error.message, detail: error?.response?.data || null }, - { status: 500 } - ); - } -} diff --git a/app/api/get-site-settings/route.js b/app/api/get-site-settings/route.js deleted file mode 100644 index 26de1e4..0000000 --- a/app/api/get-site-settings/route.js +++ /dev/null @@ -1,20 +0,0 @@ -import axios from 'axios'; -import { get_jingrow_api_headers } from '../auth'; - -const JINGROW_SERVER_URL = process.env.JINGROW_SERVER_URL; - -export async function GET(request) { - try { - const response = await axios.get( - `${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_site_settings`, - { headers: get_jingrow_api_headers() } - ); - const data = response.data.message?.data || {}; - return Response.json({ data }); - } catch (error) { - return Response.json( - { error: error.message, detail: error?.response?.data || null }, - { status: 500 } - ); - } -} \ No newline at end of file