Router2Mid

package
v5.1.31 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseData

func BaseData(context any, data interface{})

BaseData 反馈一般数据

func BaseDataCount

func BaseDataCount(context any, count int64)

BaseDataCount 反馈数量类数据

func CheckPermission

func CheckPermission(context any, permissionMarks []string) bool

CheckPermission 检查权限 自动识别组织或用户

func GetContext

func GetContext(context any) *gin.Context

GetContext 识别和获取头部上下文

func GetContextBodyByte

func GetContextBodyByte(context any) (dataByte []byte, b bool)

GetContextBodyByte 尝试获取上下文的body byte 由于设备验证和获取参数冲突,gin的body不能连续获取两次,会触发EOF错误

func GetTokenID

func GetTokenID(c *gin.Context) int64

GetTokenID 获取tokenID

func GetTokenInfo

func GetTokenInfo(c *gin.Context) (data BaseToken2.FieldsToken)

GetTokenInfo 获取会话数据包

func HeaderBase

func HeaderBase(c *gin.Context)

HeaderBase 顶部设定

func ReportActionCreate

func ReportActionCreate(context any, logMsg string, err error, code string, data interface{})

func ReportActionCreateNoData

func ReportActionCreateNoData(context any, logMsg string, err error, code string)

func ReportActionDelete

func ReportActionDelete(context any, logMsg string, err error, code string)

func ReportActionUpdate

func ReportActionUpdate(context any, logMsg string, err error, code string)

func ReportBaseBool

func ReportBaseBool(context any, code string, b bool)

ReportBaseBool 反馈成功或失败

func ReportBaseDataList

func ReportBaseDataList(context any, count int64, data interface{})

ReportBaseDataList 反馈列队数据

func ReportBaseError

func ReportBaseError(context any, code string)

ReportBaseError 反馈错误

func ReportBaseSuccess

func ReportBaseSuccess(context any)

ReportBaseSuccess 反馈成功

func ReportData

func ReportData(context any, errMessage string, err error, code string, data interface{})

ReportData 通用反馈单一数据

func ReportDataList

func ReportDataList(context any, errMessage string, err error, code string, dataList interface{}, dataCount int64)

ReportDataList 通用反馈列表方案

func ReportDataNoErr

func ReportDataNoErr(context any, err error, code string, data interface{})

func ReportErrorBadRequest

func ReportErrorBadRequest(context any, code string)

ReportErrorBadRequest 反馈错误但不带JSON重新标定

func ReportErrorBadRequestLog

func ReportErrorBadRequestLog(context any, message string, err error, code string)

func ReportErrorBadRequestLogToParams added in v5.1.5

func ReportErrorBadRequestLogToParams(context any, message string, err error, code string, newMsg string)

func ReportErrorLog

func ReportErrorLog(context any, message string, err error, code string)

ReportErrorLog 反馈错误并抛出日志

func ReportWarnLog

func ReportWarnLog(context any, message string, err error, code string)

ReportWarnLog 反馈警告并抛出错误

func TryGetUserID

func TryGetUserID(c *gin.Context) (userID int64, b bool)

TryGetUserID 尝试获取用户ID

func UpdateUserLogin

func UpdateUserLogin(c *RouterURLHeaderC, userInfo *UserCore.FieldsUserType)

UpdateUserLogin 用户登陆操作处理

Types

type ArgsIOTData

type ArgsIOTData struct {
	//设备分组
	GroupMark string `db:"group_mark" json:"groupMark" check:"mark"`
	//设备编号
	// 同一个分组下,必须唯一
	Code string `db:"code" json:"code" check:"mark"`
	//时间戳
	NowTime int64 `db:"now_time" json:"nowTime"`
	//随机码
	Rand string `db:"rand" json:"rand"`
	//key计算结果
	// key+code+时间戳+随机码
	Key string `db:"key" json:"key"`
	//组织ID
	OrgID int64 `db:"org_id" json:"orgID" check:"id"`
}

