Files
Quincy_admin/controllers/base_utils.go
2026-03-26 22:13:03 +08:00

22 lines
348 B
Go

package controllers
import (
"errors"
"github.com/gin-gonic/gin"
)
func getCode(ctx *gin.Context) (string, error) {
userIDInterface, exists := ctx.Get("code")
if !exists {
return "", errors.New("用户ID不存在")
}
code, ok := userIDInterface.(string)
if !ok {
return "", errors.New("用户ID类型错误")
}
return code, nil
}