| 117 | } |
| 118 | |
| 119 | func GetLocalFile(ctx echo.Context) error { |
| 120 | path := ctx.QueryParam("path") |
| 121 | if len(path) == 0 { |
| 122 | return ctx.JSON(http.StatusOK, model.Result{ |
| 123 | Success: common_err.INVALID_PARAMS, |
| 124 | Message: common_err.GetMsg(common_err.INVALID_PARAMS), |
| 125 | }) |
| 126 | } |
| 127 | if !file.Exists(path) { |
| 128 | return ctx.JSON(http.StatusOK, model.Result{ |
| 129 | Success: common_err.FILE_DOES_NOT_EXIST, |
| 130 | Message: common_err.GetMsg(common_err.FILE_DOES_NOT_EXIST), |
| 131 | }) |
| 132 | } |
| 133 | return ctx.File(path) |
| 134 | } |
| 135 | |
| 136 | // @Summary download |
| 137 | // @Produce application/json |