/// <summary> /// 发送座位到期消息,使用用户的微信OpenID,等信息。模板ID请查看微信公众平台的管理页面。 /// </summary> /// <param name="no">学号</param> /// <param name="openid">微信OpenID</param> /// <param name="room">自习室名称</param> /// <param name="seatno">座位号</param> /// <param name="remain">座位剩余时间</param> /// <param name="deadline">座位截止时间</param> /// <returns>发送消息是否成功</returns> public bool SendSeatOutDateMessage(string no, string openid, string room, string seatno, string remain, string deadline) { if (openid.Length > 10) { WeChatMessageUtil wcm = new WeChatMessageUtil(); Dictionary <string, string> title = new Dictionary <string, string>(); title.Add("touser", openid); title.Add("template_id", "MjMhCvWKW6eCnVtCxXCrKH7ca6dZDdLSG4AzQgX1y1I"); title.Add("topcolor", "#FF0000"); Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("first", no + "\n"); data.Add("keyword1", room + "\n"); data.Add("keyword2", seatno + "\n"); data.Add("keyword3", remain + "分钟\n"); data.Add("keyword4", deadline + "\n"); string res = wcm.SendMessage(token, "https://api.weixin.qq.com/cgi-bin/message/template/send", Method.POST, title, data); if (res.ToLower() == "ok") { return(true); } else { return(false); } } else { return(false); } }
/// <summary> /// 发送选择座位成功消息。 /// </summary> /// <param name="no">学号</param> /// <param name="openid">微信OpenID</param> /// <param name="room">自习室名称</param> /// <param name="seatno">座位号</param> /// <param name="time1">选座时间</param> /// <param name="time2">座位到期时间</param> /// <returns>发送消息是否成功</returns> public bool SendSelectSeatSuccessMessage(string no, string openid, string room, string seatno, string time1, string time2) { if (openid.Length > 10) { WeChatMessageUtil wcm = new WeChatMessageUtil(); Dictionary <string, string> title = new Dictionary <string, string>(); title.Add("touser", openid); title.Add("template_id", "fpDqDfWo1zsRwT33H-3kLIzg1OPRxzy75105DrTgY4s"); title.Add("topcolor", "#FF0000"); Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("first", no + "\n"); data.Add("keyword1", room + "\n"); data.Add("keyword2", seatno + "\n"); data.Add("keyword3", time1 + "\n"); data.Add("keyword4", time2 + "\n"); string res = wcm.SendMessage(token, "https://api.weixin.qq.com/cgi-bin/message/template/send", Method.POST, title, data); if (res.ToLower() == "ok") { return(true); } else { return(false); } } else { return(false); } }
/// <summary> /// 发送预约座位成功消息。 /// </summary> /// <param name="no">学号</param> /// <param name="openid">微信OpenID</param> /// <param name="room">自习室名称</param> /// <param name="seatno">座位号</param> /// <returns>发送消息是否成功</returns> public bool SendOrderSeatSuccessMessage(string no, string openid, string room, string seatno) { if (openid.Length > 10) { WeChatMessageUtil wcm = new WeChatMessageUtil(); Dictionary <string, string> title = new Dictionary <string, string>(); title.Add("touser", openid); title.Add("template_id", "Xh44vEGShQuwIdsb_JOK2WPyiEICwEuWSNPgErX0gdo"); title.Add("topcolor", "#FF0000"); Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("first", no + "\n"); data.Add("keyword1", room + "\n"); data.Add("keyword2", seatno + "\n"); string res = wcm.SendMessage(token, "https://api.weixin.qq.com/cgi-bin/message/template/send", Method.POST, title, data); if (res.ToLower() == "ok") { return(true); } else { return(false); } } else { return(false); } }