feat: Implement Oauth2 login log service and repository
- Added Oauth2LogLoginService for managing user authorization logs. - Implemented methods for inserting logs, cleaning logs, and exporting log data. - Created a new file for Oauth2 login log service. refactor: Remove unused open_api module - Deleted the open_api.go file as it was not utilized in the project. fix: Update error codes in SysProfileController - Changed error codes for binding errors and user authentication errors to more descriptive values. fix: Update cache handling in SysConfig and SysDictType services - Modified Redis set operations to include expiration time for cached values. refactor: Update middleware authorization checks - Replaced PreAuthorize middleware with AuthorizeUser across multiple routes in system and tool modules for consistency. chore: Clean up trace and ws modules - Updated middleware authorization in trace and ws modules to use AuthorizeUser.
This commit is contained in:
@@ -25,21 +25,21 @@ func Setup(router *gin.Engine) {
|
||||
// 通用请求
|
||||
commonGroup := router.Group("/common")
|
||||
{
|
||||
commonGroup.POST("/hash", middleware.PreAuthorize(nil), controller.NewCommon.Hash)
|
||||
commonGroup.POST("/hash", middleware.AuthorizeUser(nil), controller.NewCommon.Hash)
|
||||
commonGroup.GET("/i18n", controller.NewCommon.I18n)
|
||||
}
|
||||
|
||||
// 文件操作处理
|
||||
fileGroup := router.Group("/file")
|
||||
{
|
||||
fileGroup.POST("/upload", middleware.PreAuthorize(nil), controller.NewFile.Upload)
|
||||
fileGroup.POST("/chunk-check", middleware.PreAuthorize(nil), controller.NewFile.ChunkCheck)
|
||||
fileGroup.POST("/chunk-upload", middleware.PreAuthorize(nil), controller.NewFile.ChunkUpload)
|
||||
fileGroup.POST("/chunk-merge", middleware.PreAuthorize(nil), controller.NewFile.ChunkMerge)
|
||||
fileGroup.GET("/download/:filePath", middleware.PreAuthorize(nil), controller.NewFile.Download)
|
||||
fileGroup.GET("/list", middleware.PreAuthorize(nil), controller.NewFile.List)
|
||||
fileGroup.GET("", middleware.PreAuthorize(nil), controller.NewFile.File)
|
||||
fileGroup.DELETE("", middleware.PreAuthorize(nil), controller.NewFile.Remove)
|
||||
fileGroup.POST("/transfer-static-file", middleware.PreAuthorize(nil), controller.NewFile.TransferStaticFile)
|
||||
fileGroup.POST("/upload", middleware.AuthorizeUser(nil), controller.NewFile.Upload)
|
||||
fileGroup.POST("/chunk-check", middleware.AuthorizeUser(nil), controller.NewFile.ChunkCheck)
|
||||
fileGroup.POST("/chunk-upload", middleware.AuthorizeUser(nil), controller.NewFile.ChunkUpload)
|
||||
fileGroup.POST("/chunk-merge", middleware.AuthorizeUser(nil), controller.NewFile.ChunkMerge)
|
||||
fileGroup.GET("/download/:filePath", middleware.AuthorizeUser(nil), controller.NewFile.Download)
|
||||
fileGroup.GET("/list", middleware.AuthorizeUser(nil), controller.NewFile.List)
|
||||
fileGroup.GET("", middleware.AuthorizeUser(nil), controller.NewFile.File)
|
||||
fileGroup.DELETE("", middleware.AuthorizeUser(nil), controller.NewFile.Remove)
|
||||
fileGroup.POST("/transfer-static-file", middleware.AuthorizeUser(nil), controller.NewFile.TransferStaticFile)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ func (s *FileController) ChunkCheck(c *gin.Context) {
|
||||
Identifier string `json:"identifier" binding:"required"` // 唯一标识
|
||||
FileName string `json:"fileName" binding:"required"` // 文件名
|
||||
}
|
||||
if err := c.ShouldBindJSON(&body); err != nil {
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(40422, errMsgs))
|
||||
return
|
||||
@@ -168,7 +168,7 @@ func (s *FileController) ChunkMerge(c *gin.Context) {
|
||||
FileName string `json:"fileName" binding:"required"` // 文件名
|
||||
SubPath string `json:"subPath"` // 子路径类型
|
||||
}
|
||||
if err := c.ShouldBindJSON(&body); err != nil {
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(40422, errMsgs))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user