数据引擎-快手平台数据抽取bug修复

This commit is contained in:
2026-06-16 10:44:10 +08:00
parent e5133eea34
commit b4fc6f54af
22 changed files with 1324 additions and 487 deletions

View File

@@ -6,11 +6,26 @@ import (
"gitea.redpowerfuture.com/red-future/common/beans"
)
// GetCurrentUser 从 context 中获取当前登录用户
// 如果未找到用户信息,返回默认 "unknown" 用户名
// GetCurrentUser 从 context 中获取当前登录用户
func GetCurrentUser(ctx context.Context) string {
if user, ok := ctx.Value("user").(*beans.User); ok && user != nil && user.UserName != "" {
return user.UserName
if u := getUser(ctx); u != nil {
return u.UserName
}
return "unknown"
}
// GetCurrentTenantId 从 context 中获取当前租户 ID
func GetCurrentTenantId(ctx context.Context) uint64 {
if u := getUser(ctx); u != nil {
return u.TenantId
}
return 0
}
// getUser 从 context 中获取 *beans.User
func getUser(ctx context.Context) *beans.User {
if user, ok := ctx.Value("user").(*beans.User); ok {
return user
}
return nil
}