Skip to content

Commit 46e4e89

Browse files
committed
🎨 飞书消息加入 serverTag 配置
1 parent e9972e2 commit 46e4e89

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

src/BD.Common8.FeishuOApi.Sdk/Models/FeishuApiOptions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@ public sealed record class FeishuApiOptions
99
/// 飞书 WebHook Id
1010
/// </summary>
1111
public string? HookId { get; set; }
12+
13+
/// <summary>
14+
/// 服务标识
15+
/// </summary>
16+
public string? ServerTag { get; set; }
1217
}

src/BD.Common8.FeishuOApi.Sdk/Services/FeishuApiClient.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ string HookId
2020
}
2121
}
2222

23+
string? ServerTag => options.Value.ServerTag;
24+
2325
static ApplicationException GetInvalidKeyException(string name) => throw new(
2426
$"""
2527
Enter (dotnet user-secrets set "FeishuApiOptions:{name}" "value") on the current csproj path to set the secret value see https://learn.microsoft.com/zh-cn/aspnet/core/security/app-secrets
@@ -36,6 +38,11 @@ public async Task<ApiRspImpl<HttpStatusCode>> SendMessageAsync(
3638
HttpResponseMessage? rsp = null;
3739
try
3840
{
41+
if (!string.IsNullOrWhiteSpace(ServerTag))
42+
{
43+
text = $"{ServerTag}: {text}";
44+
}
45+
3946
var reqUrl = $"/open-apis/bot/v2/hook/{HookId}";
4047
var reqBody = SendMessage_RequestBody.CreateTextMessage(title, text);
4148

src/Directory.Packages.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,4 +832,8 @@
832832
<ItemGroup>
833833
<PackageVersion Include="FluentValidation.AspNetCore" Version="11.3.0" />
834834
</ItemGroup>
835+
<!-- 👇 TencentCloudSDK -->
836+
<ItemGroup>
837+
<PackageVersion Include="TencentCloudSDK.Dnspod " Version="3.0.1196" />
838+
</ItemGroup>
835839
</Project>

0 commit comments

Comments
 (0)