返回列表 发布新帖

微服务中如何取得用户资讯

149 1
发表于 2024-12-27 23:30:00 | 查看全部 阅读模式
问答

紧急程度

已完结
微服务中如何取得用户资讯

最佳答案

查看完整内容

租户及用户资讯可以在服务上下文中取得。请参考以下代码范例: // 取出服务上下文 DWServiceContext context = DWServiceContext.getContext(); Map tProfile = DWServiceContext.getContext().getProfile(); // 取得租户SID long tenantSid = (long) tProfile.get("tenantSid"); // 取得租户ID String tenantId = (String) tProfile.get("tenantId"); // 取得租户名称 String tenantName = (String) tProfile.get("tenantName"); ...

评论1

admin楼主Lv.9 发表于 2024-12-27 23:30:00 | 查看全部
租户及用户资讯可以在服务上下文中取得。请参考以下代码范例:
// 取出服务上下文
DWServiceContext context = DWServiceContext.getContext();
Map tProfile = DWServiceContext.getContext().getProfile();
// 取得租户SID
long tenantSid = (long) tProfile.get("tenantSid");
// 取得租户ID
String tenantId = (String) tProfile.get("tenantId");
// 取得租户名称
String tenantName = (String) tProfile.get("tenantName");
// 取得用户ID
String userId = (String) tProfile.get("userId");
// 取得租户名称
String userName = (String) tProfile.get("userName");
大家来答
    精选文章
    排错技巧 - 地中台无法启用
    问题描述顾问反馈:客户在完成新版更新后,服务无法正常启用! 错误信息如下,地中台
    低代码-数据分组使用方法
      需求背景      在流程支持多笔数据的场景下,使用数
    低代码--并行分支使用方法
     需求背景      在流程支持多笔数据的场景下,并行分支支持
    排错技巧 - 地中台查不到调用日志
    问题描述客户反馈:系统今天都有正常交易,但在EAI上却查不到日志记录,可能是什么原
    私有化效能问题排查 (09/15补充)
    需求背景在私有化环境中,客户的服务器环境可能在本地,也可能在云端,可能会受环境因
    • 关注公众号
    Copyright © 2025 鼎捷数智股份有限公司 版权所有 All Rights Reserved. Powered by Discuz! X5.0
    关灯 在本版发帖
    即将开放
    返回顶部
    快速回复 返回顶部 返回列表