private static Dictionary <string, string> SendMessageString(WeChatSMsg MessageType, string users, string Title, string Content, string URL = null) { WeChatMessageBackupService.AddToSendList(users, Title, Content); WeChatHelper.PrepareCodes(); string Message = "{\"touser\":\"" + users + "\",\"msgtype\":\"" + MessageType.ToString() + "\",\"agentid\":" + XConfig.Current.WeChat.AgentId + ",\"" + MessageType.ToString() + "\":"; switch (MessageType) { case WeChatSMsg.text: Message = Message + $"{{\"content\":\"{Content}\r\n\r\nMST: {DateTime.Now.ToNormalString()}\"}}"; break; case WeChatSMsg.textcard: Message = Message + $"{{\"title\":\"{Title}\",\"description\":\"{Content}\",\"url\":\"{URL}\"}}"; break; case WeChatSMsg.file: Message = Message + $"{{\"media_id\":\"{Content}\"}}"; break; } Message = Message + "}"; L.I("WeChat Message Sent: " + Message); return(PublicTools.HTTPPost("https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=" + WeChatHelper.AccessToken, Message)); }
public WeChatSentMessage(WeChatSMsg type, string title, string content, string uRL_OnClick, params string[] toUser) { Content = content; this.toUser = toUser; this.type = type; Title = title; URL_OnClick = uRL_OnClick; }