refactor(internal/service): 简化部署文件更新逻辑

-移除了对 UpdateBy 字段的冗余条件判断
- 直接使用 currentUserId 更新 UpdateBy 字段
This commit is contained in:
zhangtao 2025-08-04 10:10:52 +08:00
parent eadeac064b
commit e8aa95b7c5
1 changed files with 1 additions and 3 deletions

View File

@ -111,9 +111,7 @@ func (s *SysDeployFileService) UpdateByID(c *gin.Context) serializer.Response {
deployFile.UpdateTime = &now deployFile.UpdateTime = &now
// 获取当前用户 // 获取当前用户
if updateBy := currentUserId; updateBy != "" { deployFile.UpdateBy = currentUserId
deployFile.UpdateBy = updateBy
}
if err := s.Db.Model(&deployFile).Where("deploy_id = ? AND del_flag = ? AND create_by = ?", id, "0", currentUserId).Updates(&deployFile).Error; err != nil { if err := s.Db.Model(&deployFile).Where("deploy_id = ? AND del_flag = ? AND create_by = ?", id, "0", currentUserId).Updates(&deployFile).Error; err != nil {
logger.Error(c, "更新部署文件记录失败!") logger.Error(c, "更新部署文件记录失败!")