21 lines
573 B
Go
21 lines
573 B
Go
package infra
|
|
|
|
import (
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
type Auth struct {
|
|
CustomerID int64 // 企业编号
|
|
CustomerCode string // 企业标识
|
|
UserID int64 // 用户编号
|
|
UserIdentity string // 用户标识
|
|
}
|
|
|
|
func ParserCtx(ctx *fiber.Ctx) *Auth {
|
|
customerID := ctx.Locals("customerID").(int64)
|
|
customerCode := ctx.Locals("customerCode").(string)
|
|
userID := ctx.Locals("userID").(int64)
|
|
userIdentity := ctx.Locals("userIdentity").(string)
|
|
return &Auth{CustomerID: customerID, CustomerCode: customerCode, UserID: userID, UserIdentity: userIdentity}
|
|
}
|