fix group peers
This commit is contained in:
@@ -1185,7 +1185,7 @@ const docTemplateadmin = `{
|
|||||||
"token": []
|
"token": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "创建机器",
|
"description": "创建设备",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -1193,12 +1193,12 @@ const docTemplateadmin = `{
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"机器"
|
"设备"
|
||||||
],
|
],
|
||||||
"summary": "创建机器",
|
"summary": "创建设备",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"description": "机器信息",
|
"description": "设备信息",
|
||||||
"name": "body",
|
"name": "body",
|
||||||
"in": "body",
|
"in": "body",
|
||||||
"required": true,
|
"required": true,
|
||||||
@@ -1242,7 +1242,7 @@ const docTemplateadmin = `{
|
|||||||
"token": []
|
"token": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "机器删除",
|
"description": "设备删除",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -1250,12 +1250,12 @@ const docTemplateadmin = `{
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"机器"
|
"设备"
|
||||||
],
|
],
|
||||||
"summary": "机器删除",
|
"summary": "设备删除",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"description": "机器信息",
|
"description": "设备信息",
|
||||||
"name": "body",
|
"name": "body",
|
||||||
"in": "body",
|
"in": "body",
|
||||||
"required": true,
|
"required": true,
|
||||||
@@ -1287,7 +1287,7 @@ const docTemplateadmin = `{
|
|||||||
"token": []
|
"token": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "机器详情",
|
"description": "设备详情",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -1295,9 +1295,9 @@ const docTemplateadmin = `{
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"机器"
|
"设备"
|
||||||
],
|
],
|
||||||
"summary": "机器详情",
|
"summary": "设备详情",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
@@ -1342,7 +1342,7 @@ const docTemplateadmin = `{
|
|||||||
"token": []
|
"token": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "机器列表",
|
"description": "设备列表",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -1350,9 +1350,9 @@ const docTemplateadmin = `{
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"机器"
|
"设备"
|
||||||
],
|
],
|
||||||
"summary": "机器列表",
|
"summary": "设备列表",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
@@ -1402,7 +1402,7 @@ const docTemplateadmin = `{
|
|||||||
"token": []
|
"token": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "机器编辑",
|
"description": "设备编辑",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -1410,12 +1410,12 @@ const docTemplateadmin = `{
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"机器"
|
"设备"
|
||||||
],
|
],
|
||||||
"summary": "机器编辑",
|
"summary": "设备编辑",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"description": "机器信息",
|
"description": "设备信息",
|
||||||
"name": "body",
|
"name": "body",
|
||||||
"in": "body",
|
"in": "body",
|
||||||
"required": true,
|
"required": true,
|
||||||
@@ -2278,7 +2278,7 @@ const docTemplateadmin = `{
|
|||||||
"id": {
|
"id": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"login_name": {
|
"loginName": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"online": {
|
"online": {
|
||||||
@@ -2290,16 +2290,16 @@ const docTemplateadmin = `{
|
|||||||
"platform": {
|
"platform": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"rdp_port": {
|
"rdpPort": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"rdp_username": {
|
"rdpUsername": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"row_id": {
|
"row_id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"same_server": {
|
"sameServer": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"tags": {
|
"tags": {
|
||||||
|
|||||||
@@ -1178,7 +1178,7 @@
|
|||||||
"token": []
|
"token": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "创建机器",
|
"description": "创建设备",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -1186,12 +1186,12 @@
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"机器"
|
"设备"
|
||||||
],
|
],
|
||||||
"summary": "创建机器",
|
"summary": "创建设备",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"description": "机器信息",
|
"description": "设备信息",
|
||||||
"name": "body",
|
"name": "body",
|
||||||
"in": "body",
|
"in": "body",
|
||||||
"required": true,
|
"required": true,
|
||||||
@@ -1235,7 +1235,7 @@
|
|||||||
"token": []
|
"token": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "机器删除",
|
"description": "设备删除",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -1243,12 +1243,12 @@
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"机器"
|
"设备"
|
||||||
],
|
],
|
||||||
"summary": "机器删除",
|
"summary": "设备删除",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"description": "机器信息",
|
"description": "设备信息",
|
||||||
"name": "body",
|
"name": "body",
|
||||||
"in": "body",
|
"in": "body",
|
||||||
"required": true,
|
"required": true,
|
||||||
@@ -1280,7 +1280,7 @@
|
|||||||
"token": []
|
"token": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "机器详情",
|
"description": "设备详情",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -1288,9 +1288,9 @@
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"机器"
|
"设备"
|
||||||
],
|
],
|
||||||
"summary": "机器详情",
|
"summary": "设备详情",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
@@ -1335,7 +1335,7 @@
|
|||||||
"token": []
|
"token": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "机器列表",
|
"description": "设备列表",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -1343,9 +1343,9 @@
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"机器"
|
"设备"
|
||||||
],
|
],
|
||||||
"summary": "机器列表",
|
"summary": "设备列表",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
@@ -1395,7 +1395,7 @@
|
|||||||
"token": []
|
"token": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "机器编辑",
|
"description": "设备编辑",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -1403,12 +1403,12 @@
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"机器"
|
"设备"
|
||||||
],
|
],
|
||||||
"summary": "机器编辑",
|
"summary": "设备编辑",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"description": "机器信息",
|
"description": "设备信息",
|
||||||
"name": "body",
|
"name": "body",
|
||||||
"in": "body",
|
"in": "body",
|
||||||
"required": true,
|
"required": true,
|
||||||
@@ -2271,7 +2271,7 @@
|
|||||||
"id": {
|
"id": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"login_name": {
|
"loginName": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"online": {
|
"online": {
|
||||||
@@ -2283,16 +2283,16 @@
|
|||||||
"platform": {
|
"platform": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"rdp_port": {
|
"rdpPort": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"rdp_username": {
|
"rdpUsername": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"row_id": {
|
"row_id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"same_server": {
|
"sameServer": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"tags": {
|
"tags": {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
id:
|
id:
|
||||||
type: string
|
type: string
|
||||||
login_name:
|
loginName:
|
||||||
type: string
|
type: string
|
||||||
online:
|
online:
|
||||||
type: boolean
|
type: boolean
|
||||||
@@ -32,13 +32,13 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
platform:
|
platform:
|
||||||
type: string
|
type: string
|
||||||
rdp_port:
|
rdpPort:
|
||||||
type: string
|
type: string
|
||||||
rdp_username:
|
rdpUsername:
|
||||||
type: string
|
type: string
|
||||||
row_id:
|
row_id:
|
||||||
type: integer
|
type: integer
|
||||||
same_server:
|
sameServer:
|
||||||
type: boolean
|
type: boolean
|
||||||
tags:
|
tags:
|
||||||
items:
|
items:
|
||||||
@@ -1162,9 +1162,9 @@ paths:
|
|||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: 创建机器
|
description: 创建设备
|
||||||
parameters:
|
parameters:
|
||||||
- description: 机器信息
|
- description: 设备信息
|
||||||
in: body
|
in: body
|
||||||
name: body
|
name: body
|
||||||
required: true
|
required: true
|
||||||
@@ -1188,16 +1188,16 @@ paths:
|
|||||||
$ref: '#/definitions/response.Response'
|
$ref: '#/definitions/response.Response'
|
||||||
security:
|
security:
|
||||||
- token: []
|
- token: []
|
||||||
summary: 创建机器
|
summary: 创建设备
|
||||||
tags:
|
tags:
|
||||||
- 机器
|
- 设备
|
||||||
/admin/peer/delete:
|
/admin/peer/delete:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: 机器删除
|
description: 设备删除
|
||||||
parameters:
|
parameters:
|
||||||
- description: 机器信息
|
- description: 设备信息
|
||||||
in: body
|
in: body
|
||||||
name: body
|
name: body
|
||||||
required: true
|
required: true
|
||||||
@@ -1216,14 +1216,14 @@ paths:
|
|||||||
$ref: '#/definitions/response.Response'
|
$ref: '#/definitions/response.Response'
|
||||||
security:
|
security:
|
||||||
- token: []
|
- token: []
|
||||||
summary: 机器删除
|
summary: 设备删除
|
||||||
tags:
|
tags:
|
||||||
- 机器
|
- 设备
|
||||||
/admin/peer/detail/{id}:
|
/admin/peer/detail/{id}:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: 机器详情
|
description: 设备详情
|
||||||
parameters:
|
parameters:
|
||||||
- description: ID
|
- description: ID
|
||||||
in: path
|
in: path
|
||||||
@@ -1248,14 +1248,14 @@ paths:
|
|||||||
$ref: '#/definitions/response.Response'
|
$ref: '#/definitions/response.Response'
|
||||||
security:
|
security:
|
||||||
- token: []
|
- token: []
|
||||||
summary: 机器详情
|
summary: 设备详情
|
||||||
tags:
|
tags:
|
||||||
- 机器
|
- 设备
|
||||||
/admin/peer/list:
|
/admin/peer/list:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: 机器列表
|
description: 设备列表
|
||||||
parameters:
|
parameters:
|
||||||
- description: 页码
|
- description: 页码
|
||||||
in: query
|
in: query
|
||||||
@@ -1283,16 +1283,16 @@ paths:
|
|||||||
$ref: '#/definitions/response.Response'
|
$ref: '#/definitions/response.Response'
|
||||||
security:
|
security:
|
||||||
- token: []
|
- token: []
|
||||||
summary: 机器列表
|
summary: 设备列表
|
||||||
tags:
|
tags:
|
||||||
- 机器
|
- 设备
|
||||||
/admin/peer/update:
|
/admin/peer/update:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: 机器编辑
|
description: 设备编辑
|
||||||
parameters:
|
parameters:
|
||||||
- description: 机器信息
|
- description: 设备信息
|
||||||
in: body
|
in: body
|
||||||
name: body
|
name: body
|
||||||
required: true
|
required: true
|
||||||
@@ -1316,9 +1316,9 @@ paths:
|
|||||||
$ref: '#/definitions/response.Response'
|
$ref: '#/definitions/response.Response'
|
||||||
security:
|
security:
|
||||||
- token: []
|
- token: []
|
||||||
summary: 机器编辑
|
summary: 设备编辑
|
||||||
tags:
|
tags:
|
||||||
- 机器
|
- 设备
|
||||||
/admin/server-config:
|
/admin/server-config:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
|
|||||||
4
go.mod
4
go.mod
@@ -3,6 +3,7 @@ module Gwen
|
|||||||
go 1.22
|
go 1.22
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/BurntSushi/toml v1.3.2
|
||||||
github.com/antonfisher/nested-logrus-formatter v1.3.1
|
github.com/antonfisher/nested-logrus-formatter v1.3.1
|
||||||
github.com/fsnotify/fsnotify v1.5.1
|
github.com/fsnotify/fsnotify v1.5.1
|
||||||
github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6
|
github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6
|
||||||
@@ -12,12 +13,14 @@ require (
|
|||||||
github.com/go-playground/validator/v10 v10.11.2
|
github.com/go-playground/validator/v10 v10.11.2
|
||||||
github.com/go-redis/redis/v8 v8.11.4
|
github.com/go-redis/redis/v8 v8.11.4
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.1
|
github.com/golang-jwt/jwt/v5 v5.2.1
|
||||||
|
github.com/nicksnyder/go-i18n/v2 v2.4.0
|
||||||
github.com/sirupsen/logrus v1.8.1
|
github.com/sirupsen/logrus v1.8.1
|
||||||
github.com/spf13/viper v1.9.0
|
github.com/spf13/viper v1.9.0
|
||||||
github.com/swaggo/files v1.0.1
|
github.com/swaggo/files v1.0.1
|
||||||
github.com/swaggo/gin-swagger v1.6.0
|
github.com/swaggo/gin-swagger v1.6.0
|
||||||
github.com/swaggo/swag v1.16.3
|
github.com/swaggo/swag v1.16.3
|
||||||
golang.org/x/oauth2 v0.23.0
|
golang.org/x/oauth2 v0.23.0
|
||||||
|
golang.org/x/text v0.15.0
|
||||||
gorm.io/driver/mysql v1.5.7
|
gorm.io/driver/mysql v1.5.7
|
||||||
gorm.io/driver/sqlite v1.5.6
|
gorm.io/driver/sqlite v1.5.6
|
||||||
gorm.io/gorm v1.25.7
|
gorm.io/gorm v1.25.7
|
||||||
@@ -66,7 +69,6 @@ require (
|
|||||||
golang.org/x/crypto v0.23.0 // indirect
|
golang.org/x/crypto v0.23.0 // indirect
|
||||||
golang.org/x/net v0.21.0 // indirect
|
golang.org/x/net v0.21.0 // indirect
|
||||||
golang.org/x/sys v0.25.0 // indirect
|
golang.org/x/sys v0.25.0 // indirect
|
||||||
golang.org/x/text v0.15.0 // indirect
|
|
||||||
golang.org/x/tools v0.7.0 // indirect
|
golang.org/x/tools v0.7.0 // indirect
|
||||||
google.golang.org/protobuf v1.33.0 // indirect
|
google.golang.org/protobuf v1.33.0 // indirect
|
||||||
gopkg.in/ini.v1 v1.63.2 // indirect
|
gopkg.in/ini.v1 v1.63.2 // indirect
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ import (
|
|||||||
type Peer struct {
|
type Peer struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detail 机器
|
// Detail 设备
|
||||||
// @Tags 机器
|
// @Tags 设备
|
||||||
// @Summary 机器详情
|
// @Summary 设备详情
|
||||||
// @Description 机器详情
|
// @Description 设备详情
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param id path int true "ID"
|
// @Param id path int true "ID"
|
||||||
@@ -35,13 +35,13 @@ func (ct *Peer) Detail(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create 创建机器
|
// Create 创建设备
|
||||||
// @Tags 机器
|
// @Tags 设备
|
||||||
// @Summary 创建机器
|
// @Summary 创建设备
|
||||||
// @Description 创建机器
|
// @Description 创建设备
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param body body admin.PeerForm true "机器信息"
|
// @Param body body admin.PeerForm true "设备信息"
|
||||||
// @Success 200 {object} response.Response{data=model.Peer}
|
// @Success 200 {object} response.Response{data=model.Peer}
|
||||||
// @Failure 500 {object} response.Response
|
// @Failure 500 {object} response.Response
|
||||||
// @Router /admin/peer/create [post]
|
// @Router /admin/peer/create [post]
|
||||||
@@ -67,9 +67,9 @@ func (ct *Peer) Create(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List 列表
|
// List 列表
|
||||||
// @Tags 机器
|
// @Tags 设备
|
||||||
// @Summary 机器列表
|
// @Summary 设备列表
|
||||||
// @Description 机器列表
|
// @Description 设备列表
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param page query int false "页码"
|
// @Param page query int false "页码"
|
||||||
@@ -89,12 +89,12 @@ func (ct *Peer) List(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update 编辑
|
// Update 编辑
|
||||||
// @Tags 机器
|
// @Tags 设备
|
||||||
// @Summary 机器编辑
|
// @Summary 设备编辑
|
||||||
// @Description 机器编辑
|
// @Description 设备编辑
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param body body admin.PeerForm true "机器信息"
|
// @Param body body admin.PeerForm true "设备信息"
|
||||||
// @Success 200 {object} response.Response{data=model.Peer}
|
// @Success 200 {object} response.Response{data=model.Peer}
|
||||||
// @Failure 500 {object} response.Response
|
// @Failure 500 {object} response.Response
|
||||||
// @Router /admin/peer/update [post]
|
// @Router /admin/peer/update [post]
|
||||||
@@ -124,12 +124,12 @@ func (ct *Peer) Update(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete 删除
|
// Delete 删除
|
||||||
// @Tags 机器
|
// @Tags 设备
|
||||||
// @Summary 机器删除
|
// @Summary 设备删除
|
||||||
// @Description 机器删除
|
// @Description 设备删除
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param body body admin.PeerForm true "机器信息"
|
// @Param body body admin.PeerForm true "设备信息"
|
||||||
// @Success 200 {object} response.Response
|
// @Success 200 {object} response.Response
|
||||||
// @Failure 500 {object} response.Response
|
// @Failure 500 {object} response.Response
|
||||||
// @Router /admin/peer/delete [post]
|
// @Router /admin/peer/delete [post]
|
||||||
|
|||||||
@@ -96,15 +96,15 @@ func (g *Group) Peers(c *gin.Context) {
|
|||||||
namesById[user.Id] = user.Username
|
namesById[user.Id] = user.Username
|
||||||
userIds = append(userIds, user.Id)
|
userIds = append(userIds, user.Id)
|
||||||
}
|
}
|
||||||
peerList := service.AllService.AddressBookService.ListByUserIds(userIds, q.Page, q.PageSize)
|
peerList := service.AllService.PeerService.ListByUserIds(userIds, q.Page, q.PageSize)
|
||||||
var data []*apiResp.GroupPeerPayload
|
var data []*apiResp.GroupPeerPayload
|
||||||
for _, ab := range peerList.AddressBooks {
|
for _, peer := range peerList.Peers {
|
||||||
uname, ok := namesById[ab.UserId]
|
uname, ok := namesById[peer.UserId]
|
||||||
if !ok {
|
if !ok {
|
||||||
uname = ""
|
uname = ""
|
||||||
}
|
}
|
||||||
pp := &apiResp.GroupPeerPayload{}
|
pp := &apiResp.GroupPeerPayload{}
|
||||||
pp.FromAddressBook(ab, uname)
|
pp.FromPeer(peer, uname)
|
||||||
data = append(data, pp)
|
data = append(data, pp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,5 +35,10 @@ func (i *Index) Index(c *gin.Context) {
|
|||||||
// @Failure 500 {object} response.Response
|
// @Failure 500 {object} response.Response
|
||||||
// @Router /heartbeat [post]
|
// @Router /heartbeat [post]
|
||||||
func (i *Index) Heartbeat(c *gin.Context) {
|
func (i *Index) Heartbeat(c *gin.Context) {
|
||||||
|
//b := &gin.H{}
|
||||||
|
//err := c.BindJSON(b)
|
||||||
|
//body : &map[id:ljwzhuwo modified_at:0 uuid:NGIxZTZjM2YtNmNkMy00YTMwLWFiNjQtMzQ0MTA0NGE5ZDgz ver:1.003e+06]
|
||||||
|
//fmt.Println(b, err, c.Request.Header)
|
||||||
|
//header : map[Accept:[*/*] Accept-Encoding:[gzip] Content-Length:[105] Content-Type:[application/json]]
|
||||||
c.JSON(http.StatusOK, gin.H{})
|
c.JSON(http.StatusOK, gin.H{})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ type AddressBookForm struct {
|
|||||||
Hash string `json:"hash"`
|
Hash string `json:"hash"`
|
||||||
UserId uint `json:"user_id"`
|
UserId uint `json:"user_id"`
|
||||||
ForceAlwaysRelay bool `json:"forceAlwaysRelay"`
|
ForceAlwaysRelay bool `json:"forceAlwaysRelay"`
|
||||||
RdpPort string `json:"rdp_port"`
|
RdpPort string `json:"rdpPort"`
|
||||||
RdpUsername string `json:"rdp_username"`
|
RdpUsername string `json:"rdpUsername"`
|
||||||
Online bool `json:"online"`
|
Online bool `json:"online"`
|
||||||
LoginName string `json:"login_name" `
|
LoginName string `json:"loginName" `
|
||||||
SameServer bool `json:"same_server"`
|
SameServer bool `json:"sameServer"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a AddressBookForm) ToAddressBook() *model.AddressBook {
|
func (a AddressBookForm) ToAddressBook() *model.AddressBook {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ func (gpp *GroupPeerPayload) FromAddressBook(a *model.AddressBook, username stri
|
|||||||
gpp.UserName = username
|
gpp.UserName = username
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gpp *GroupPeerPayload) FromPeer(p *model.Peer) {
|
func (gpp *GroupPeerPayload) FromPeer(p *model.Peer, username string) {
|
||||||
gpp.Id = p.Id
|
gpp.Id = p.Id
|
||||||
gpp.Info = &PeerPayloadInfo{
|
gpp.Info = &PeerPayloadInfo{
|
||||||
DeviceName: p.Hostname,
|
DeviceName: p.Hostname,
|
||||||
@@ -67,5 +67,5 @@ func (gpp *GroupPeerPayload) FromPeer(p *model.Peer) {
|
|||||||
Username: p.Username,
|
Username: p.Username,
|
||||||
}
|
}
|
||||||
gpp.Note = ""
|
gpp.Note = ""
|
||||||
gpp.UserName = p.User.Username
|
gpp.UserName = username
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,24 +15,38 @@ func (ps *PeerService) FindById(id string) *model.Peer {
|
|||||||
global.DB.Where("id = ?", id).First(p)
|
global.DB.Where("id = ?", id).First(p)
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
func (ps *PeerService) FindByUuid(uuid string) *model.Peer {
|
||||||
|
p := &model.Peer{}
|
||||||
|
global.DB.Where("uuid = ?", uuid).First(p)
|
||||||
|
return p
|
||||||
|
}
|
||||||
func (ps *PeerService) InfoByRowId(id uint) *model.Peer {
|
func (ps *PeerService) InfoByRowId(id uint) *model.Peer {
|
||||||
p := &model.Peer{}
|
p := &model.Peer{}
|
||||||
global.DB.Where("row_id = ?", id).First(p)
|
global.DB.Where("row_id = ?", id).First(p)
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
//// ListByUserIds 根据用户id取列表
|
// UuidBindUserId 绑定用户id
|
||||||
//func (ps *PeerService) ListByUserIds(userIds []uint, page, pageSize uint) (res *model.PeerList) {
|
func (ps *PeerService) UuidBindUserId(uuid string, userId uint) {
|
||||||
// res = &model.PeerList{}
|
peer := ps.FindByUuid(uuid)
|
||||||
// res.Page = int64(page)
|
if peer.RowId > 0 {
|
||||||
// res.PageSize = int64(pageSize)
|
peer.UserId = userId
|
||||||
// tx := global.DB.Model(&model.Peer{}).Preload("User")
|
ps.Update(peer)
|
||||||
// tx.Where("user_id in (?)", userIds)
|
}
|
||||||
// tx.Count(&res.Total)
|
}
|
||||||
// tx.Scopes(Paginate(page, pageSize))
|
|
||||||
// tx.Find(&res.Peers)
|
// ListByUserIds 根据用户id取列表
|
||||||
// return
|
func (ps *PeerService) ListByUserIds(userIds []uint, page, pageSize uint) (res *model.PeerList) {
|
||||||
//}
|
res = &model.PeerList{}
|
||||||
|
res.Page = int64(page)
|
||||||
|
res.PageSize = int64(pageSize)
|
||||||
|
tx := global.DB.Model(&model.Peer{})
|
||||||
|
tx.Where("user_id in (?)", userIds)
|
||||||
|
tx.Count(&res.Total)
|
||||||
|
tx.Scopes(Paginate(page, pageSize))
|
||||||
|
tx.Find(&res.Peers)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (ps *PeerService) List(page, pageSize uint, where func(tx *gorm.DB)) (res *model.PeerList) {
|
func (ps *PeerService) List(page, pageSize uint, where func(tx *gorm.DB)) (res *model.PeerList) {
|
||||||
res = &model.PeerList{}
|
res = &model.PeerList{}
|
||||||
|
|||||||
@@ -66,6 +66,9 @@ func (us *UserService) Login(u *model.User, llog *model.LoginLog) *model.UserTok
|
|||||||
}
|
}
|
||||||
global.DB.Create(ut)
|
global.DB.Create(ut)
|
||||||
global.DB.Create(llog)
|
global.DB.Create(llog)
|
||||||
|
if llog.Uuid != "" {
|
||||||
|
AllService.PeerService.UuidBindUserId(llog.Uuid, u.Id)
|
||||||
|
}
|
||||||
return ut
|
return ut
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user