reface to openteam

This commit is contained in:
Sakurasan
2025-04-16 18:01:27 +08:00
parent bc223d6530
commit e7ffc9e8b9
92 changed files with 5345 additions and 1273 deletions

48
internal/consts/consts.go Normal file
View File

@@ -0,0 +1,48 @@
package consts
import "gorm.io/gorm"
const SecretKey = "openteam"
const Day = 24 * 60 * 60 // day := 86400
type UserRole int
const (
RoleUser UserRole = iota * 10
RoleAdmin
RoleRoot
)
const (
StatusDisabled = iota
StatusEnabled
StatusExpired // 过期
StatusExhausted // 耗尽
StatusDeleted = -1
)
const (
Limited = iota
Unlimited
UnlimitedQuota = 999999
)
var (
ErrUserNotFound = gorm.ErrRecordNotFound
)
func OpenOrClose(status bool) int {
if status {
return StatusEnabled
}
return StatusDisabled
}
// type DBType int
// const (
// DBTypeMySQL DBType = iota
// DBTypePostgreSQL
// DBTypeSQLite
// )