ArgsIOTData 检查设备是否存在且授权参数

type DataGetContextData

type DataGetContextData struct {
	//日志头部
	LogAppend string
	//用户ID
	UserID int64
	//组织ID
	OrgID int64
	//组织成员ID
	OrgBindID int64
}

DataGetContextData 识别和获取头部上下文并带数据结果

func GetContextData

func GetContextData(context any) (c *gin.Context, result DataGetContextData)

GetContextData 识别和获取头部上下文并带数据

type RouterGlob

type RouterGlob struct {
	//路由结构体
	Routers *gin.RouterGroup
	// contains filtered or unexported fields
}

RouterGlob 全局通用结构方法存储

type RouterURL

type RouterURL struct {
	//全局方法
	BaseData RouterGlob
}

RouterURL 方法覆盖

func (*RouterURL) Base

func (t *RouterURL) Base(urlPath string) *RouterURL

Base 基础封装

func (*RouterURL) Header

func (t *RouterURL) Header() *RouterURLHeader

Header 有头封装

func (*RouterURL) IOT

func (t *RouterURL) IOT() *RouterURLIOT

IOT 无头封装

func (*RouterURL) Manager

func (t *RouterURL) Manager() *RouterURLUser

Manager 管理级别封装

func (*RouterURL) OB

func (t *RouterURL) OB() *RouterURLOrg

OB 组织成员级别封装

func (*RouterURL) OM

func (t *RouterURL) OM() *RouterURLOrg

OM 组织管理级别封装

func (*RouterURL) Public

func (t *RouterURL) Public() *RouterURLPublic

Public 无头封装

func (*RouterURL) Role

func (t *RouterURL) Role(roleType string) *RouterURLRole

Role 用户级别封装

func (*RouterURL) Top

func (t *RouterURL) Top(urlPath string) RouterURL

Top 根URL

func (*RouterURL) User

func (t *RouterURL) User() *RouterURLUser

User 用户级别封装

type RouterURLHeader

type RouterURLHeader struct {
	//全局方法
	BaseData RouterGlob
}

RouterURLHeader 有头级别路由

func (*RouterURLHeader) DELETE

func (t *RouterURLHeader) DELETE(urlPath string, handle func(*RouterURLHeaderC))

func (*RouterURLHeader) GET

func (t *RouterURLHeader) GET(urlPath string, handle func(*RouterURLHeaderC))

func (*RouterURLHeader) POST

func (t *RouterURLHeader) POST(urlPath string, handle func(*RouterURLHeaderC))

func (*RouterURLHeader) PUT

func (t *RouterURLHeader) PUT(urlPath string, handle func(*RouterURLHeaderC))

type RouterURLHeaderC

type RouterURLHeaderC struct {
	//上下文
	Context *gin.Context
	//日志头部
	LogAppend string
	//会话ID
	TokenID int64
}

RouterURLHeaderC 普通级别头部

type RouterURLIOT

type RouterURLIOT struct {
	//全局方法
	BaseData RouterGlob
}

RouterURLIOT IOT级别路由

func (*RouterURLIOT) DELETE

func (t *RouterURLIOT) DELETE(urlPath string, handle func(*RouterURLIOTC))

func (*RouterURLIOT) GET

func (t *RouterURLIOT) GET(urlPath string, handle func(*RouterURLIOTC))

func (*RouterURLIOT) POST

func (t *RouterURLIOT) POST(urlPath string, handle func(*RouterURLIOTC))

func (*RouterURLIOT) PUT

func (t *RouterURLIOT) PUT(urlPath string, handle func(*RouterURLIOTC))

type RouterURLIOTC

type RouterURLIOTC struct {
	//上下文
	Context *gin.Context
	//日志头部
	LogAppend string
	//上下文参数数据集合
	BodyByte []byte
}

RouterURLIOTC 普通级别头部

type RouterURLManager

