修复需要从前端传新增人修改人的问题

This commit is contained in:
2026-06-12 09:51:09 +08:00
parent 9dc12634f5
commit e5133eea34
8 changed files with 74 additions and 37 deletions

View File

@@ -6,7 +6,7 @@ import (
dao "dataengine/dao/dict"
dto "dataengine/model/dto/dict"
entity "dataengine/model/entity/dict"
"strconv"
"dataengine/utils"
"time"
"github.com/gogf/gf/v2/util/gconv"
@@ -34,14 +34,11 @@ func (s *datasourcePlatformService) Create(ctx context.Context, req *dto.CreateD
return nil, err
}
// 设置创建时间为当前时间
if req.CreatedAt == "" {
req.CreatedAt = strconv.FormatInt(time.Now().Unix(), 10)
}
req.UpdatedAt = req.CreatedAt
// 从 context 中获取当前用户
currentUser := utils.GetCurrentUser(ctx)
// 插入数据库
id, err := dao.DatasourcePlatform.Insert(ctx, req)
id, err := dao.DatasourcePlatform.Insert(ctx, req, currentUser)
if err != nil {
return nil, err
}
@@ -165,9 +162,9 @@ func (s *datasourcePlatformService) Update(ctx context.Context, req *dto.UpdateD
}
}
// 设置更新时间
req.UpdatedAt = strconv.FormatInt(time.Now().Unix(), 10)
_, err = dao.DatasourcePlatform.Update(ctx, req)
// 从 context 中获取当前用户
currentUser := utils.GetCurrentUser(ctx)
_, err = dao.DatasourcePlatform.Update(ctx, req, currentUser)
return err
}
@@ -187,7 +184,8 @@ func (s *datasourcePlatformService) UpdateStatus(ctx context.Context, req *dto.U
return nil
}
_, err = dao.DatasourcePlatform.UpdateStatus(ctx, req.Id, req.Status.String(), req.UpdatedBy)
currentUser := utils.GetCurrentUser(ctx)
_, err = dao.DatasourcePlatform.UpdateStatus(ctx, req.Id, req.Status.String(), currentUser)
return err
}