修改用户文件查询数据

This commit is contained in:
junleea 2025-03-29 13:55:50 +08:00
parent 4843548fd0
commit a4df39afd5
1 changed files with 3 additions and 3 deletions

View File

@ -30,14 +30,14 @@ type GetUserFileListReq struct {
func GetUserFileList(c *gin.Context) { func GetUserFileList(c *gin.Context) {
id, _ := c.Get("id") id, _ := c.Get("id")
user_id := int(id.(float64)) userId := int(id.(float64))
var req GetUserFileListReq var req GetUserFileListReq
if err := c.ShouldBind(&req); err == nil { if err := c.ShouldBind(&req); err == nil {
if req.Type == "all" { if req.Type == "all" {
userFiles := service.FindUserFileList(user_id, proto.UserFileTypeFile) userFiles := service.FindUserFileList(userId, proto.UserFileTypeFile)
c.JSON(http.StatusOK, gin.H{"code": proto.SuccessCode, "msg": "success", "data": userFiles}) c.JSON(http.StatusOK, gin.H{"code": proto.SuccessCode, "msg": "success", "data": userFiles})
} else if req.Type == "search" { } else if req.Type == "search" {
fileList := dao.FindFileByUserFileName(req.FileName, user_id) fileList := dao.FindFileByUserFileName(req.FileName, userId)
c.JSON(http.StatusOK, gin.H{"code": proto.SuccessCode, "msg": "success", "data": fileList}) c.JSON(http.StatusOK, gin.H{"code": proto.SuccessCode, "msg": "success", "data": fileList})
} else { } else {
c.JSON(http.StatusOK, gin.H{"error": "search file type error", "code": proto.ParameterError, "message": "failed"}) c.JSON(http.StatusOK, gin.H{"error": "search file type error", "code": proto.ParameterError, "message": "failed"})