public ActionResult SendSecurityCode() { //UserEntity userEntity = new UserBLL().GetEntity(OperatorProvider.Provider.Current().ManagerId);//上级主管 UserEntity userEntity = new UserBLL().GetEntity("System");//系统管理员 if (!ValidateUtil.IsValidMobile(userEntity.Mobile)) { throw new Exception("手机格式不正确,请输入正确格式的手机号码。"); } var sms = smsLogBLL.GetLatestCurrent(userEntity.Mobile, 300); if (sms != null) { throw new Exception("验证码已发送,请与您上级主管联系"); } string SecurityCode = CommonHelper.RndNum(6); if (!string.IsNullOrEmpty(SecurityCode)) { SmsLogEntity smsLog = new SmsLogEntity(); smsLog.MobileNumber = userEntity.Mobile; smsLog.MsgContent = "验证码 " + SecurityCode + ",社保工资审核,当前审核人员:" + OperatorProvider.Provider.Current().LoginInfo.UserName + "。/退订短信回TD【博尔捷人才】"; smsLog.MsgValue = SecurityCode; // smsLogBLL.SaveBySend(smsLog); string url = "http://dxjk.51lanz.com/LANZGateway/DirectSendSMSs.asp"; string SMSparameters = @"UserID=998695&Account=szbridgehr&Password=503ADDD9B727F6F9F6A37F7469A42CC1593F2B43&Content=" + System.Web.HttpUtility.UrlEncode(smsLog.MsgContent, Encoding.GetEncoding("GB2312")) + "&Phones=" + userEntity.Mobile; string targeturl = url.Trim().ToString(); HttpWebRequest hr = (HttpWebRequest)WebRequest.Create(targeturl); string res = HttpSMSPost(hr, SMSparameters); Response.Write(res); smsLogBLL.SaveSmsLog(smsLog); } return(Success("发送成功。")); }
///<summary> ///短信保存并发送 ///</summary> ///<paramname="keyValue">主键值</param> ///<paramname="entity">实体对象</param> ///<returns></returns> public void SaveBySend(string MobileNumber, string MsgContent, string MsgValue) { try { SmsLogEntity entity = new SmsLogEntity(); entity.MobileNumber = MobileNumber; entity.MsgContent = MsgContent; entity.MsgValue = MsgValue; SmsModel smsModel = new SmsModel(); smsModel.account = Config.GetValue("SMSAccount"); smsModel.pswd = Config.GetValue("SMSPswd"); smsModel.url = Config.GetValue("SMSUrl"); smsModel.mobile = entity.MobileNumber; smsModel.msg = Config.GetValue("SMSPrefix") + entity.MsgContent; var result = SmsHelper.SendSmsByYM(smsModel); entity.SendResultCode = result.code; entity.SendResultMsg = result.msg; entity.IsDeleted = false; entity.SendTime = DateTime.Now; service.SaveForm(string.Empty, entity); } catch (Exception) { throw; } }
public ActionResult GetSecurityCodeByoffercomLogin(string mobileCode) { if (!ValidateUtil.IsValidMobile(mobileCode)) { throw new Exception("手机格式不正确,请输入正确格式的手机号码。"); } var sms = smsLogBLL.GetLatestCurrent(mobileCode, 120); if (sms != null) { throw new Exception("验证码已发送,请勿重复获取"); } string SecurityCode = CommonHelper.RndNum(6); if (!string.IsNullOrEmpty(SecurityCode)) { SmsLogEntity smsLog = new SmsLogEntity(); smsLog.MobileNumber = mobileCode; smsLog.MsgContent = "验证码 " + SecurityCode + ",客服账号登录,20分钟内验证码有效,切勿将验证码泄露于他人。/退订短信回TD【博尔捷人才】"; smsLog.MsgValue = SecurityCode; // smsLogBLL.SaveBySend(smsLog); string url = "http://dxjk.51lanz.com/LANZGateway/DirectSendSMSs.asp"; string SMSparameters = @"UserID=998695&Account=szbridgehr&Password=503ADDD9B727F6F9F6A37F7469A42CC1593F2B43&Content=" + System.Web.HttpUtility.UrlEncode(smsLog.MsgContent, Encoding.GetEncoding("GB2312")) + "&Phones=" + mobileCode; string targeturl = url.Trim().ToString(); HttpWebRequest hr = (HttpWebRequest)WebRequest.Create(targeturl); string res = HttpSMSPost(hr, SMSparameters); Response.Write(res); smsLogBLL.SaveSmsLog(smsLog); } return(Success("获取成功。")); }
///<summary> ///保存表单(新增、修改) ///</summary> ///<paramname="keyValue">主键值</param> ///<paramname="entity">实体对象</param> ///<returns></returns> public void SaveForm(string keyValue, SmsLogEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception) { throw; } }
public void SaveSmsLog(SmsLogEntity entity) { try { entity.SendResultCode = 0; entity.SendResultMsg = "成功"; entity.IsDeleted = false; entity.SendTime = DateTime.Now; service.SaveForm(string.Empty, entity); } catch (Exception) { throw; } }
public ActionResult GetPageListJson(Pagination pagination, string queryJson) { var watch = CommonHelper.TimerStart(); SmsLogEntity para = new SmsLogEntity(); if (!string.IsNullOrWhiteSpace(queryJson)) { var queryParam = queryJson.ToJObject(); if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty()) { DateTime startTime = queryParam["StartTime"].ToDate(); DateTime endTime = queryParam["EndTime"].ToDate(); para.StartTime = startTime.ToString(); para.EndTime = endTime.ToString(); } //类型 if (!queryParam["keyword"].IsEmpty()) { para.RecivMobile = queryParam["keyword"].ToString(); } } para.NoticeType = (int)RCHL.Model.Enums.SMNoticeType.年审短信; var pageList = new List <SmsLogEntity>(); try { pageList = SmsLogBLL.Instance.GetPageList(para, ref pagination); } catch (Exception ex) { } var JsonData = new { rows = pageList, total = pagination.total, page = pagination.page, records = pagination.records, costtime = CommonHelper.TimerEnd(watch) }; return(Content(JsonData.ToJson())); }
public ActionResult SaveForm(string keyValue, SmsLogEntity entity) { smslogbll.SaveForm(keyValue, entity); return(Success("操作成功。")); }
/// <summary> /// 导出EXCEL /// </summary> public void ExportExcel(string queryJson) { string cacheKey = Request["cacheid"] as string; HttpRuntime.Cache[cacheKey + "-state"] = "processing"; HttpRuntime.Cache[cacheKey + "-row"] = "0"; SmsLogEntity para = new SmsLogEntity(); try { //这里要url解码 var queryParam = Server.UrlDecode(queryJson).ToJObject(); if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty()) { DateTime startTime = queryParam["StartTime"].ToDate(); DateTime endTime = queryParam["EndTime"].ToDate(); para.StartTime = startTime.ToString(); para.EndTime = endTime.ToString(); } //类型 if (!queryParam["keyword"].IsEmpty()) { para.RecivMobile = queryParam["keyword"].ToString(); } para.NoticeType = (int)RCHL.Model.Enums.SMNoticeType.年审短信; var list = SmsLogBLL.Instance.GetList(para); if (list != null) { //设置导出格式 ExcelConfig excelconfig = new ExcelConfig(); excelconfig.Title = "年审车辆短信发送报表"; excelconfig.TitleFont = "微软雅黑"; excelconfig.TitlePoint = 10; excelconfig.FileName = "年审车辆短信发送报表.xls"; excelconfig.IsAllSizeColumn = true; //每一列的设置,没有设置的列信息,系统将按datatable中的列名导出 List <ColumnEntity> listColumnEntity = new List <ColumnEntity>(); excelconfig.ColumnEntity = listColumnEntity; ColumnEntity columnentity = new ColumnEntity(); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "RecivMobile", ExcelColumn = "车主号码", Width = 20 }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "CreateTime", ExcelColumn = "发送时间", Width = 20 }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "Exception", ExcelColumn = "发送状态", Width = 15 }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "Caption", ExcelColumn = "内容", Width = 15 }); //需合并索引 //excelconfig.MergeRangeIndexArr = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }; //调用导出方法 ExcelHelper <SmsLogEntity> .ExcelDownload(list, excelconfig); HttpRuntime.Cache[cacheKey + "-state"] = "done"; } } catch (Exception) { HttpRuntime.Cache[cacheKey + "-state"] = "error"; } }