using MyCode.Project.Infrastructure.Extensions; using MyCode.Project.Infrastructure.WebPost; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MyCode.Project.Infrastructure.Common { public class DingDingHelper { private static string _robotUrl = null; private static string _env = ""; public DingDingHelper(string robotUrl,int iEnv) { if (_robotUrl == null) { _robotUrl = robotUrl; } if (_env == "") { if (iEnv == 0) { _env = "[报表系统-开发]"; } else { _env = "[报表系统-生产]"; } } } #region SendMsg(发送信息) public static Task SendMsg(string content) { if (content.IndexOf("user refuse") != -1) { return Task.CompletedTask; } var url = _robotUrl; if (!string.IsNullOrWhiteSpace(content)) { content = _env + content; } WebUtils webUtils = new WebUtils(); var jsonObject = new { msgtype = "text", text = new { content = content } }; var jsonStr = jsonObject.ToJson(); //var result = webUtils.DoPostJson(url, jsonStr); return Task.CompletedTask; } #endregion } }