mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-10 10:33:41 +08:00
feat: Implement API endpoints for user management and information retrieval
- Added new API endpoints for user information retrieval, registration, login, logout, self-management, administration, options management, channel management, token management, redemption management, log management, and group retrieval - Improved authentication flow with GitHub, WeChat, and email - Added a function `GetSelfByToken` for getting user information using an OpenAI API token
This commit is contained in:
@@ -312,6 +312,16 @@ func GetAffCode(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// GetSelfByToken get user by openai api token
|
||||
func GetSelfByToken(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"uid": c.GetInt("id"),
|
||||
"token_id": c.GetInt("token_id"),
|
||||
"username": c.GetString("username"),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func GetSelf(c *gin.Context) {
|
||||
id := c.GetInt("id")
|
||||
user, err := model.GetUserById(id, false)
|
||||
|
||||
Reference in New Issue
Block a user