You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/internal/cms_api/router.go

68 lines
2.7 KiB

3 years ago
package cms_api
import (
"Open_IM/internal/cms_api/admin"
"Open_IM/internal/cms_api/group"
3 years ago
messageCMS "Open_IM/internal/cms_api/message_cms"
3 years ago
"Open_IM/internal/cms_api/middleware"
"Open_IM/internal/cms_api/statistics"
"Open_IM/internal/cms_api/user"
2 years ago
"Open_IM/internal/demo/register"
3 years ago
3 years ago
"github.com/gin-gonic/gin"
)
func NewGinRouter() *gin.Engine {
gin.SetMode(gin.ReleaseMode)
baseRouter := gin.Default()
3 years ago
router := baseRouter.Group("/cms")
3 years ago
router.Use(middleware.CorsHandler())
adminRouterGroup := router.Group("/admin")
{
3 years ago
adminRouterGroup.POST("/login", admin.AdminLogin)
2 years ago
adminRouterGroup.Use(middleware.JWTAuth())
2 years ago
adminRouterGroup.POST("/add_user_register_add_friend_id", admin.AddUserRegisterAddFriendIDList)
adminRouterGroup.POST("/reduce_user_register_reduce_friend_id", admin.ReduceUserRegisterAddFriendIDList)
adminRouterGroup.POST("/get_user_register_reduce_friend_id_list", admin.GetUserRegisterAddFriendIDList)
2 years ago
adminRouterGroup.POST("/generate_invitation_code", register.GenerateInvitationCode)
adminRouterGroup.POST("/query_invitation_code", register.QueryInvitationCode)
adminRouterGroup.POST("/get_invitation_codes", register.GetInvitationCodes)
adminRouterGroup.POST("/query_user_ip_limit_login", register.QueryUserIDLimitLogin)
adminRouterGroup.POST("/add_user_ip_limit_login", register.AddUserIPLimitLogin)
adminRouterGroup.POST("/remove_user_ip_limit_login", register.RemoveUserIPLimitLogin)
adminRouterGroup.POST("/query_ip_register", register.QueryIPRegister)
adminRouterGroup.POST("/add_ip_limit", register.AddIPLimit)
adminRouterGroup.POST("/remove_ip_Limit", register.RemoveIPLimit)
3 years ago
}
3 years ago
r2 := router.Group("")
r2.Use(middleware.JWTAuth())
statisticsRouterGroup := r2.Group("/statistics")
3 years ago
{
2 years ago
statisticsRouterGroup.POST("/get_messages_statistics", statistics.GetMessagesStatistics)
statisticsRouterGroup.POST("/get_user_statistics", statistics.GetUserStatistics)
statisticsRouterGroup.POST("/get_group_statistics", statistics.GetGroupStatistics)
statisticsRouterGroup.POST("/get_active_user", statistics.GetActiveUser)
statisticsRouterGroup.POST("/get_active_group", statistics.GetActiveGroup)
3 years ago
}
3 years ago
groupRouterGroup := r2.Group("/group")
3 years ago
{
2 years ago
groupRouterGroup.POST("/get_groups", group.GetGroups)
groupRouterGroup.POST("/get_group_members", group.GetGroupMembers)
3 years ago
}
3 years ago
userRouterGroup := r2.Group("/user")
3 years ago
{
userRouterGroup.POST("/add_user", user.AddUser)
userRouterGroup.POST("/unblock_user", user.UnblockUser)
userRouterGroup.POST("/block_user", user.BlockUser)
2 years ago
userRouterGroup.POST("/get_block_users", user.GetBlockUsers)
3 years ago
}
3 years ago
messageCMSRouterGroup := r2.Group("/message")
3 years ago
{
2 years ago
messageCMSRouterGroup.POST("/get_chat_logs", messageCMS.GetChatLogs)
3 years ago
}
3 years ago
return baseRouter
}