Files
IOT_API/Common/Notify/FeishuConfig.cs
T

27 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
namespace Common.Notify
{
/// <summary>
/// 飞书自建应用配置(用于"手机号 → open_id"转换)
/// 飞书群机器人 webhook 只能发文本、无法用手机号 @ 人,必须借助自建应用凭证调通讯录接口换取 open_id。
/// 由 Program.cs 启动时从 appsettings.json 的 Feishu 节读入;未配置时相关功能自动降级。
/// </summary>
public static class FeishuConfig
{
/// <summary>飞书自建应用 App IDcli_ 开头)</summary>
public static string AppId { get; private set; } = string.Empty;
/// <summary>飞书自建应用 App Secret</summary>
public static string AppSecret { get; private set; } = string.Empty;
/// <summary>是否已配置(未配置时手机号无法转 open_id,降级为仅支持直接填 open_id / all</summary>
public static bool IsConfigured => !string.IsNullOrWhiteSpace(AppId) && !string.IsNullOrWhiteSpace(AppSecret);
/// <summary>初始化飞书应用配置</summary>
public static void Init(string appId, string appSecret)
{
AppId = appId ?? string.Empty;
AppSecret = appSecret ?? string.Empty;
}
}
}