mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-09 02:33:43 +08:00
This commit is contained in:
35
server/internal/model/do/sys_serve_license.go
Normal file
35
server/internal/model/do/sys_serve_license.go
Normal file
@@ -0,0 +1,35 @@
|
||||
// =================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package do
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/encoding/gjson"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// SysServeLicense is the golang structure of table hg_sys_serve_license for DAO operations like Where/Data.
|
||||
type SysServeLicense struct {
|
||||
g.Meta `orm:"table:hg_sys_serve_license, do:true"`
|
||||
Id interface{} // 许可ID
|
||||
Group interface{} // 分组
|
||||
Name interface{} // 许可名称
|
||||
Appid interface{} // 应用ID
|
||||
SecretKey interface{} // 应用秘钥
|
||||
Desc interface{} // 授权说明
|
||||
RemoteAddr interface{} // 最后连接地址
|
||||
Online interface{} // 在线数量
|
||||
OnlineLimit interface{} // 在线数量限制,默认1
|
||||
LoginTimes interface{} // 登录次数
|
||||
LastLoginAt *gtime.Time // 最后登录时间
|
||||
LastActiveAt *gtime.Time // 最后活跃时间
|
||||
Routes *gjson.Json // 路由表,空使用默认分组路由
|
||||
AllowedIps interface{} // 白名单,*代表所有,只有允许的IP才能连接到tcp服务
|
||||
EndAt *gtime.Time // 授权结束时间
|
||||
Remark interface{} // 备注
|
||||
Status interface{} // 状态
|
||||
CreatedAt *gtime.Time // 创建时间
|
||||
UpdatedAt *gtime.Time // 修改时间
|
||||
}
|
||||
33
server/internal/model/entity/sys_serve_license.go
Normal file
33
server/internal/model/entity/sys_serve_license.go
Normal file
@@ -0,0 +1,33 @@
|
||||
// =================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package entity
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/encoding/gjson"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// SysServeLicense is the golang structure for table sys_serve_license.
|
||||
type SysServeLicense struct {
|
||||
Id int64 `json:"id" description:"许可ID"`
|
||||
Group string `json:"group" description:"分组"`
|
||||
Name string `json:"name" description:"许可名称"`
|
||||
Appid string `json:"appid" description:"应用ID"`
|
||||
SecretKey string `json:"secretKey" description:"应用秘钥"`
|
||||
Desc string `json:"desc" description:"授权说明"`
|
||||
RemoteAddr string `json:"remoteAddr" description:"最后连接地址"`
|
||||
Online int `json:"online" description:"在线数量"`
|
||||
OnlineLimit int `json:"onlineLimit" description:"在线数量限制,默认1"`
|
||||
LoginTimes int64 `json:"loginTimes" description:"登录次数"`
|
||||
LastLoginAt *gtime.Time `json:"lastLoginAt" description:"最后登录时间"`
|
||||
LastActiveAt *gtime.Time `json:"lastActiveAt" description:"最后活跃时间"`
|
||||
Routes *gjson.Json `json:"routes" description:"路由表,空使用默认分组路由"`
|
||||
AllowedIps string `json:"allowedIps" description:"白名单,*代表所有,只有允许的IP才能连接到tcp服务"`
|
||||
EndAt *gtime.Time `json:"endAt" description:"授权结束时间"`
|
||||
Remark string `json:"remark" description:"备注"`
|
||||
Status int `json:"status" description:"状态"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" description:"修改时间"`
|
||||
}
|
||||
19
server/internal/model/input/msgin/auth.go
Normal file
19
server/internal/model/input/msgin/auth.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package msgin
|
||||
|
||||
import "github.com/gogf/gf/v2/os/gtime"
|
||||
|
||||
// AuthSummary 授权摘要
|
||||
type AuthSummary struct {
|
||||
Request
|
||||
}
|
||||
|
||||
// ResponseAuthSummary 响应授权摘要
|
||||
type ResponseAuthSummary struct {
|
||||
Response
|
||||
Data *AuthSummaryData `json:"data,omitempty" description:"数据集"`
|
||||
}
|
||||
|
||||
type AuthSummaryData struct {
|
||||
EndAt *gtime.Time `json:"end_at" description:"授权过期时间"`
|
||||
Online int `json:"online" description:"在线人数"`
|
||||
}
|
||||
61
server/internal/model/input/msgin/common.go
Normal file
61
server/internal/model/input/msgin/common.go
Normal file
@@ -0,0 +1,61 @@
|
||||
package msgin
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"hotgo/utility/encrypt"
|
||||
)
|
||||
|
||||
type Request struct {
|
||||
AppId string `json:"appID" v:"0" example:"d0bb93048bc5c9164cdee845dcb7f820" description:"应用ID"`
|
||||
TraceID string `json:"traceID" v:"0" example:"d0bb93048bc5c9164cdee845dcb7f820" description:"链路ID"`
|
||||
Timestamp int64 `json:"timestamp" example:"1640966400" description:"服务器时间戳"`
|
||||
Sign string `json:"sign" example:"d0bb93048bc5c9164cdee845dcb7f820" description:"签名"`
|
||||
}
|
||||
|
||||
func (i *Request) SetSign(traceID, appId, secretKey string) {
|
||||
i.AppId = appId
|
||||
i.TraceID = traceID
|
||||
i.Timestamp = gtime.Timestamp()
|
||||
i.Sign = i.GetSign(secretKey)
|
||||
}
|
||||
|
||||
func (i *Request) GetSign(secretKey string) string {
|
||||
return encrypt.Md5ToString(fmt.Sprintf("%s%s%s%s", i.AppId, i.TraceID, i.Timestamp, secretKey))
|
||||
}
|
||||
|
||||
type Response struct {
|
||||
Code int `json:"code" example:"0" description:"状态码"`
|
||||
Message string `json:"message,omitempty" example:"操作成功" description:"提示消息"`
|
||||
//Data interface{} `json:"data,omitempty" description:"数据集"`
|
||||
}
|
||||
|
||||
// ServerHeartbeat 心跳
|
||||
type ServerHeartbeat struct {
|
||||
}
|
||||
|
||||
// ResponseServerHeartbeat 响应心跳
|
||||
type ResponseServerHeartbeat struct {
|
||||
Response
|
||||
}
|
||||
|
||||
// ServerLogin 服务登录
|
||||
type ServerLogin struct {
|
||||
Request
|
||||
Group string
|
||||
Name string
|
||||
}
|
||||
|
||||
// ResponseServerLogin 响应服务登录
|
||||
type ResponseServerLogin struct {
|
||||
Response
|
||||
}
|
||||
|
||||
// ServerOffline 服务离线
|
||||
type ServerOffline struct {
|
||||
}
|
||||
|
||||
// ResponseServerOffline 响应服务离线
|
||||
type ResponseServerOffline struct {
|
||||
Response
|
||||
}
|
||||
Reference in New Issue
Block a user