🐝 reformat code

This commit is contained in:
微凉
2021-03-05 21:25:44 +08:00
parent d137ef8759
commit 3138e031f5
28 changed files with 389 additions and 389 deletions

View File

@@ -23,8 +23,8 @@ func Get(c *gin.Context) {
return
}
log.Debugf("list:%+v", get)
path,name:=filepath.Split(get.File)
file, err := models.GetFileByParentPathAndName(path,name)
dir, name := filepath.Split(get.File)
file, err := models.GetFileByParentPathAndName(dir, name)
if err != nil {
c.JSON(200, controllers.MetaResponse(500, err.Error()))
return
@@ -34,19 +34,19 @@ func Get(c *gin.Context) {
// handle download request
func Down(c *gin.Context) {
filePath:=c.Param("file")
log.Debugf("down:%s",filePath)
path,name:=filepath.Split(filePath)
fileModel, err := models.GetFileByParentPathAndName(path,name)
filePath := c.Param("file")
log.Debugf("down:%s", filePath)
dir, name := filepath.Split(filePath)
fileModel, err := models.GetFileByParentPathAndName(dir, name)
if err != nil {
c.JSON(200, controllers.MetaResponse(500, err.Error()))
return
}
file,err:=alidrive.GetDownLoadUrl(fileModel.FileId)
file, err := alidrive.GetDownLoadUrl(fileModel.FileId)
if err != nil {
c.JSON(200, controllers.MetaResponse(500,err.Error()))
c.JSON(200, controllers.MetaResponse(500, err.Error()))
return
}
c.Redirect(301,file.Url)
c.Redirect(301, file.Url)
return
}