From 299ec93199d16fa2fec1b5120f34972bb928527c Mon Sep 17 00:00:00 2001 From: coward Date: Wed, 21 Aug 2024 14:12:43 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=E4=BF=AE=E5=A4=8D=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E9=93=BE=E6=8E=A5=E5=88=97=E8=A1=A8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- http/api/dashboard.go | 4 ++-- model/oauth_client.go | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 model/oauth_client.go diff --git a/http/api/dashboard.go b/http/api/dashboard.go index f02a4d7..cde9367 100644 --- a/http/api/dashboard.go +++ b/http/api/dashboard.go @@ -80,11 +80,11 @@ func (DashboardApi) ConnectionList(c *gin.Context) { connections = append(connections, vo.DataTraffic{ Name: clientInfo.Name, Email: clientInfo.Email, - IpAllocation: clientInfo.IpAllocation, + IpAllocation: ipAllocation, Online: time.Since(peer.LastHandshakeTime).Minutes() < 3, ReceiveBytes: utils.FlowCalculation().Parse(peer.TransmitBytes), TransmitBytes: utils.FlowCalculation().Parse(peer.ReceiveBytes), - ConnectEndpoint: ipAllocation, + ConnectEndpoint: peer.Endpoint.String(), LastHandAt: peer.LastHandshakeTime.Format("2006-01-02 15:04:05"), }) } diff --git a/model/oauth_client.go b/model/oauth_client.go new file mode 100644 index 0000000..89674ee --- /dev/null +++ b/model/oauth_client.go @@ -0,0 +1,16 @@ +package model + +// AuthClient +// @description: 认证客户端 +type AuthClient struct { + Base + Name string `json:"name" gorm:"type:varchar(255);not null;comment: '客户端名称'"` + ClientID string `json:"clientID" gorm:"type:varchar(255);not null;comment: '客户端ID'"` + ClientKey string `json:"clientKey" gorm:"type:varchar(255);not null;comment: '客户端key'"` + ExpireAt string `json:"expireAt" gorm:"type:varchar(255);not null;comment: '过期时间'"` + IsEnabled int `json:"isEnabled" gorm:"type:int(1);not null;comment: '是否启用'"` +} + +func (AuthClient) TableName() string { + return "t_oauth_client" +}