public ActionResult SendMobileCheckCode(string id) { SuggestionRes response = new SuggestionRes(); #region 各种校验 //从cookies中获取手机号码 var phone = Utils.ReadCookie("PhoneFind"); if (string.IsNullOrWhiteSpace(phone)) { response.errorCode = 2; return(Json(response)); } //验证手机号的状态是否是启用,并且标识(id)也正确 //验证码的时间不能超过半小时 #endregion //随机生成六位数字,并更新到数据库,还有当前时间 string vnum = Utils.GetByRndNum(6); IHuiYuanBLL m_BLL = new HuiYuanBLL(); response.errorCode = m_BLL.SetVC(phone, vnum, id); if (response.errorCode == 0) { //向手机发送验证码 ServiceReference1.MessageServiceSoapClient client = new ServiceReference1.MessageServiceSoapClient(); ServiceReference1.Mess mess = new ServiceReference1.Mess(); mess.Message1 = "【维修】" + vnum; mess.Phone = phone; mess.Token = "weixiu123?"; var data = client.MessageAdd(mess); if (data != 1) { } //使用cookies记录验证码,过期时间为1小时 Utils.WriteCookie("vcode", vnum, 0.1); } return(Json(response)); }
public ActionResult SendMobileCheckCode(string id) { SuggestionRes response = new SuggestionRes(); #region 各种校验 //从cookies中获取手机号码 var phone = Utils.ReadCookie("PhoneFind"); if (string.IsNullOrWhiteSpace(phone)) { response.errorCode = 2; return Json(response); } //验证手机号的状态是否是启用,并且标识(id)也正确 //验证码的时间不能超过半小时 #endregion //随机生成六位数字,并更新到数据库,还有当前时间 string vnum = Utils.GetByRndNum(6); IHuiYuanBLL m_BLL = new HuiYuanBLL(); response.errorCode = m_BLL.SetVC(phone, vnum, id); if (response.errorCode == 0) { //向手机发送验证码 ServiceReference1.MessageServiceSoapClient client = new ServiceReference1.MessageServiceSoapClient(); ServiceReference1.Mess mess = new ServiceReference1.Mess(); mess.Message1 = "【维修】"+vnum; mess.Phone = phone; mess.Token = "weixiu123?"; var data = client.MessageAdd(mess); if (data!=1) { } //使用cookies记录验证码,过期时间为1小时 Utils.WriteCookie("vcode", vnum, 0.1); } return Json(response); }