Documentation ¶
Index ¶
- Constants
- func Context() *sContext
- func EncryptPassword(password, salt string) string
- func FileIsExisted(filename string) bool
- func GetCityByIp(ip string) string
- func GetClientIp(ctx context.Context) string
- func GetDomain(ctx context.Context) string
- func GetExt(fileName string) string
- func GetHeader(ctx context.Context) http.Header
- func GetLocalIP() (ip string, err error)
- func GetRemoteAddr(ctx context.Context) string
- func GetType(p string) (result string, err error)
- func GetUserAgent(ctx context.Context) string
- func GetUserAgentOther(_agent string) *user_agent.UserAgent
- func IsNotExistMkDir(src string) error
- func MkDir(src string) error
- func ParseFilePath(pathStr string) (fileName string, fileType string)
- func WriteToFile(fileName string, content string) error
- type DoRes
- type UserContext
- type UserInfoModel
Constants ¶
View Source
const (
ContextKey = "ContextKey" // 上下文变量存储键名,前后端系统共享
)
Variables ¶
This section is empty.
Functions ¶
func ParseFilePath ¶
解析路径获取文件名称及后缀
Types ¶
type DoRes ¶
type DoRes[T g.Map | g.List | any] struct { Code int `json:"code" dc:"状态码"` Data T `json:"data,omitempty" dc:"返回数据"` Msg string `json:"msg" dc:"返回消息"` }
基础响应对象
type UserContext ¶
type UserContext struct { UserInfo *UserInfoModel `json:"userInfo" dc:"用户信息"` Token string `json:"token" dc:"用户token"` OtherInfo g.Map `json:"otherInfo" dc:"其它kv"` // 自定KV变量,业务模块根据需要设置,不固定 }
用户上下文
type UserInfoModel ¶
type UserInfoModel struct { LoginType string `json:"loginType" dc:"登录方式"` LoginId string `json:"loginId" dc:"登录id"` RnStr string `json:"rnStr" dc:"随机字符串"` Clientid string `json:"clientid" dc:"客户端id"` TenantId string `json:"tenantId" dc:"租户id"` UserId int64 `json:"userId" dc:"用户id"` UserName string `json:"userName" dc:"用户名"` DeptId int64 `json:"deptId" dc:"所属部门id"` DeptName string `json:"deptName" dc:"所属部门名称"` }
用户信息
Click to show internal directories.
Click to hide internal directories.