36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
package controller
|
|
|
|
import (
|
|
"context"
|
|
|
|
"observer-server/biz/model/dto"
|
|
"observer-server/biz/service"
|
|
)
|
|
|
|
// cAdmin 后台管理端接口:薄透传;service 按表归入各表文件
|
|
// (订单→service.Order、授权→service.License)。
|
|
// 独立 controller 聚合,避免同一 controller 挂客户端组 + 管理组时路由重复注册。
|
|
type cAdmin struct{}
|
|
|
|
var Admin = &cAdmin{}
|
|
|
|
// ListOrders 订单列表
|
|
func (c *cAdmin) ListOrders(ctx context.Context, req *dto.AdminOrderListReq) (*dto.AdminOrderListRes, error) {
|
|
return service.Order.AdminListOrders(ctx, req)
|
|
}
|
|
|
|
// ListLicenses 授权列表
|
|
func (c *cAdmin) ListLicenses(ctx context.Context, req *dto.AdminLicenseListReq) (*dto.AdminLicenseListRes, error) {
|
|
return service.License.AdminListLicenses(ctx, req)
|
|
}
|
|
|
|
// Grant 手动授权
|
|
func (c *cAdmin) Grant(ctx context.Context, req *dto.AdminGrantReq) (*dto.AdminGrantRes, error) {
|
|
return service.License.AdminGrant(ctx, req)
|
|
}
|
|
|
|
// Revoke 撤销授权
|
|
func (c *cAdmin) Revoke(ctx context.Context, req *dto.AdminRevokeReq) (*dto.AdminRevokeRes, error) {
|
|
return service.License.AdminRevoke(ctx, req)
|
|
}
|