钉钉消息发送(安装dotnet-sdk-3.1.426-win-x64)
zrg
2024-07-02 8ef6f1c4ba50d978f3816d17a8fe9cf1ee28bcfb
DingDingMsg/DingDingMsg/MSG.cs
@@ -51,7 +51,7 @@
                string url = $"{_baseUrl}?access_token={accessToken}";
                DateTimeOffset now = DateTimeOffset.Now;
                string currentTime = now.ToString("yyyy-MM-dd HH:mm:ss");
                string messageWithTimestamp = $"{currentTime}---{message}"; // 在消息内容之前添加时间戳
                string messageWithTimestamp = $"消息时间:{currentTime} --- {message}"; // 在消息内容之前添加时间戳
                string messageJson = $"{{\"msgtype\": \"text\", \"text\": {{ \"content\": \"{messageWithTimestamp}\" }} }}";
                string requestBody = $"agent_id={agentId}&userid_list={userIdList}&dept_id_list={deptIdList}&to_all_user={toAllUser}&msg={messageJson}";