初始
This commit is contained in:
34
internal/app/system/service/context.go
Normal file
34
internal/app/system/service/context.go
Normal file
@ -0,0 +1,34 @@
|
||||
// ================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/model"
|
||||
)
|
||||
|
||||
type IContext interface {
|
||||
Init(r *ghttp.Request, customCtx *model.Context)
|
||||
Get(ctx context.Context) *model.Context
|
||||
SetUser(ctx context.Context, ctxUser *model.ContextUser)
|
||||
GetLoginUser(ctx context.Context) *model.ContextUser
|
||||
GetUserId(ctx context.Context) uint64
|
||||
}
|
||||
|
||||
var localContext IContext
|
||||
|
||||
func Context() IContext {
|
||||
if localContext == nil {
|
||||
panic("implement not found for interface IContext, forgot register?")
|
||||
}
|
||||
return localContext
|
||||
}
|
||||
|
||||
func RegisterContext(i IContext) {
|
||||
localContext = i
|
||||
}
|
Reference in New Issue
Block a user