Files
data-engine/controller/dict/api_interface_controller.go

54 lines
2.1 KiB
Go
Raw Normal View History

2026-04-02 11:51:44 +08:00
package dict
import (
"context"
2026-04-30 13:45:41 +08:00
dto "dataengine/model/dto/dict"
service "dataengine/service/dict"
2026-04-02 11:51:44 +08:00
"gitea.com/red-future/common/beans"
)
type apiInterfaceController struct{}
// ApiInterface 接口控制器
var ApiInterface = new(apiInterfaceController)
// CreateApiInterface 创建接口
func (c *apiInterfaceController) CreateApiInterface(ctx context.Context, req *dto.CreateApiInterfaceReq) (res *dto.CreateApiInterfaceRes, err error) {
2026-06-01 14:08:17 +08:00
ctx = context.WithValue(ctx, "user", &beans.User{UserName: "admin", TenantId: 1})
2026-04-02 11:51:44 +08:00
return service.ApiInterface.Create(ctx, req)
}
// ListApiInterface 获取接口列表
func (c *apiInterfaceController) ListApiInterface(ctx context.Context, req *dto.ListApiInterfaceReq) (res *dto.ListApiInterfaceRes, err error) {
2026-06-01 14:08:17 +08:00
ctx = context.WithValue(ctx, "user", &beans.User{UserName: "admin", TenantId: 1})
2026-04-02 11:51:44 +08:00
return service.ApiInterface.List(ctx, req)
}
// GetApiInterface 获取接口详情
func (c *apiInterfaceController) GetApiInterface(ctx context.Context, req *dto.GetApiInterfaceReq) (res *dto.GetApiInterfaceRes, err error) {
2026-06-01 14:08:17 +08:00
ctx = context.WithValue(ctx, "user", &beans.User{UserName: "admin", TenantId: 1})
2026-04-02 11:51:44 +08:00
return service.ApiInterface.GetOne(ctx, req)
}
// UpdateApiInterface 更新接口
func (c *apiInterfaceController) UpdateApiInterface(ctx context.Context, req *dto.UpdateApiInterfaceReq) (res *beans.ResponseEmpty, err error) {
2026-06-01 14:08:17 +08:00
ctx = context.WithValue(ctx, "user", &beans.User{UserName: "admin", TenantId: 1})
2026-04-02 11:51:44 +08:00
err = service.ApiInterface.Update(ctx, req)
return
}
// UpdateApiInterfaceStatus 更新接口状态
func (c *apiInterfaceController) UpdateApiInterfaceStatus(ctx context.Context, req *dto.UpdateApiInterfaceStatusReq) (res *beans.ResponseEmpty, err error) {
2026-06-01 14:08:17 +08:00
ctx = context.WithValue(ctx, "user", &beans.User{UserName: "admin", TenantId: 1})
2026-04-02 11:51:44 +08:00
err = service.ApiInterface.UpdateStatus(ctx, req)
return
}
// DeleteApiInterface 删除接口
func (c *apiInterfaceController) DeleteApiInterface(ctx context.Context, req *dto.DeleteApiInterfaceReq) (res *beans.ResponseEmpty, err error) {
2026-06-01 14:08:17 +08:00
ctx = context.WithValue(ctx, "user", &beans.User{UserName: "admin", TenantId: 1})
2026-04-02 11:51:44 +08:00
err = service.ApiInterface.Delete(ctx, req)
return
}