🔥 改为前后端分离形式
This commit is contained in:
@@ -9,31 +9,49 @@ import (
|
||||
// @description: 初始化路由
|
||||
// @param g
|
||||
func Init(g *gin.Engine) {
|
||||
g.GET("/", func(ctx *gin.Context) {
|
||||
// 重定向到index.html
|
||||
ctx.Redirect(302, "/index.html")
|
||||
})
|
||||
//g.GET("/", func(ctx *gin.Context) {
|
||||
// // 重定向到index.html
|
||||
// ctx.Redirect(302, "/index.html")
|
||||
//})
|
||||
|
||||
g.GET("/index.html", app.Index) // 首页
|
||||
g.GET("/friend.html", app.Friend) // 好友列表
|
||||
g.GET("/group.html", app.Group) // 群组列表
|
||||
g.GET("/assistant.html", app.Assistant) // AI角色
|
||||
|
||||
g.GET("/404.html", app.PageNotFound) // 群组列表
|
||||
//g.GET("/404.html", app.PageNotFound) // 群组列表
|
||||
|
||||
// 接口
|
||||
api := g.Group("/api")
|
||||
api.PUT("/ai/status", app.ChangeEnableAiStatus) // 修改是否开启AI状态
|
||||
api.POST("/ai/model", app.ChangeUseAiModel) // 修改使用的AI模型
|
||||
api.POST("/ai/assistant", app.ChangeUseAiAssistant) // 修改使用的AI助手
|
||||
api.PUT("/welcome/status", app.ChangeEnableWelcomeStatus) // 修改是否开启迎新状态
|
||||
api.PUT("/command/status", app.ChangeEnableCommandStatus) // 修改是否开启指令状态
|
||||
api.PUT("/news/status", app.ChangeEnableNewsStatus) // 修改是否开启早报状态
|
||||
api.PUT("/grouprank/status", app.ChangeEnableGroupRankStatus) // 修改是否开启水群排行榜状态
|
||||
api.PUT("/grouprank/skip", app.ChangeSkipGroupRankStatus) // 修改是否跳过水群排行榜状态
|
||||
api.GET("/group/users", app.GetGroupUsers) // 获取群成员列表
|
||||
api.PUT("/summary/status", app.ChangeEnableSummaryStatus) // 修改是否开启群聊总结状态
|
||||
api.PUT("/clearmembers", app.AutoClearMembers) // 自动清理群成员
|
||||
|
||||
api.POST("/assistant", app.SaveAssistant) // 保存AI助手
|
||||
contact := api.Group("/contact") // 通讯录
|
||||
{
|
||||
contact.GET("/friend", app.GetFriends) // 获取好友列表
|
||||
contact.GET("/group", app.GetGroups) // 获取群组列表
|
||||
profile := contact.Group("/profile") // 配置
|
||||
{
|
||||
profile.PUT("/ai/status", app.ChangeEnableAiStatus) // 修改是否开启AI状态
|
||||
profile.POST("/ai/model", app.ChangeUseAiModel) // 修改使用的AI模型
|
||||
profile.POST("/ai/assistant", app.ChangeUseAiAssistant) // 修改使用的AI助手
|
||||
profile.PUT("/welcome/status", app.ChangeEnableWelcomeStatus) // 修改是否开启迎新
|
||||
profile.PUT("/command/status", app.ChangeEnableCommandStatus) // 修改是否开启指令
|
||||
profile.PUT("/news/status", app.ChangeEnableNewsStatus) // 修改是否开启早报
|
||||
profile.PUT("/grouprank/status", app.ChangeEnableGroupRankStatus) // 修改是否开启水群排行榜
|
||||
profile.PUT("/summary/status", app.ChangeEnableSummaryStatus) // 修改是否开启群聊总结
|
||||
profile.PUT("/clearmembers", app.AutoClearMembers) // 自动清理群成员
|
||||
}
|
||||
|
||||
group := contact.Group("/group") // 群组
|
||||
{
|
||||
group.GET("/users", app.GetGroupUsers) // 获取群成员列表
|
||||
group.PUT("/grouprank/skip", app.ChangeSkipGroupRankStatus) // 修改是否跳过水群排行榜状态
|
||||
}
|
||||
}
|
||||
|
||||
system := api.Group("/system") // 系统设置
|
||||
{
|
||||
system.GET("/assistant", app.GetAssistants) // 获取AI助手列表
|
||||
system.POST("/assistant", app.SaveAssistant) // 保存AI助手
|
||||
system.GET("/models", app.GetAiModels) // 获取AI模型列表
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user