Compare commits
No commits in common. "147d3f12cda9268540ba57806d2613f79cadd903" and "ca400be8b805fb3ecadfac701d64703f833bd342" have entirely different histories.
147d3f12cd
...
ca400be8b8
|
|
@ -26,11 +26,6 @@ type SetDeviceStatusReq struct {
|
|||
Status string `json:"status" form:"status"` //设备状态
|
||||
}
|
||||
|
||||
type GetFileListReq struct {
|
||||
Type string `json:"type" form:"type"` //请求类型,1:按md5查询,2:按文件名查询;3:查询待删除文件
|
||||
Md5 string `json:"md5" form:"md5"`
|
||||
}
|
||||
|
||||
func SetUpToolGroup(router *gin.Engine) {
|
||||
toolGroup := router.Group("/tool")
|
||||
toolGroup.POST("/set_redis", SetRedis)
|
||||
|
|
@ -40,7 +35,6 @@ func SetUpToolGroup(router *gin.Engine) {
|
|||
toolGroup.POST("/upload", UploadFile)
|
||||
toolGroup.GET("/download", DownloadFile)
|
||||
toolGroup.GET("/file/:filename", GetFile)
|
||||
toolGroup.POST("/file_list", GetFileList)
|
||||
//文件管理
|
||||
toolGroup.POST("/file_del", DelFile)
|
||||
//服务器、设备状态接口
|
||||
|
|
@ -77,29 +71,6 @@ func SetDeviceStatusV2(c *gin.Context) {
|
|||
|
||||
}
|
||||
|
||||
func GetFileList(c *gin.Context) {
|
||||
//解析请求参数
|
||||
var req GetFileListReq
|
||||
if err := c.ShouldBind(&req); err == nil {
|
||||
if req.Type == "1" {
|
||||
//按md5查询
|
||||
if req.Md5 == "" {
|
||||
c.JSON(http.StatusOK, gin.H{"error": "md5 is empty", "code": proto.ParameterError, "message": "failed"})
|
||||
return
|
||||
}
|
||||
file := dao.FindFileByMd5(req.Md5)
|
||||
if file.ID == 0 {
|
||||
c.JSON(http.StatusOK, gin.H{"error": "file not found", "code": proto.FileNotFound, "message": "failed"})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"code": proto.SuccessCode, "message": "success", "data": file})
|
||||
}
|
||||
} else {
|
||||
c.JSON(http.StatusOK, gin.H{"error": "parameter error", "code": proto.ParameterError, "message": "failed"})
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func DelFile(c *gin.Context) {
|
||||
//先查看是否有权限
|
||||
id, _ := c.Get("id")
|
||||
|
|
|
|||
Loading…
Reference in New Issue