syntax = "v1" import "common.api" // 管理员认证接口 - 强认证 // 管理员登录请求 type AdminLoginRequest { Username string `json:"username" validate:"required"` Password string `json:"password" validate:"required"` Captcha string `json:"captcha,optional"` // 验证码 (可选) } // 管理员登录响应 type AdminLoginResponse { BaseResponse Data AdminLoginData `json:"data"` } type AdminLoginData { Token string `json:"token"` RefreshToken string `json:"refresh_token"` Admin Admin `json:"admin"` ExpiresIn int64 `json:"expires_in"` // Token 过期时间 (秒) } // 管理员 Token 刷新请求 type AdminRefreshTokenRequest { RefreshToken string `json:"refresh_token" validate:"required"` } // 管理员 Token 刷新响应 type AdminRefreshTokenResponse { BaseResponse Data AdminRefreshTokenData `json:"data"` } type AdminRefreshTokenData { Token string `json:"token"` RefreshToken string `json:"refresh_token"` ExpiresIn int64 `json:"expires_in"` } // 管理员信息响应 type AdminProfileResponse { BaseResponse Data Admin `json:"data"` } // 管理员更新信息请求 type UpdateAdminProfileRequest { Username string `json:"username,optional"` Email string `json:"email,optional"` Avatar string `json:"avatar,optional"` } // 管理员更新信息响应 type UpdateAdminProfileResponse { BaseResponse Data Admin `json:"data"` } // 管理员修改密码请求 type ChangeAdminPasswordRequest { OldPassword string `json:"old_password" validate:"required"` NewPassword string `json:"new_password" validate:"required,min=8"` } // 管理员修改密码响应 type ChangeAdminPasswordResponse { BaseResponse } // 管理员登出响应 type AdminLogoutResponse { BaseResponse } // 管理员认证接口组 - 无需认证 @server( group: admin_auth prefix: /admin/auth ) service photography-api { @doc "管理员登录" @handler adminLogin post /login (AdminLoginRequest) returns (AdminLoginResponse) @doc "刷新管理员Token" @handler adminRefreshToken post /refresh (AdminRefreshTokenRequest) returns (AdminRefreshTokenResponse) } // 管理员认证接口组 - 需要认证 @server( group: admin_auth prefix: /admin/auth jwt: AdminAuth ) service photography-api { @doc "获取管理员信息" @handler getAdminProfile get /profile returns (AdminProfileResponse) @doc "更新管理员信息" @handler updateAdminProfile put /profile (UpdateAdminProfileRequest) returns (UpdateAdminProfileResponse) @doc "修改管理员密码" @handler changeAdminPassword post /change-password (ChangeAdminPasswordRequest) returns (ChangeAdminPasswordResponse) @doc "管理员登出" @handler adminLogout post /logout returns (AdminLogoutResponse) }