mirror of
https://github.com/lzh-1625/go_process_manager.git
synced 2025-10-05 07:56:50 +08:00
rename service
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/lzh-1625/go_process_manager/internal/app/service"
|
||||
"github.com/lzh-1625/go_process_manager/internal/app/logic"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -12,7 +12,7 @@ var FileApi = new(file)
|
||||
|
||||
func (f *file) FilePathHandler(ctx *gin.Context) {
|
||||
path := getQueryString(ctx, "path")
|
||||
rOk(ctx, "Operation successful!", service.FileService.GetFileAndDirByPath(path))
|
||||
rOk(ctx, "Operation successful!", logic.FileLogic.GetFileAndDirByPath(path))
|
||||
}
|
||||
|
||||
func (f *file) FileWriteHandler(ctx *gin.Context) {
|
||||
@@ -20,14 +20,14 @@ func (f *file) FileWriteHandler(ctx *gin.Context) {
|
||||
fi, err := ctx.FormFile("data")
|
||||
errCheck(ctx, err != nil, "Read file data failed!")
|
||||
fiReader, _ := fi.Open()
|
||||
err = service.FileService.UpdateFileData(path, fiReader, fi.Size)
|
||||
err = logic.FileLogic.UpdateFileData(path, fiReader, fi.Size)
|
||||
errCheck(ctx, err != nil, "Update file data operation failed!")
|
||||
rOk(ctx, "Operation successful!", nil)
|
||||
}
|
||||
|
||||
func (f *file) FileReadHandler(ctx *gin.Context) {
|
||||
path := getQueryString(ctx, "filePath")
|
||||
bytes, err := service.FileService.ReadFileFromPath(path)
|
||||
bytes, err := logic.FileLogic.ReadFileFromPath(path)
|
||||
errCheck(ctx, err != nil, "Operation failed!")
|
||||
rOk(ctx, "Operation successful!", string(bytes))
|
||||
}
|
||||
|
Reference in New Issue
Block a user