using MyCode.Project.Infrastructure.WebPost; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using static MyCode.Project.Infrastructure.Constant.GlobalConfig; namespace MyCode.Project.Infrastructure.Common { public class DingDingHelper { private static string _robotUrl = null; private static string _txt = ""; public DingDingHelper(string robotUrl,string txt) { if (_robotUrl == null) { _robotUrl = robotUrl; } _txt = txt; } #region SendMsg(发送信息) public static Task SendMsg(string content) { var url = _robotUrl; WebUtils webUtils = new WebUtils(); var jsonObject = new { msgtype = "text", text = new { content = _txt+content } }; var jsonStr = JsonHelper.ToJson(jsonObject); var result = webUtils.DoPostJson(url, jsonStr); return Task.CompletedTask; } #endregion #region SendMsg(发送信息) public static Task SendAMingMsg(string content) { var url = "https://oapi.dingtalk.com/robot/send?access_token=607473623096fec3bdc11157dd28e910bc78cff2dd4f9e88af7c9b675fe1ce57"; WebUtils webUtils = new WebUtils(); var jsonObject = new { msgtype = "text", text = new { content = "智慧门店数据通报:" + content } }; var jsonStr = JsonHelper.ToJson(jsonObject); var result = webUtils.DoPostJson(url, jsonStr); //LogHelper.Info(result); return Task.CompletedTask; } #endregion } }