type RouterURLManager struct {
	//全局方法
	BaseData RouterGlob
}

RouterURLManager 管理层级路由

type RouterURLOrg

type RouterURLOrg struct {
	//全局方法
	BaseData RouterGlob
}

RouterURLOrg 组织级别路由

func (*RouterURLOrg) DELETE

func (t *RouterURLOrg) DELETE(urlPath string, handle func(*RouterURLOrgC))

func (*RouterURLOrg) GET

func (t *RouterURLOrg) GET(urlPath string, handle func(*RouterURLOrgC))

func (*RouterURLOrg) POST

func (t *RouterURLOrg) POST(urlPath string, handle func(*RouterURLOrgC))

func (*RouterURLOrg) PUT

func (t *RouterURLOrg) PUT(urlPath string, handle func(*RouterURLOrgC))

type RouterURLOrgC

type RouterURLOrgC struct {
	//上下文
	Context *gin.Context
	//日志头部
	LogAppend string
	//用户ID
	UserID int64
	//组织ID
	OrgID int64
	//组织成员ID
	OrgBindID int64
}

RouterURLOrgC 普通级别头部

type RouterURLPublic

type RouterURLPublic struct {
	//全局方法
	BaseData RouterGlob
}

RouterURLPublic 有头级别路由

func (*RouterURLPublic) DELETE

func (t *RouterURLPublic) DELETE(urlPath string, handle func(*RouterURLPublicC))

func (*RouterURLPublic) GET

func (t *RouterURLPublic) GET(urlPath string, handle func(*RouterURLPublicC))

func (*RouterURLPublic) POST

func (t *RouterURLPublic) POST(urlPath string, handle func(*RouterURLPublicC))

func (*RouterURLPublic) PUT

func (t *RouterURLPublic) PUT(urlPath string, handle func(*RouterURLPublicC))

type RouterURLPublicC

type RouterURLPublicC struct {
	//上下文
	Context *gin.Context
	//日志头部
	LogAppend string
}

RouterURLPublicC 普通级别头部

type RouterURLRole

type RouterURLRole struct {
	//全局方法
	BaseData RouterGlob
	//角色类型
	RoleType string
}

RouterURLRole 用户角色级别路由

func (*RouterURLRole) DELETE

func (t *RouterURLRole) DELETE(urlPath string, handle func(*RouterURLRoleC))

func (*RouterURLRole) GET

func (t *RouterURLRole) GET(urlPath string, handle func(*RouterURLRoleC))

func (*RouterURLRole) POST

func (t *RouterURLRole) POST(urlPath string, handle func(*RouterURLRoleC))

func (*RouterURLRole) PUT

func (t *RouterURLRole) PUT(urlPath string, handle func(*RouterURLRoleC))

type RouterURLRoleC

type RouterURLRoleC struct {
	//上下文
	Context *gin.Context
	//日志头部
	LogAppend string
	//用户ID
	UserID int64
	//RoleID
	RoleID int64
	//角色类型
	RoleType string
}

RouterURLRoleC 用户角色头部

type RouterURLUser

type RouterURLUser struct {
	//全局方法
	BaseData RouterGlob
}

RouterURLUser 用户级别路由

func (*RouterURLUser) DELETE

func (t *RouterURLUser) DELETE(urlPath string, handle func(*RouterURLUserC))

func (*RouterURLUser) GET

func (t *RouterURLUser) GET(urlPath string, handle func(*RouterURLUserC))

func (*RouterURLUser) POST

func (t *RouterURLUser) POST(urlPath string, handle func(*RouterURLUserC))

func (*RouterURLUser) PUT

func (t *RouterURLUser) PUT(urlPath string, handle func(*RouterURLUserC))

type RouterURLUserC

type RouterURLUserC struct {
	//上下文
	Context *gin.Context
	//日志头部
	LogAppend string
	//用户ID
	UserID int64
}

RouterURLUserC 普通级别头部

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL