go-view-server/internal/model/context.go

31 lines
1.1 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Package model
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package model
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// Context 请求上下文结构
type Context struct {
Module string // 应用模块 adminapihomewebsocket
AddonName string // 插件名称 如果不是插件模块请求,可能为空
User *Identity // 上下文用户信息
Response *Response // 请求响应
Data g.Map // 自定kv变量 业务模块根据需要设置,不固定
}
// Identity 通用身份模型
type Identity struct {
Id int64 `json:"id" description:"用户ID"`
Username string `json:"username" description:"用户名"`
Nickname string `json:"nickname" description:"昵称"`
Avatar string `json:"avatar" description:"头像"`
App string `json:"app" description:"登录应用"`
LoginAt *gtime.Time `json:"loginAt" description:"登录时间"`
}