chore: 并入 iotlcm-admin-svr 历史到 admin-svr/(原提交 49818c6)
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
)
|
||||
|
||||
// List 查看API集成列表
|
||||
func (c *ControllerV1) TApiList(ctx context.Context, req *v1.TApiListReq) (res *v1.TApiListRes, err error) {
|
||||
list, totalCount, err := service.AgentTApi().List(ctx, &req.TApiListParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*model.TApiListModel{}
|
||||
}
|
||||
|
||||
res = new(v1.TApiListRes)
|
||||
res.Items = list
|
||||
res.PageResult.Page = req.Page
|
||||
res.PageResult.PageSize = req.PageSize
|
||||
res.PageResult.Total = totalCount
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出API集成列表
|
||||
func (c *ControllerV1) TApiExport(ctx context.Context, req *v1.TApiExportReq) (res *v1.TApiExportRes, err error) {
|
||||
err = service.AgentTApi().Export(ctx, &req.TApiListParam)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新API集成
|
||||
func (c *ControllerV1) TApiEdit(ctx context.Context, req *v1.TApiEditReq) (res *v1.TApiEditRes, err error) {
|
||||
err = service.AgentTApi().Edit(ctx, &req.TApiEditParam)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定API集成信息
|
||||
func (c *ControllerV1) TApiView(ctx context.Context, req *v1.TApiViewReq) (res *v1.TApiViewRes, err error) {
|
||||
data, err := service.AgentTApi().View(ctx, &req.TApiViewParam)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(v1.TApiViewRes)
|
||||
res.TApiViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除API集成
|
||||
func (c *ControllerV1) TApiDelete(ctx context.Context, req *v1.TApiDeleteReq) (res *v1.TApiDeleteRes, err error) {
|
||||
err = service.AgentTApi().Delete(ctx, &req.TApiDeleteParam)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user