客户端授权验证

This commit is contained in:
奶爸
2019-12-09 16:02:49 +08:00
parent 986dc6114a
commit 58277ba0b6
13 changed files with 211 additions and 73 deletions

View File

@@ -1,6 +1,7 @@
package main
import (
"fmt"
"time"
"github.com/jinzhu/gorm"
@@ -36,6 +37,12 @@ func init() {
func initDB() {
dao.DB.AutoMigrate(model.Server{})
// load cache
var servers []model.Server
dao.DB.Find(&servers)
for _, s := range servers {
dao.Cache.Set(fmt.Sprintf("%s%d%s", model.CtxKeyServer, s.ID, s.Secret), s, cache.NoExpiration)
}
}
func main() {