add oauth loginlog & fix bugs

This commit is contained in:
ljw
2024-09-19 10:44:49 +08:00
parent ebd1feb8d1
commit a4b413dadb
48 changed files with 3477 additions and 184 deletions

View File

@@ -709,6 +709,172 @@ const docTemplateadmin = `{
}
}
},
"/admin/loginLog/delete": {
"post": {
"security": [
{
"token": []
}
],
"description": "登录日志删除",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"登录日志"
],
"summary": "登录日志删除",
"parameters": [
{
"description": "登录日志信息",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/model.LoginLog"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
},
"/admin/loginLog/detail/{id}": {
"get": {
"security": [
{
"token": []
}
],
"description": "登录日志详情",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"登录日志"
],
"summary": "登录日志详情",
"parameters": [
{
"type": "integer",
"description": "ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/model.LoginLog"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
},
"/admin/loginLog/list": {
"get": {
"security": [
{
"token": []
}
],
"description": "登录日志列表",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"登录日志"
],
"summary": "登录日志列表",
"parameters": [
{
"type": "integer",
"description": "页码",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "页大小",
"name": "page_size",
"in": "query"
},
{
"type": "integer",
"description": "用户ID",
"name": "user_id",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/model.LoginLogList"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
},
"/admin/logout": {
"post": {
"description": "登出",
@@ -738,6 +904,280 @@ const docTemplateadmin = `{
}
}
},
"/admin/oauth/create": {
"post": {
"security": [
{
"token": []
}
],
"description": "创建Oauth",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Oauth"
],
"summary": "创建Oauth",
"parameters": [
{
"description": "Oauth信息",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/admin.OauthForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/model.Oauth"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
},
"/admin/oauth/delete": {
"post": {
"security": [
{
"token": []
}
],
"description": "Oauth删除",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Oauth"
],
"summary": "Oauth删除",
"parameters": [
{
"description": "Oauth信息",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/admin.OauthForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
},
"/admin/oauth/detail/{id}": {
"get": {
"security": [
{
"token": []
}
],
"description": "Oauth详情",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Oauth"
],
"summary": "Oauth详情",
"parameters": [
{
"type": "integer",
"description": "ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/model.Oauth"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
},
"/admin/oauth/list": {
"get": {
"security": [
{
"token": []
}
],
"description": "Oauth列表",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Oauth"
],
"summary": "Oauth列表",
"parameters": [
{
"type": "integer",
"description": "页码",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "页大小",
"name": "page_size",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/model.OauthList"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
},
"/admin/oauth/update": {
"post": {
"security": [
{
"token": []
}
],
"description": "Oauth编辑",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Oauth"
],
"summary": "Oauth编辑",
"parameters": [
{
"description": "Oauth信息",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/admin.OauthForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/model.OauthList"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
},
"/admin/peer/create": {
"post": {
"security": [
@@ -1646,6 +2086,55 @@ const docTemplateadmin = `{
}
}
},
"/admin/user/myOauth": {
"get": {
"security": [
{
"token": []
}
],
"description": "我的授权",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"用户"
],
"summary": "我的授权",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Response"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/admin.UserOauthItem"
}
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
},
"/admin/user/update": {
"post": {
"security": [
@@ -1760,6 +2249,9 @@ const docTemplateadmin = `{
"password": {
"type": "string"
},
"platform": {
"type": "string"
},
"username": {
"type": "string"
}
@@ -1877,6 +2369,35 @@ const docTemplateadmin = `{
}
}
},
"admin.OauthForm": {
"type": "object",
"required": [
"client_id",
"client_secret",
"op",
"redirect_url"
],
"properties": {
"auto_register": {
"type": "boolean"
},
"client_id": {
"type": "string"
},
"client_secret": {
"type": "string"
},
"id": {
"type": "integer"
},
"op": {
"type": "string"
},
"redirect_url": {
"type": "string"
}
}
},
"admin.PeerForm": {
"type": "object",
"properties": {
@@ -1971,6 +2492,17 @@ const docTemplateadmin = `{
}
}
},
"admin.UserOauthItem": {
"type": "object",
"properties": {
"status": {
"type": "integer"
},
"third_type": {
"type": "string"
}
}
},
"admin.UserPasswordForm": {
"type": "object",
"required": [
@@ -2110,6 +2642,110 @@ const docTemplateadmin = `{
}
}
},
"model.LoginLog": {
"type": "object",
"properties": {
"client": {
"description": "webadmin,webclient,app,",
"type": "string"
},
"created_at": {
"type": "string"
},
"id": {
"type": "integer"
},
"ip": {
"type": "string"
},
"platform": {
"description": "windows,linux,mac,android,ios",
"type": "string"
},
"type": {
"description": "account,oauth",
"type": "string"
},
"updated_at": {
"type": "string"
},
"user_id": {
"type": "integer"
},
"uuid": {
"type": "string"
}
}
},
"model.LoginLogList": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/model.LoginLog"
}
},
"page": {
"type": "integer"
},
"page_size": {
"type": "integer"
},
"total": {
"type": "integer"
}
}
},
"model.Oauth": {
"type": "object",
"properties": {
"auto_register": {
"type": "boolean"
},
"client_id": {
"type": "string"
},
"client_secret": {
"type": "string"
},
"created_at": {
"type": "string"
},
"id": {
"type": "integer"
},
"op": {
"type": "string"
},
"redirect_url": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
"model.OauthList": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/model.Oauth"
}
},
"page": {
"type": "integer"
},
"page_size": {
"type": "integer"
},
"total": {
"type": "integer"
}
}
},
"model.Peer": {
"type": "object",
"properties": {