static Config() { //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ Model_SendMessageTemplate model = new Model_SendMessageTemplate(); BLL_SendMessageTemplate bll = new BLL_SendMessageTemplate(); model = bll.GetModelBySType(Rc.Model.Resources.SMSPAYTemplateEnum.ALIPAY.ToString()); if (model != null && model.IsStart == 1) { //合作身份者ID,以2088开头由16位纯数字组成的字符串 //partner = "2088421306789431"; partner = model.UserName; //收款支付宝账号 //seller_email = "*****@*****.**"; seller_email = model.PassWord; //交易安全检验码,由数字和字母组成的32位字符串 //key = "kdm76wus83ifdvo7cwutb2p1alw5d38i"; key = model.MsgUrl; } //↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ //字符编码格式 目前支持 gbk 或 utf-8 input_charset = "utf-8"; //签名方式,选择项:RSA、DSA、MD5 sign_type = "MD5"; }
public static string GetDataList(string UserName, int PageIndex, int PageSize) { try { UserName = UserName.Filter(); string strWhere = string.Empty; strWhere = "1=1"; if (!string.IsNullOrEmpty(UserName)) { strWhere += " AND UserName like '%" + UserName + "%'"; } int intRecordCount = 0; List <object> listReturn = new List <object>(); BLL_SendMessageTemplate bll = new BLL_SendMessageTemplate(); DataTable dt = bll.GetListByPage(strWhere, "SType", ((PageIndex - 1) * PageSize + 1), PageIndex * PageSize).Tables[0]; intRecordCount = bll.GetRecordCount(strWhere); foreach (DataRow item in dt.Rows) { listReturn.Add(new { SendSMSTemplateId = item["SendSMSTemplateId"].ToString(), STypeName = Rc.Common.EnumService.GetDescription <SMSPAYTemplateEnum>(item["SType"].ToString()), UserName = item["UserName"].ToString(), PassWord = item["PassWord"].ToString(), MsgUrl = item["MsgUrl"].ToString(), IsStart = item["IsStart"].ToString() == "1" ? "启用" : "未启用", CTime = pfunction.ConvertToLongDateTime(item["CTime"].ToString()) }); } if (dt.Rows.Count > 0) { return(JsonConvert.SerializeObject(new { err = "null", PageIndex = PageIndex, PageSize = PageSize, TotalCount = intRecordCount, list = listReturn })); } else { return(JsonConvert.SerializeObject(new { err = "暂无数据" })); } } catch (Exception ex) { return(JsonConvert.SerializeObject(new { err = "error" })); } }
static WxPayConfig() { Model_SendMessageTemplate model = new Model_SendMessageTemplate(); BLL_SendMessageTemplate bll = new BLL_SendMessageTemplate(); model = bll.GetModelBySType(Rc.Model.Resources.SMSPAYTemplateEnum.WXPAY.ToString()); if (model != null && model.IsStart == 1) { APPID = model.UserName; MCHID = model.PassWord; KEY = model.MsgUrl; } }
private void VerifyUrl() { string strFileSyncExecRecord_id = Guid.NewGuid().ToString(); #region 记录检测开始信息 Rc.Model.Resources.Model_FileSyncExecRecord model_FileSyncExecRecord = new Rc.Model.Resources.Model_FileSyncExecRecord(); Rc.BLL.Resources.BLL_FileSyncExecRecord bll_FileSyncExecRecord = new Rc.BLL.Resources.BLL_FileSyncExecRecord(); model_FileSyncExecRecord.FileSyncExecRecord_id = strFileSyncExecRecord_id; model_FileSyncExecRecord.FileSyncExecRecord_Type = "自动检测学校公网"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "正在检测..."; model_FileSyncExecRecord.FileSyncExecRecord_TimeStart = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "0"; bll_FileSyncExecRecord.Add(model_FileSyncExecRecord); #endregion try { Model_SendMessageTemplate model = new BLL_SendMessageTemplate().GetModelBySType(Rc.Model.Resources.SMSPAYTemplateEnum.SMS.ToString()); #region 检测 主web服务器,教案服务器,习题集服务器 string strName = string.Empty; string strStudentAnswerWebSiteUrl = Rc.Common.ConfigHelper.GetConfigString("StudentAnswerWebSiteUrl"); string strTeachingPlanWebSiteUrl = Rc.Common.ConfigHelper.GetConfigString("TeachingPlanWebSiteUrl"); string strTestWebSiteUrl = Rc.Common.ConfigHelper.GetConfigString("TestWebSiteUrl"); if (hostPath != strStudentAnswerWebSiteUrl) { #region 检测 主web服务器 strName = "主web服务器"; string getResult = Rc.Common.RemotWeb.PostDataToServer(strStudentAnswerWebSiteUrl + "AuthApi/?key=onlinecheck", "", System.Text.Encoding.UTF8, "GET"); string schoolUrl = strStudentAnswerWebSiteUrl.Replace("http://", "").TrimEnd('/'); string strWhere = string.Empty; #region 给运营平台发送短信 if (string.IsNullOrEmpty(getResult)) // 无法访问 { strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' and datediff(MI,ctime,getdate())<180 order by CTime desc " , model.Mobile, strName); DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0]; if (dt.Rows.Count == 0 || (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() != "false")) { // 180分钟内未发送短信 或 最新短信不是无法访问 Dictionary <string, string> Para = new Dictionary <string, string>(); Para.Add("template_id", "10580"); Para.Add("template_para_schoolname", strName); Para.Add("template_para_schoolurl", schoolUrl); string msg = (strName + schoolUrl + "无法访问"); Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "false", ""); } } else { strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' order by CTime desc " , model.Mobile, strName); DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0]; if (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() == "false") { Dictionary <string, string> Para = new Dictionary <string, string>(); Para.Add("template_id", "10581"); Para.Add("template_para_schoolname", strName); Para.Add("template_para_schoolurl", schoolUrl); string msg = (strName + schoolUrl + "已恢复正常"); Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "true", ""); } } #endregion #endregion } if (strTeachingPlanWebSiteUrl != strStudentAnswerWebSiteUrl && strTeachingPlanWebSiteUrl != hostPath) { #region 检测 教案服务器 strName = "教案服务器"; string getResult = Rc.Common.RemotWeb.PostDataToServer(strTeachingPlanWebSiteUrl + "AuthApi/?key=onlinecheck", "", System.Text.Encoding.UTF8, "GET"); string schoolUrl = strTeachingPlanWebSiteUrl.Replace("http://", "").TrimEnd('/'); string strWhere = string.Empty; #region 给运营平台发送短信 if (string.IsNullOrEmpty(getResult)) // 无法访问 { strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' and datediff(MI,ctime,getdate())<180 order by CTime desc " , model.Mobile, strName); DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0]; if (dt.Rows.Count == 0 || (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() != "false")) { // 180分钟内未发送短信 或 最新短信不是无法访问 Dictionary <string, string> Para = new Dictionary <string, string>(); Para.Add("template_id", "10580"); Para.Add("template_para_schoolname", strName); Para.Add("template_para_schoolurl", schoolUrl); string msg = (strName + schoolUrl + "无法访问"); Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "false", ""); } } else { strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' order by CTime desc " , model.Mobile, strName); DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0]; if (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() == "false") { Dictionary <string, string> Para = new Dictionary <string, string>(); Para.Add("template_id", "10581"); Para.Add("template_para_schoolname", strName); Para.Add("template_para_schoolurl", schoolUrl); string msg = (strName + schoolUrl + "已恢复正常"); Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "true", ""); } } #endregion #endregion } if (strTestWebSiteUrl != strStudentAnswerWebSiteUrl && strTestWebSiteUrl != strTeachingPlanWebSiteUrl && strTestWebSiteUrl != hostPath) { #region 检测 习题集服务器 strName = "习题集服务器"; string getResult = Rc.Common.RemotWeb.PostDataToServer(strTeachingPlanWebSiteUrl + "AuthApi/?key=onlinecheck", "", System.Text.Encoding.UTF8, "GET"); string schoolUrl = strTeachingPlanWebSiteUrl.Replace("http://", "").TrimEnd('/'); string strWhere = string.Empty; #region 给运营平台发送短信 if (string.IsNullOrEmpty(getResult)) // 无法访问 { strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' and datediff(MI,ctime,getdate())<180 order by CTime desc " , model.Mobile, strName); DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0]; if (dt.Rows.Count == 0 || (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() != "false")) { // 180分钟内未发送短信 或 最新短信不是无法访问 Dictionary <string, string> Para = new Dictionary <string, string>(); Para.Add("template_id", "10580"); Para.Add("template_para_schoolname", strName); Para.Add("template_para_schoolurl", schoolUrl); string msg = (strName + schoolUrl + "无法访问"); Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "false", ""); } } else { strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' order by CTime desc " , model.Mobile, strName); DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0]; if (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() == "false") { Dictionary <string, string> Para = new Dictionary <string, string>(); Para.Add("template_id", "10581"); Para.Add("template_para_schoolname", strName); Para.Add("template_para_schoolurl", schoolUrl); string msg = (strName + schoolUrl + "已恢复正常"); Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "true", ""); } } #endregion #endregion } #endregion List <Model_ConfigSchool> list = new List <Model_ConfigSchool>(); list = new BLL_ConfigSchool().GetModelList(""); string Sql = string.Format(@" select cs.School_Id,cs.School_Name,ssp.PhoneNum from ConfigSchool cs inner join [dbo].[SchoolSMS_Person] ssp on ssp.School_Id=cs.School_Id "); DataTable dtPerson = Rc.Common.DBUtility.DbHelperSQL.Query(Sql).Tables[0]; foreach (var item in list) { if (!string.IsNullOrEmpty(model.Mobile) && !string.IsNullOrEmpty(item.D_PublicValue)) { string getResult = Rc.Common.RemotWeb.PostDataToServer(item.D_PublicValue + "AuthApi/?key=onlinecheck", "", System.Text.Encoding.UTF8, "GET"); string schoolUrl = item.D_PublicValue.Replace("http://", "").TrimEnd('/'); string strWhere = string.Empty; #region 给运营平台发送短信 if (string.IsNullOrEmpty(getResult)) // 无法访问 { strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' and datediff(MI,ctime,getdate())<180 order by CTime desc " , model.Mobile, item.School_Name); DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0]; if (dt.Rows.Count == 0 || (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() != "false")) { // 180分钟内未发送短信 或 最新短信不是无法访问 Dictionary <string, string> Para = new Dictionary <string, string>(); Para.Add("template_id", "10580"); Para.Add("template_para_schoolname", item.School_Name); Para.Add("template_para_schoolurl", schoolUrl); string msg = (item.School_Name + schoolUrl + "无法访问"); Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "false", item.School_ID); } } else { strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' order by CTime desc " , model.Mobile, item.School_Name); DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0]; if (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() == "false") { Dictionary <string, string> Para = new Dictionary <string, string>(); Para.Add("template_id", "10581"); Para.Add("template_para_schoolname", item.School_Name); Para.Add("template_para_schoolurl", schoolUrl); string msg = (item.School_Name + schoolUrl + "已恢复正常"); Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "true", item.School_ID); } } #endregion #region 给学校群发短信 if (dtPerson.Rows.Count > 0) { SendMsgSchoolPerson(dtPerson, item.School_ID, model.Mobile, item.D_PublicValue, getResult, schoolUrl); } #endregion } } #region 记录检测结束信息并保存数据 model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "检测成功完成"; model_FileSyncExecRecord.FileSyncExecRecord_Status = "1"; bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); #endregion } catch (Exception ex) { model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "2"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "检测失败:" + ex.Message.ToString(); bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); } }