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