修改用户文件查询数据
This commit is contained in:
parent
4843548fd0
commit
a4df39afd5
|
|
@ -30,14 +30,14 @@ type GetUserFileListReq struct {
|
|||
|
||||
func GetUserFileList(c *gin.Context) {
|
||||
id, _ := c.Get("id")
|
||||
user_id := int(id.(float64))
|
||||
userId := int(id.(float64))
|
||||
var req GetUserFileListReq
|
||||
if err := c.ShouldBind(&req); err == nil {
|
||||
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})
|
||||
} 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})
|
||||
} else {
|
||||
c.JSON(http.StatusOK, gin.H{"error": "search file type error", "code": proto.ParameterError, "message": "failed"})
|
||||
|
|
|
|||
Loading…
Reference in New Issue