56 lines
1.9 KiB
Go
56 lines
1.9 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)
|
|
}
|
|
|
|
// Remark 写账号备注
|
|
func (c *cAdmin) Remark(ctx context.Context, req *dto.AdminRemarkReq) (*dto.AdminRemarkRes, error) {
|
|
return service.License.AdminRemark(ctx, req)
|
|
}
|
|
|
|
// ListAppVersions 版本记录列表
|
|
func (c *cAdmin) ListAppVersions(ctx context.Context, req *dto.AdminAppVersionListReq) (*dto.AdminAppVersionListRes, error) {
|
|
return service.AppVersion.AdminListVersions(ctx, req)
|
|
}
|
|
|
|
// AddAppVersion 新增版本记录
|
|
func (c *cAdmin) AddAppVersion(ctx context.Context, req *dto.AdminAppVersionAddReq) (*dto.AdminAppVersionAddRes, error) {
|
|
return service.AppVersion.AdminAddVersion(ctx, req)
|
|
}
|
|
|
|
// DeleteAppVersion 删除版本记录
|
|
func (c *cAdmin) DeleteAppVersion(ctx context.Context, req *dto.AdminAppVersionDeleteReq) (*dto.AdminAppVersionDeleteRes, error) {
|
|
return service.AppVersion.AdminDeleteVersion(ctx, req)
|
|
}
|