This commit is contained in:
parent
c4c10f2ba0
commit
f846b15451
10
index.ts
10
index.ts
@ -14,15 +14,15 @@ const server = Bun.serve({
|
||||
// 打印当前路由
|
||||
console.log("🚀 ~ serve ~ req.url", req.url)
|
||||
// 路由处理
|
||||
const { exactPath, startsWithPath } = makeCheckPathTool(req.url)
|
||||
const { exactCheck, startsWithCheck } = makeCheckPathTool(req.url)
|
||||
// 机器人
|
||||
if (exactPath("/bot")) return await manageBotReq(req)
|
||||
if (exactCheck("/bot")) return await manageBotReq(req)
|
||||
// 消息代理发送
|
||||
if (exactPath("/message")) return await manageMessageReq(req)
|
||||
if (exactCheck("/message")) return await manageMessageReq(req)
|
||||
// 表格代理操作
|
||||
if (exactPath("/sheet")) return await manageSheetReq(req)
|
||||
if (exactCheck("/sheet")) return await manageSheetReq(req)
|
||||
// 小程序
|
||||
if (startsWithPath("/micro_app")) return await manageMicroAppReq(req)
|
||||
if (startsWithCheck("/micro_app")) return await manageMicroAppReq(req)
|
||||
// 其他
|
||||
return netTool.ok("hello, there is egg, glade to serve you!")
|
||||
} catch (error: any) {
|
||||
|
@ -79,13 +79,13 @@ const manageBatchUser = async (req: Request) => {
|
||||
* @returns
|
||||
*/
|
||||
export const manageMicroAppReq = async (req: Request) => {
|
||||
const { exactPath } = makeCheckPathTool(req.url, "/micro_app")
|
||||
const { exactCheck } = makeCheckPathTool(req.url, "/micro_app")
|
||||
// 处理登录请求
|
||||
if (exactPath("/login")) {
|
||||
if (exactCheck("/login")) {
|
||||
return manageLogin(req)
|
||||
}
|
||||
// 处理批量获取用户信息请求
|
||||
if (exactPath("/batch_user")) {
|
||||
if (exactCheck("/batch_user")) {
|
||||
return manageBatchUser(req)
|
||||
}
|
||||
return netTool.ok()
|
||||
|
Loading…
x
Reference in New Issue
Block a user