mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 07:50:25 +08:00
refactor: 引入日志切割库、indexApi拆分等
This commit is contained in:
@@ -75,8 +75,7 @@ type MachineFile interface {
|
||||
type machineFileAppImpl struct {
|
||||
base.AppImpl[*entity.MachineFile, repository.MachineFile]
|
||||
|
||||
MachineFileRepo repository.MachineFile `inject:""`
|
||||
MachineApp Machine `inject:""`
|
||||
machineApp Machine `inject:"MachineApp"`
|
||||
}
|
||||
|
||||
// 注入MachineFileRepo
|
||||
@@ -86,26 +85,26 @@ func (m *machineFileAppImpl) InjectMachineFileRepo(repo repository.MachineFile)
|
||||
|
||||
// 分页获取机器脚本信息列表
|
||||
func (m *machineFileAppImpl) GetPageList(condition *entity.MachineFile, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error) {
|
||||
return m.MachineFileRepo.GetPageList(condition, pageParam, toEntity, orderBy...)
|
||||
return m.GetRepo().GetPageList(condition, pageParam, toEntity, orderBy...)
|
||||
}
|
||||
|
||||
// 根据条件获取
|
||||
func (m *machineFileAppImpl) GetMachineFile(condition *entity.MachineFile, cols ...string) error {
|
||||
return m.MachineFileRepo.GetBy(condition, cols...)
|
||||
return m.GetBy(condition, cols...)
|
||||
}
|
||||
|
||||
// 保存机器文件配置
|
||||
func (m *machineFileAppImpl) Save(ctx context.Context, mf *entity.MachineFile) error {
|
||||
_, err := m.MachineApp.GetById(new(entity.Machine), mf.MachineId, "Name")
|
||||
_, err := m.machineApp.GetById(new(entity.Machine), mf.MachineId, "Name")
|
||||
if err != nil {
|
||||
return errorx.NewBiz("该机器不存在")
|
||||
}
|
||||
|
||||
if mf.Id != 0 {
|
||||
return m.MachineFileRepo.UpdateById(ctx, mf)
|
||||
return m.UpdateById(ctx, mf)
|
||||
}
|
||||
|
||||
return m.MachineFileRepo.Insert(ctx, mf)
|
||||
return m.Insert(ctx, mf)
|
||||
}
|
||||
|
||||
func (m *machineFileAppImpl) ReadDir(fid uint64, path string) ([]fs.FileInfo, error) {
|
||||
@@ -306,7 +305,7 @@ func (m *machineFileAppImpl) GetMachineCli(fid uint64, inputPath ...string) (*mc
|
||||
return nil, errorx.NewBiz("无权访问该目录或文件: %s", path)
|
||||
}
|
||||
}
|
||||
return m.MachineApp.GetCli(mf.MachineId)
|
||||
return m.machineApp.GetCli(mf.MachineId)
|
||||
}
|
||||
|
||||
// 获取文件机器 sftp cli
|
||||
|
||||
Reference in New Issue
Block a user