Spaces:
Running
Running
xiao
commited on
Commit
·
d8bd515
1
Parent(s):
5213992
测试
Browse files- app/api/wanjuan/route.ts +4 -6
app/api/wanjuan/route.ts
CHANGED
@@ -1,22 +1,20 @@
|
|
1 |
export async function POST(req: Request) {
|
2 |
try {
|
3 |
let token = process.env.WANJUAN_TOKEN;
|
4 |
-
|
5 |
-
let body = {"msgContent": await req.json(), "chatID": "104000676614877184"};
|
6 |
|
7 |
console.log(JSON.stringify(body));
|
8 |
let res = "";
|
9 |
-
await fetch("
|
10 |
method: "POST",
|
11 |
headers:{
|
12 |
-
|
13 |
-
"token": token
|
14 |
},
|
15 |
body: JSON.stringify(body),
|
16 |
})
|
17 |
.then((response) => response.json())
|
18 |
.then((data) => {
|
19 |
-
console.log(data)
|
20 |
if (data["statusInfo"]["code"] == 0) {
|
21 |
// console.log("123123")
|
22 |
res = data["data"]["msgContent"];
|
|
|
1 |
export async function POST(req: Request) {
|
2 |
try {
|
3 |
let token = process.env.WANJUAN_TOKEN;
|
4 |
+
let body = { message: await req.json() };
|
|
|
5 |
|
6 |
console.log(JSON.stringify(body));
|
7 |
let res = "";
|
8 |
+
await fetch("http://47.94.237.159:8080/v1/wanjuan", {
|
9 |
method: "POST",
|
10 |
headers:{
|
11 |
+
"Authorization":"Bearer "+token
|
|
|
12 |
},
|
13 |
body: JSON.stringify(body),
|
14 |
})
|
15 |
.then((response) => response.json())
|
16 |
.then((data) => {
|
17 |
+
// console.log(data)
|
18 |
if (data["statusInfo"]["code"] == 0) {
|
19 |
// console.log("123123")
|
20 |
res = data["data"]["msgContent"];
|