feat:完善信息

This commit is contained in:
henry
2021-10-09 11:55:54 +08:00
parent 2191f0ea3f
commit af44287b4a
19 changed files with 368 additions and 12 deletions

View File

@ -2,6 +2,7 @@ package model
import (
"SciencesServer/serve/orm"
"SciencesServer/utils"
"fmt"
"strings"
"time"
@ -12,6 +13,7 @@ import (
// IModel
type IModel interface {
GetID() uint64
GetEncodeID() string
TableName() string
SetDatabase(database string, key ...string)
}
@ -66,6 +68,10 @@ func (m *Model) GetID() uint64 {
return m.ID
}
func (m *Model) GetEncodeID() string {
return utils.HASHIDEncode(int(m.ID))
}
func (m *Model) SetDatabase(database string, key ...string) {
m.Database = database + "_" + strings.Join(key, "_")
}