数据引擎-快手平台数据抽取bug修复
This commit is contained in:
@@ -19,6 +19,8 @@ var ApiInterface = new(apiInterfaceService)
|
||||
|
||||
// Create 创建接口
|
||||
func (s *apiInterfaceService) Create(ctx context.Context, req *dto.CreateApiInterfaceReq) (res *dto.CreateApiInterfaceRes, err error) {
|
||||
tenantId := utils.GetCurrentTenantId(ctx)
|
||||
|
||||
_, err = DatasourcePlatform.GetOne(ctx, &dto.GetDatasourcePlatformReq{Id: req.PlatformId})
|
||||
if err != nil {
|
||||
return nil, errors.New("平台不存在")
|
||||
@@ -28,7 +30,7 @@ func (s *apiInterfaceService) Create(ctx context.Context, req *dto.CreateApiInte
|
||||
interfaces, _, err := dict.ApiInterface.List(ctx, &dto.ListApiInterfaceReq{
|
||||
PlatformId: req.PlatformId,
|
||||
Code: req.Code,
|
||||
})
|
||||
}, tenantId)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -40,7 +42,7 @@ func (s *apiInterfaceService) Create(ctx context.Context, req *dto.CreateApiInte
|
||||
currentUser := utils.GetCurrentUser(ctx)
|
||||
|
||||
// 插入数据库
|
||||
id, err := dict.ApiInterface.Insert(ctx, req, currentUser)
|
||||
id, err := dict.ApiInterface.Insert(ctx, req, currentUser, tenantId)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -52,7 +54,8 @@ func (s *apiInterfaceService) Create(ctx context.Context, req *dto.CreateApiInte
|
||||
|
||||
// List 获取接口列表
|
||||
func (s *apiInterfaceService) List(ctx context.Context, req *dto.ListApiInterfaceReq) (res *dto.ListApiInterfaceRes, err error) {
|
||||
apiList, total, err := dict.ApiInterface.List(ctx, req)
|
||||
tenantId := utils.GetCurrentTenantId(ctx)
|
||||
apiList, total, err := dict.ApiInterface.List(ctx, req, tenantId)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -107,7 +110,8 @@ func (s *apiInterfaceService) List(ctx context.Context, req *dto.ListApiInterfac
|
||||
|
||||
// GetOne 获取单个接口
|
||||
func (s *apiInterfaceService) GetOne(ctx context.Context, req *dto.GetApiInterfaceReq) (res *dto.GetApiInterfaceRes, err error) {
|
||||
apiInterface, err := dict.ApiInterface.GetOne(ctx, req)
|
||||
tenantId := utils.GetCurrentTenantId(ctx)
|
||||
apiInterface, err := dict.ApiInterface.GetOne(ctx, req, tenantId)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -128,7 +132,9 @@ func (s *apiInterfaceService) GetOne(ctx context.Context, req *dto.GetApiInterfa
|
||||
|
||||
// Update 更新接口
|
||||
func (s *apiInterfaceService) Update(ctx context.Context, req *dto.UpdateApiInterfaceReq) (err error) {
|
||||
exist, err := dict.ApiInterface.GetOne(ctx, &dto.GetApiInterfaceReq{Id: req.Id})
|
||||
tenantId := utils.GetCurrentTenantId(ctx)
|
||||
|
||||
exist, err := dict.ApiInterface.GetOne(ctx, &dto.GetApiInterfaceReq{Id: req.Id}, tenantId)
|
||||
if err != nil || exist == nil {
|
||||
return errors.New("接口不存在")
|
||||
}
|
||||
@@ -148,7 +154,7 @@ func (s *apiInterfaceService) Update(ctx context.Context, req *dto.UpdateApiInte
|
||||
interfaces, _, err := dict.ApiInterface.List(ctx, &dto.ListApiInterfaceReq{
|
||||
PlatformId: platformId,
|
||||
Code: req.Code,
|
||||
})
|
||||
}, tenantId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -158,26 +164,29 @@ func (s *apiInterfaceService) Update(ctx context.Context, req *dto.UpdateApiInte
|
||||
}
|
||||
|
||||
currentUser := utils.GetCurrentUser(ctx)
|
||||
_, err = dict.ApiInterface.Update(ctx, req, currentUser)
|
||||
_, err = dict.ApiInterface.Update(ctx, req, currentUser, tenantId)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus 更新接口状态
|
||||
func (s *apiInterfaceService) UpdateStatus(ctx context.Context, req *dto.UpdateApiInterfaceStatusReq) (err error) {
|
||||
tenantId := utils.GetCurrentTenantId(ctx)
|
||||
currentUser := utils.GetCurrentUser(ctx)
|
||||
_, err = dict.ApiInterface.UpdateStatus(ctx, req.Id, req.Status.String(), currentUser)
|
||||
_, err = dict.ApiInterface.UpdateStatus(ctx, req.Id, req.Status.String(), currentUser, tenantId)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除接口
|
||||
func (s *apiInterfaceService) Delete(ctx context.Context, req *dto.DeleteApiInterfaceReq) (err error) {
|
||||
_, err = dict.ApiInterface.Delete(ctx, req)
|
||||
tenantId := utils.GetCurrentTenantId(ctx)
|
||||
_, err = dict.ApiInterface.Delete(ctx, req, tenantId)
|
||||
return
|
||||
}
|
||||
|
||||
// GetByIds 根据ID列表获取接口
|
||||
func (s *apiInterfaceService) GetByIds(ctx context.Context, ids []int64) (res []entity.ApiInterface, err error) {
|
||||
return dict.ApiInterface.GetByIds(ctx, ids)
|
||||
tenantId := utils.GetCurrentTenantId(ctx)
|
||||
return dict.ApiInterface.GetByIds(ctx, ids, tenantId)
|
||||
}
|
||||
|
||||
// getStatusName 获取状态名称
|
||||
|
||||
Reference in New Issue
Block a user