修复需要从前端传新增人修改人的问题
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"dataengine/dao/dict"
|
||||
dto "dataengine/model/dto/dict"
|
||||
entity "dataengine/model/entity/dict"
|
||||
"dataengine/utils"
|
||||
"errors"
|
||||
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
@@ -35,8 +36,11 @@ func (s *apiInterfaceService) Create(ctx context.Context, req *dto.CreateApiInte
|
||||
return nil, errors.New("接口编码在该平台下已存在")
|
||||
}
|
||||
|
||||
// 从 context 中获取当前用户
|
||||
currentUser := utils.GetCurrentUser(ctx)
|
||||
|
||||
// 插入数据库
|
||||
id, err := dict.ApiInterface.Insert(ctx, req)
|
||||
id, err := dict.ApiInterface.Insert(ctx, req, currentUser)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -87,7 +91,9 @@ func (s *apiInterfaceService) List(ctx context.Context, req *dto.ListApiInterfac
|
||||
Method: item.Method,
|
||||
Status: item.Status,
|
||||
StatusName: s.getStatusName(item.Status),
|
||||
CreatedBy: item.Creator,
|
||||
CreatedAt: safeUnix(item.CreatedAt),
|
||||
UpdatedBy: item.Updater,
|
||||
UpdatedAt: safeUnix(item.UpdatedAt),
|
||||
})
|
||||
}
|
||||
@@ -151,13 +157,15 @@ func (s *apiInterfaceService) Update(ctx context.Context, req *dto.UpdateApiInte
|
||||
}
|
||||
}
|
||||
|
||||
_, err = dict.ApiInterface.Update(ctx, req)
|
||||
currentUser := utils.GetCurrentUser(ctx)
|
||||
_, err = dict.ApiInterface.Update(ctx, req, currentUser)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus 更新接口状态
|
||||
func (s *apiInterfaceService) UpdateStatus(ctx context.Context, req *dto.UpdateApiInterfaceStatusReq) (err error) {
|
||||
_, err = dict.ApiInterface.UpdateStatus(ctx, req.Id, req.Status.String())
|
||||
currentUser := utils.GetCurrentUser(ctx)
|
||||
_, err = dict.ApiInterface.UpdateStatus(ctx, req.Id, req.Status.String(), currentUser)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user