mirror of https://github.com/bjdgyc/anylink.git
修改数据库表
This commit is contained in:
parent
8ff77626d0
commit
e4f959cb69
|
@ -29,20 +29,20 @@ type ValData struct {
|
|||
Note string `json:"note"`
|
||||
}
|
||||
|
||||
type Group struct {
|
||||
Id int `json:"id" xorm:"pk autoincr not null"`
|
||||
Name string `json:"name" xorm:"not null unique"`
|
||||
Note string `json:"note"`
|
||||
AllowLan bool `json:"allow_lan"`
|
||||
ClientDns []ValData `json:"client_dns"`
|
||||
RouteInclude []ValData `json:"route_include"`
|
||||
RouteExclude []ValData `json:"route_exclude"`
|
||||
LinkAcl []GroupLinkAcl `json:"link_acl"`
|
||||
Bandwidth int `json:"bandwidth"` // 带宽限制
|
||||
Status int8 `json:"status"` // 1正常
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
// type Group struct {
|
||||
// Id int `json:"id" xorm:"pk autoincr not null"`
|
||||
// Name string `json:"name" xorm:"not null unique"`
|
||||
// Note string `json:"note"`
|
||||
// AllowLan bool `json:"allow_lan"`
|
||||
// ClientDns []ValData `json:"client_dns"`
|
||||
// RouteInclude []ValData `json:"route_include"`
|
||||
// RouteExclude []ValData `json:"route_exclude"`
|
||||
// LinkAcl []GroupLinkAcl `json:"link_acl"`
|
||||
// Bandwidth int `json:"bandwidth"` // 带宽限制
|
||||
// Status int8 `json:"status"` // 1正常
|
||||
// CreatedAt time.Time `json:"created_at"`
|
||||
// UpdatedAt time.Time `json:"updated_at"`
|
||||
// }
|
||||
|
||||
func GetGroupNames() []string {
|
||||
var datas []Group
|
||||
|
|
|
@ -5,17 +5,17 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
type IpMap struct {
|
||||
Id int `json:"id" xorm:"pk autoincr not null"`
|
||||
IpAddr string `json:"ip_addr" xorm:"not null unique"`
|
||||
MacAddr string `json:"mac_addr" xorm:"not null unique"`
|
||||
Username string `json:"username"`
|
||||
Keep bool `json:"keep"` // 保留 ip-mac 绑定
|
||||
KeepTime time.Time `json:"keep_time"`
|
||||
Note string `json:"note"` // 备注
|
||||
LastLogin time.Time `json:"last_login"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
// type IpMap struct {
|
||||
// Id int `json:"id" xorm:"pk autoincr not null"`
|
||||
// IpAddr string `json:"ip_addr" xorm:"not null unique"`
|
||||
// MacAddr string `json:"mac_addr" xorm:"not null unique"`
|
||||
// Username string `json:"username"`
|
||||
// Keep bool `json:"keep"` // 保留 ip-mac 绑定
|
||||
// KeepTime time.Time `json:"keep_time"`
|
||||
// Note string `json:"note"` // 备注
|
||||
// LastLogin time.Time `json:"last_login"`
|
||||
// UpdatedAt time.Time `json:"updated_at"`
|
||||
// }
|
||||
|
||||
func SetIpMap(v *IpMap) error {
|
||||
var err error
|
||||
|
|
|
@ -10,12 +10,6 @@ const (
|
|||
InstallData = "OK"
|
||||
)
|
||||
|
||||
type Setting struct {
|
||||
Id int `json:"id" xorm:"pk autoincr not null"`
|
||||
Name string `json:"name" xorm:"not null unique"`
|
||||
Data string `json:"data" xorm:"Text"`
|
||||
}
|
||||
|
||||
type SettingSmtp struct {
|
||||
Host string `json:"host"`
|
||||
Port int `json:"port"`
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package dbdata
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Group struct {
|
||||
Id int `json:"id" xorm:"pk autoincr not null"`
|
||||
Name string `json:"name" xorm:"varchar(255) not null index(idx_code) unique"`
|
||||
Note string `json:"note" xorm:"varchar(255)"`
|
||||
AllowLan bool `json:"allow_lan" xorm:"Bool"`
|
||||
ClientDns []ValData `json:"client_dns" xorm:"Text"`
|
||||
RouteInclude []ValData `json:"route_include" xorm:"Text"`
|
||||
RouteExclude []ValData `json:"route_exclude" xorm:"Text"`
|
||||
LinkAcl []GroupLinkAcl `json:"link_acl" xorm:"Text"`
|
||||
Bandwidth int `json:"bandwidth" xorm:"Int"` // 带宽限制
|
||||
Status int8 `json:"status" xorm:"Int"` // 1正常
|
||||
CreatedAt time.Time `json:"created_at" xorm:"DateTime"`
|
||||
UpdatedAt time.Time `json:"updated_at" xorm:"DateTime"`
|
||||
}
|
||||
|
||||
type User struct {
|
||||
Id int `json:"id" xorm:"pk autoincr not null"`
|
||||
Username string `json:"username" xorm:"varchar(255) not null index(idx_code) unique"`
|
||||
Nickname string `json:"nickname" xorm:"varchar(255)"`
|
||||
Email string `json:"email" xorm:"varchar(255)"`
|
||||
// Password string `json:"password"`
|
||||
PinCode string `json:"pin_code" xorm:"varchar(255)"`
|
||||
OtpSecret string `json:"otp_secret" xorm:"varchar(255)"`
|
||||
DisableOtp bool `json:"disable_otp" xorm:"Bool"` // 禁用otp
|
||||
Groups []string `json:"groups" xorm:"Text"`
|
||||
Status int8 `json:"status" xorm:"Int"` // 1正常
|
||||
SendEmail bool `json:"send_email" xorm:"Bool"`
|
||||
CreatedAt time.Time `json:"created_at" xorm:"DateTime"`
|
||||
UpdatedAt time.Time `json:"updated_at" xorm:"DateTime"`
|
||||
}
|
||||
|
||||
type IpMap struct {
|
||||
Id int `json:"id" xorm:"pk autoincr not null"`
|
||||
IpAddr string `json:"ip_addr" xorm:"Text"`
|
||||
MacAddr string `json:"mac_addr" xorm:"varchar(32) index(idx_macaddr)"`
|
||||
Username string `json:"username" xorm:"varchar(255)"`
|
||||
Keep bool `json:"keep" xorm:"Bool"` // 保留 ip-mac 绑定
|
||||
KeepTime time.Time `json:"keep_time" xorm:"DateTime"`
|
||||
Note string `json:"note" xorm:"varchar(255)"` // 备注
|
||||
LastLogin time.Time `json:"last_login" xorm:"DateTime"`
|
||||
UpdatedAt time.Time `json:"updated_at" xorm:"DateTime"`
|
||||
}
|
||||
|
||||
type Setting struct {
|
||||
Id int `json:"id" xorm:"pk autoincr not null"`
|
||||
Name string `json:"name" xorm:"not null unique"`
|
||||
Data string `json:"data" xorm:"Text"`
|
||||
}
|
|
@ -10,21 +10,21 @@ import (
|
|||
"github.com/xlzd/gotp"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
Id int `json:"id" xorm:"pk autoincr not null"`
|
||||
Username string `json:"username" storm:"not null unique"`
|
||||
Nickname string `json:"nickname"`
|
||||
Email string `json:"email"`
|
||||
// Password string `json:"password"`
|
||||
PinCode string `json:"pin_code"`
|
||||
OtpSecret string `json:"otp_secret"`
|
||||
DisableOtp bool `json:"disable_otp"` // 禁用otp
|
||||
Groups []string `json:"groups"`
|
||||
Status int8 `json:"status"` // 1正常
|
||||
SendEmail bool `json:"send_email"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
// type User struct {
|
||||
// Id int `json:"id" xorm:"pk autoincr not null"`
|
||||
// Username string `json:"username" storm:"not null unique"`
|
||||
// Nickname string `json:"nickname"`
|
||||
// Email string `json:"email"`
|
||||
// // Password string `json:"password"`
|
||||
// PinCode string `json:"pin_code"`
|
||||
// OtpSecret string `json:"otp_secret"`
|
||||
// DisableOtp bool `json:"disable_otp"` // 禁用otp
|
||||
// Groups []string `json:"groups"`
|
||||
// Status int8 `json:"status"` // 1正常
|
||||
// SendEmail bool `json:"send_email"`
|
||||
// CreatedAt time.Time `json:"created_at"`
|
||||
// UpdatedAt time.Time `json:"updated_at"`
|
||||
// }
|
||||
|
||||
func SetUser(v *User) error {
|
||||
var err error
|
||||
|
|
Loading…
Reference in New Issue