/// <summary> /// 图书馆借书成功通知 /// </summary> private void ResponseBorrowBooksSucceedNoticeMsg(string toReaders, string first, string keyword1, string keyword2, string keyword3, string keyword4, string remark) { string tempID = ConfigurationManager.AppSettings["BorrowBooksSucceedID"];//模板ID string access_tocken = Com.IsExistAccess_Token(ConfigurationManager.AppSettings["AppID"], ConfigurationManager.AppSettings["AppSecret"]); SendTools tools = new SendTools(); ActivityToBeginningNoticeTempData data = new ActivityToBeginningNoticeTempData(); data.first = new TempItem(first); data.keyword1 = new TempItem(keyword1); data.keyword2 = new TempItem(keyword2); data.keyword3 = new TempItem(keyword3); data.keyword4 = new TempItem(keyword4); data.remark = new TempItem(remark); TempModel model = new TempModel(); model.objActivityToBeginningNoticeTempData = data; model.template_id = tempID; model.url = ConfigurationManager.AppSettings["BorrowBooksSucceed_URL"]; model.topcolor = "#FF0000"; //处理学号toReaders,逗号隔开 string[] readers = toReaders.Split(','); foreach (var item in readers) { string OPENID = SqlTools.GetOpenId(item); if (OPENID != "") { model.touser = OPENID; OpenApiResult result = tools.SendTempMessage(access_tocken, model); } } }
/// <summary> /// 还书通知 /// </summary> private void ResponseGiveBackBookNoticeMsg(string toReaders, string first, string name, string date, string remark) { string tempID = ConfigurationManager.AppSettings["GiveBackBookNoticeID"];//模板ID string access_tocken = Com.IsExistAccess_Token(ConfigurationManager.AppSettings["AppID"], ConfigurationManager.AppSettings["AppSecret"]); SendTools tools = new SendTools(); GiveBackBookNoticeTempData data = new GiveBackBookNoticeTempData(); data.first = new TempItem(first); data.name = new TempItem(name); data.date = new TempItem(date); data.remark = new TempItem(remark); TempModel model = new TempModel(); model.objGiveBackBookNoticeTempData = data; model.template_id = tempID; model.url = ConfigurationManager.AppSettings["GiveBackBookNotice_URL"]; model.topcolor = "#FF0000"; //处理学号toReaders,逗号隔开 string[] readers = toReaders.Split(','); foreach (var item in readers) { string OPENID = SqlTools.GetOpenId(item); if (OPENID != "") { model.touser = OPENID; OpenApiResult result = tools.SendTempMessage(access_tocken, model); } } }
//发送内部消息 private void ResponseMsg(string OPENID, string first, string keyword1, string keyword2, string keyword3, string remark) { try { // SeatManage.SeatManageComm.WriteLog.Write("4:ResponseMsg"); string tempID = "oLdL1fEDKZsPdc9njn7V2yioHhFWpQQy1JyfxKV_NsM";//座位状态变更通知模板ID string access_tocken = Com.IsExistAccess_Token("wx5c27898c83a612dc", "51fed2e73dddd6e6eabbb528c973074d"); SendTools tools = new SendTools(); TemplateModel m = new TemplateModel(first, keyword1, keyword2, keyword3, remark); m.touser = OPENID; m.template_id = tempID; m.url = "https://lib.xmu.edu.cn/seatwx/NewUser/MySeat"; m.topcolor = "#FF0000"; OpenApiResult result = tools.SendTemplateMessage(access_tocken, m); // SeatManage.SeatManageComm.WriteLog.Write("msg_id" + result.msg_id + "error_code" + result.error_code + "error_msg" + result.error_msg); } catch (Exception ex) { SeatManage.SeatManageComm.WriteLog.Write(ex.ToString()); } }