忽略掉后台
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"fusenapi/utils/autoconfig"
|
||||
"fusenapi/initalize"
|
||||
"fusenapi/model/gmodel"
|
||||
|
||||
@@ -16,21 +17,25 @@ import (
|
||||
type ServiceContext struct {
|
||||
Config {{.config}}
|
||||
{{.middleware}}
|
||||
|
||||
SharedState *fsm.StateCluster
|
||||
MysqlConn *gorm.DB
|
||||
AllModels *gmodel.AllModelsGen
|
||||
}
|
||||
|
||||
func NewServiceContext(c {{.config}}) *ServiceContext {
|
||||
conn := initalize.InitMysql(c.SourceMysql)
|
||||
StateServer := fsm.StartNode(c.Name, fmt.Sprintf("localhost:%d", c.Port-2000), autoconfig.AutoGetAllServerConfig(), conn)
|
||||
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
MysqlConn: initalize.InitMysql(c.SourceMysql),
|
||||
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
|
||||
Config: c,
|
||||
MysqlConn: conn,
|
||||
SharedState: StateServer,
|
||||
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
|
||||
{{.middlewareAssignment}}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, error) {
|
||||
AuthKey := r.Header.Get("Authorization")
|
||||
if AuthKey == "" {
|
||||
|
||||
Reference in New Issue
Block a user