/// <summary> //根据用户Id列表发送短信 /// </summary> /// <param name="userIdList"></param> /// <param name="content"></param> public static String SendSmsNotice(List <string> userIdList, String content, long userId) { var userName = new BLL.CCOM.User_information().GetModel(userId).User_realname; if (userName != "") { userName = "******" + userName + ")"; } if (new BLL.CCOM.User_sms().GetModel(" User_id=" + userId).User_sms_left > 0) { var ml = new BLL.CCOM.User_information().GetModelList(" User_id in(" + String.Join(",", userIdList.ToArray()) + ")"); var phoneList = new List <String>(); foreach (var m in ml) { phoneList.Add(m.User_phone); } var res = ManDaoSMS.SendSMS(String.Join(",", phoneList.ToArray()), content + userName); if (res == ManDaoSMS.RESULT_SUCCESS) { //扣费 //ReduceUserSmsNumber(userId, phoneList.Count, content); } return(res); } return("no sms"); }
//发短信信息提醒 protected void SendSms(string RealName, string mobile) { string sms = this.txtMessageText.Text; sms = sms.Replace("{姓名}", RealName); ManDaoSMS.SendSMS(mobile, sms); }
private void SendSMSById(HttpContext context) { long userid = long.Parse(DESEncrypt.Decrypt(MyRequest.GetString("userid"))); string smsContent = "您有一项任务未完成,请加快进度。 任务标题:" + DESEncrypt.Decrypt(MyRequest.GetString("tasktitle")); string res = ManDaoSMS.SendSMS(new BLL.admin.Universities_UserInfo().GetModel(userid).UI_Mobile, smsContent); FlushResponse(context, res); }
private void sendPushResultSms(int count) { string pushResult = "您刚使用中央音乐学院招生系统给" + count + "位用户成功推送了一条通知.欲了解详情,请登录中央音乐学院招生系统,进入通知推送系统查看。"; if (ManDaoSMS.SendSMS(GetAdminInfo_CCOM().User_phone, pushResult) != ManDaoSMS.RESULT_SUCCESS) { JscriptMsg("推送结果的短信发送失败", "", "Error"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string phoneNumber = context.Request.Params["phoneNumber"].ToString(); if (!Validator.IsMobile(phoneNumber)) { context.Response.Write("手机号无效"); return; } //查询数据库中是否已经注册过 //Model.CCOM.User_infomation model = new BLL.CCOM.User_infomation().GetModel("User_mobile='" + phoneNumber + "'"); //if (model != null) //{ // context.Response.Write("该手机号已被注册"); // return; //} if (HttpContext.Current.Session[MyKeys.SESSION_PHONE_CODE_TIME] != null) { var dt = (DateTime)HttpContext.Current.Session[MyKeys.SESSION_PHONE_CODE_TIME]; if (dt.Add(new TimeSpan(0, 0, 60)) > DateTime.Now) { context.Response.Write("1分钟内只能获取一次验证码,请稍后获取"); return; } } //发送验证码 String code = Utils.Number(6); HttpContext.Current.Session[MyKeys.SESSION_PHONE_CODE] = code; HttpContext.Current.Session[MyKeys.SESSION_PHONE_CODE_TIME] = DateTime.Now; if (ManDaoSMS.SendSMS(phoneNumber, GetVCodeSms(phoneNumber, code)) == ManDaoSMS.RESULT_SUCCESS) { context.Response.Write("1"); } else { context.Response.Write("获取验证码失败,请重新获取"); } }
//根据用户手机号列表发送 public static String SendSmsByPhone(List <String> phoneList, String content, long userId) { var userName = new BLL.CCOM.User_information().GetModel(userId).User_realname; if (userName != "") { userName = "******" + userName + ")"; } if (new BLL.CCOM.User_sms().GetModel(" User_id=" + userId).User_sms_left > 0) { var res = ManDaoSMS.SendSMS(String.Join(",", phoneList.ToArray()), content + userName); if (res == ManDaoSMS.RESULT_SUCCESS) { //扣费 //ReduceUserSmsNumber(userId, phoneList.Count, content); } return(res); } return("no sms"); }
protected void GetPwdByPhone() { if (Session[MyKeys.SESSION_PHONE_CODE] == null) { this.lblReInfo.Text = "请输入手机验证码!"; return; } if (Session[MyKeys.SESSION_PHONE_CODE].ToString() != this.txtPhoneCode.Text) { this.lblReInfo.Text = "验证码输入不正确!"; return; } String userName = this.txtUserName1.Text.Trim(); String phone = this.txtPhone.Text.Trim(); if (userName == "") { this.lblReInfo.Text = "用户名为空!"; return; } if (userName.Length > 50 || !Common.Utils.IsSafeSqlString(userName)) { this.lblReInfo.Text = "用户名不合法!"; return; } if (!Validator.IsMobile(phone)) { this.lblReInfo.Text = "手机号不合法!"; return; } //判断用户是否存在 BLL.CCOM.User_information bll = new BLL.CCOM.User_information(); Model.CCOM.User_information model = bll.GetModel(" User_number='" + phone + "'"); if (model == null) { this.lblReInfo.Text = "用户信息不匹配!"; return; } BLL.CCOM.User_property userEx_bll = new BLL.CCOM.User_property(); Model.CCOM.User_property userEx_model = userEx_bll.GetModel(" User_id=" + model.User_id); if (userEx_model == null) { if (!model.User_realname.Equals(userName)) { this.lblReInfo.Text = "用户信息不匹配!"; return; } } else { if (!model.User_realname.Equals(userName) && !userEx_model.UP_CEE_number.Equals(userName)) { this.lblReInfo.Text = "用户信息不匹配!"; return; } } //更改密码 String newPwd = Utils.Number(6); model.User_password = DESEncrypt.MD5Encrypt(newPwd);//敏感字段 bll.Update(model); ManDaoSMS.SendSMS(phone, GetChangePwdSms(model.User_realname, newPwd)); this.lblReInfo.Text = "新密码已发送您的手机,请查看!"; }
protected void btnPhoneCode_Click(object sender, EventArgs e) { String userName = this.txtUserName1.Text.Trim(); String phone = this.txtPhone.Text.Trim(); if (userName == "") { this.lblReInfo.Text = "用户名为空!"; return; } if (userName.Length > 50 || !Common.Utils.IsSafeSqlString(userName)) { this.lblReInfo.Text = "用户名不合法!"; return; } if (!Validator.IsMobile(phone)) { this.lblReInfo.Text = "手机号不合法!"; return; } BLL.CCOM.User_information bll = new BLL.CCOM.User_information(); Model.CCOM.User_information model = bll.GetModel(" User_number='" + phone + "'"); if (model == null) { this.lblReInfo.Text = "用户信息不匹配!"; return; } BLL.CCOM.User_property userEx_bll = new BLL.CCOM.User_property(); Model.CCOM.User_property userEx_model = userEx_bll.GetModel(" User_id=" + model.User_id); if (userEx_model == null) { if (!model.User_realname.Equals(userName)) { this.lblReInfo.Text = "用户信息不匹配!"; return; } } else { if (!model.User_realname.Equals(userName) && !userEx_model.UP_CEE_number.Equals(userName)) { this.lblReInfo.Text = "用户信息不匹配!"; return; } } if (Session[MyKeys.SESSION_PHONE_CODE_TIME] != null) { DateTime dt = (DateTime)Session[MyKeys.SESSION_PHONE_CODE_TIME]; if (dt.Add(new TimeSpan(0, 0, 60)) > DateTime.Now) { this.lblReInfo.Text = "请您60秒后再获取手机验证码!"; return; } } //发送验证码 String code = Utils.Number(6); Session[MyKeys.SESSION_PHONE_CODE] = code; Session[MyKeys.SESSION_PHONE_CODE_TIME] = DateTime.Now; ManDaoSMS.SendSMS(phone, GetVCodeSms(model.User_realname, code)); this.lblReInfo.Text = "手机验证码已发送到您的手机!"; this.hidIsTick.Value = "1"; }