删除一些冗余的api接口文件
This commit is contained in:
parent
94e584dc0a
commit
b7ad89b269
@ -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'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -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 }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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 }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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 }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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 }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user