🐛修复客户端链接列表的bug
All checks were successful
continuous-integration/drone/tag Build is passing

This commit is contained in:
coward 2024-08-21 14:12:43 +08:00
parent 32f61a0eef
commit 299ec93199
2 changed files with 18 additions and 2 deletions

View File

@ -80,11 +80,11 @@ func (DashboardApi) ConnectionList(c *gin.Context) {
connections = append(connections, vo.DataTraffic{ connections = append(connections, vo.DataTraffic{
Name: clientInfo.Name, Name: clientInfo.Name,
Email: clientInfo.Email, Email: clientInfo.Email,
IpAllocation: clientInfo.IpAllocation, IpAllocation: ipAllocation,
Online: time.Since(peer.LastHandshakeTime).Minutes() < 3, Online: time.Since(peer.LastHandshakeTime).Minutes() < 3,
ReceiveBytes: utils.FlowCalculation().Parse(peer.TransmitBytes), ReceiveBytes: utils.FlowCalculation().Parse(peer.TransmitBytes),
TransmitBytes: utils.FlowCalculation().Parse(peer.ReceiveBytes), TransmitBytes: utils.FlowCalculation().Parse(peer.ReceiveBytes),
ConnectEndpoint: ipAllocation, ConnectEndpoint: peer.Endpoint.String(),
LastHandAt: peer.LastHandshakeTime.Format("2006-01-02 15:04:05"), LastHandAt: peer.LastHandshakeTime.Format("2006-01-02 15:04:05"),
}) })
} }

16
model/oauth_client.go Normal file
View File

@ -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"
}