24 lines
801 B
TypeScript
24 lines
801 B
TypeScript
import { NextResponse } from "next/server"
|
||
import { config } from "dotenv"
|
||
import { resolve } from "path"
|
||
|
||
if (typeof process !== "undefined" && !process.env.MONGODB_URI) {
|
||
config({ path: resolve(process.cwd(), ".env.local") })
|
||
}
|
||
|
||
/** 从代练通等平台对接接口拉取或同步订单;需配置平台 appKey/secret */
|
||
export async function POST() {
|
||
const appKey = process.env.DAILIAN_APP_KEY
|
||
if (!appKey) {
|
||
return NextResponse.json({
|
||
success: false,
|
||
error: "请配置 DAILIAN_APP_KEY(代练通等平台),正式对接需调用平台 API",
|
||
needConfig: true,
|
||
})
|
||
}
|
||
return NextResponse.json({
|
||
success: true,
|
||
message: "代练通同步接口已就绪,正式对接需调用平台商品/订单 API 并写入 levelingProducts / levelingOrders",
|
||
})
|
||
}
|