package admin import ( "context" "github.com/gogf/gf/v2/frame/g" "service.xpcool.com/internal/middleware" ) // Controller implements the permission-protected /admin/v1 endpoints // (RBAC management, logs, etc.). Bind behind AdminAuth (X-Permission). type Controller struct{} // New creates the protected admin controller. func New() *Controller { return &Controller{} } // adminID returns the authenticated admin id stored by the auth middleware. func adminID(ctx context.Context) uint64 { return g.RequestFromCtx(ctx).GetCtxVar(middleware.AdminIDKey).Uint64() }