更新jingrow系统api接口地址
This commit is contained in:
parent
d1933d042d
commit
77901dbe20
@ -12,7 +12,7 @@ export async function GET(request) {
|
||||
}
|
||||
|
||||
const response = await axios.get(
|
||||
`${JINGROW_SERVER_URL}/api/method/jsite.api.v1.get_category`,
|
||||
`${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_category`,
|
||||
{ params: { pagetype, name } }
|
||||
);
|
||||
return Response.json(response.data, { status: response.status });
|
||||
|
||||
@ -47,7 +47,7 @@ export async function GET(request) {
|
||||
return Response.json({ error: '缺少component_name参数' }, { status: 400 });
|
||||
}
|
||||
const response = await axios.get(
|
||||
`${JINGROW_SERVER_URL}/api/method/jsite.api.v1.get_component_data`,
|
||||
`${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_component_data`,
|
||||
{ params: { component_name } }
|
||||
);
|
||||
let data = response.data.message?.data || {};
|
||||
|
||||
@ -11,7 +11,7 @@ export async function GET(request) {
|
||||
return Response.json({ error: '缺少pagetype或slug参数' }, { status: 400 });
|
||||
}
|
||||
const response = await axios.get(
|
||||
`${JINGROW_SERVER_URL}/api/method/jsite.api.v1.get_detailview_data`,
|
||||
`${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_detailview_data`,
|
||||
{ params: { pagetype, slug } }
|
||||
);
|
||||
const data = response.data.message?.data || {};
|
||||
|
||||
@ -12,7 +12,7 @@ export async function GET(request) {
|
||||
return Response.json({ error: '缺少pagetype参数' }, { status: 400 });
|
||||
}
|
||||
const response = await axios.get(
|
||||
`${JINGROW_SERVER_URL}/api/method/jsite.api.v1.get_listview_data`,
|
||||
`${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_listview_data`,
|
||||
{ params: { pagetype, category, count } }
|
||||
);
|
||||
const data = response.data.message?.data || [];
|
||||
|
||||
@ -25,7 +25,7 @@ function buildMenuTree(items, parent = null, parentPath = "") {
|
||||
export async function GET(request) {
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`${JINGROW_SERVER_URL}/api/method/jsite.api.v1.get_menu`
|
||||
`${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_menu`
|
||||
);
|
||||
const items = response.data.message?.data || [];
|
||||
const menuTree = buildMenuTree(items);
|
||||
|
||||
@ -67,7 +67,7 @@ export async function POST(request) {
|
||||
const params = { slug_list: JSON.stringify(slug_list), page };
|
||||
if (page_size) params.page_size = page_size;
|
||||
const response = await axios.get(
|
||||
`${JINGROW_SERVER_URL}/api/method/jsite.api.v1.get_page_data`,
|
||||
`${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_page_data`,
|
||||
{ params }
|
||||
);
|
||||
const message = response.data.message;
|
||||
|
||||
@ -6,7 +6,7 @@ const JINGROW_SERVER_URL = process.env.JINGROW_SERVER_URL;
|
||||
export async function GET(request) {
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`${JINGROW_SERVER_URL}/api/method/jsite.api.v1.get_site_settings`,
|
||||
`${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_site_settings`,
|
||||
{ headers: get_jingrow_api_headers() }
|
||||
);
|
||||
const data = response.data.message?.data || {};
|
||||
|
||||
@ -10,7 +10,7 @@ export async function POST(request) {
|
||||
return Response.json({ error: 'Missing parameters: subject and content are required.' }, { status: 400 });
|
||||
}
|
||||
const response = await axios.post(
|
||||
`${JINGROW_SERVER_URL}/api/method/jsite.api.v1.send_email`,
|
||||
`${JINGROW_SERVER_URL}/api/action/jsite.api.v1.send_email`,
|
||||
{ subject, content }
|
||||
);
|
||||
const message = response.data.message;
|
||||
|
||||
@ -124,7 +124,7 @@ export async function getPageData({
|
||||
if (page_size) params.page_size = page_size;
|
||||
|
||||
const response = await axios.get(
|
||||
`${JINGROW_SERVER_URL}/api/method/jsite.api.v1.get_page_data`,
|
||||
`${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_page_data`,
|
||||
{ params }
|
||||
);
|
||||
|
||||
@ -158,7 +158,7 @@ export async function getPageData({
|
||||
export async function getAllSlugs() {
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`${JINGROW_SERVER_URL}/api/method/jsite.api.v1.get_all_slugs`
|
||||
`${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_all_slugs`
|
||||
);
|
||||
const slugs = response.data.message?.data;
|
||||
if (!Array.isArray(slugs)) {
|
||||
@ -186,7 +186,7 @@ export async function getAllSlugs() {
|
||||
export async function fetchComponentData(componentName) {
|
||||
try {
|
||||
const res = await axios.get(
|
||||
`${JINGROW_SERVER_URL}/api/method/jsite.api.v1.get_component_data`,
|
||||
`${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_component_data`,
|
||||
{
|
||||
params: { component_name: componentName },
|
||||
}
|
||||
@ -214,7 +214,7 @@ export async function fetchListViewData({ pagetype, category, count }) {
|
||||
if (count !== undefined && count !== null) params.count = String(count);
|
||||
|
||||
const res = await axios.get(
|
||||
`${JINGROW_SERVER_URL}/api/method/jsite.api.v1.get_listview_data`,
|
||||
`${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_listview_data`,
|
||||
{ params }
|
||||
);
|
||||
|
||||
@ -234,7 +234,7 @@ export async function fetchListViewData({ pagetype, category, count }) {
|
||||
export async function fetchCategoryData({ pagetype, name }) {
|
||||
try {
|
||||
const res = await axios.get(
|
||||
`${JINGROW_SERVER_URL}/api/method/jsite.api.v1.get_category`,
|
||||
`${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_category`,
|
||||
{ params: { pagetype, name } }
|
||||
);
|
||||
return { data: res.data.message?.data || null };
|
||||
@ -254,7 +254,7 @@ export async function fetchCategoryData({ pagetype, name }) {
|
||||
export async function getMenuData() {
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`${JINGROW_SERVER_URL}/api/method/jsite.api.v1.get_menu`
|
||||
`${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_menu`
|
||||
);
|
||||
const items = response.data.message?.data || [];
|
||||
// 递归组装菜单树
|
||||
@ -285,7 +285,7 @@ export async function getMenuData() {
|
||||
export async function getSiteSettings() {
|
||||
try {
|
||||
const res = await axios.get(
|
||||
`${JINGROW_SERVER_URL}/api/method/jsite.api.v1.get_site_settings`,
|
||||
`${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_site_settings`,
|
||||
{ headers: get_jingrow_api_headers() }
|
||||
);
|
||||
return res.data?.message?.data || {
|
||||
|
||||
@ -2,7 +2,7 @@ export async function getSiteSettings() {
|
||||
const JINGROW_SERVER_URL = process.env.JINGROW_SERVER_URL;
|
||||
const apiKey = process.env.JINGROW_API_KEY;
|
||||
const apiSecret = process.env.JINGROW_API_SECRET;
|
||||
const url = `${JINGROW_SERVER_URL}/api/method/jsite.api.v1.get_site_settings`;
|
||||
const url = `${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_site_settings`;
|
||||
|
||||
try {
|
||||
const controller = new AbortController();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user