using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data; /// /// 网站配置 /// namespace Basic.BLL { public class sms { public static DataTable GetListByUser(Basic.Model.user muser) { Basic.DAL.address daladd = new Basic.DAL.address(); string strWhere = " id=0 "; if (muser != null) { strWhere = " user_id=" + muser.id; } DataTable dst = daladd.GetList(0,strWhere," status desc , id desc ").Tables[0]; return dst; } /// /// 判断当前这个手机号是否可以再发一次验证码 /// /// public static bool IsRepeat(string strMobile) { bool Flag = false; Basic.DAL.sms dals = new Basic.DAL.sms(); Basic.Model.sms models = dals.GetModel(strMobile); if (models != null) { if (DateTime.Now.Subtract(models.add_time).TotalSeconds < 60) { Flag = true; } } return Flag; } /// /// 获取一个随机的验证码,然后添加一条sms /// /// /// public static string GetSmsCode(string strPhone) { long ran = new Random().Next(10000, 100000); Basic.DAL.sms dals=new Basic.DAL.sms(); Basic.Model.sms models=new Basic.Model.sms(); models.phone=strPhone; models.smscode=ran.ToString(); models.add_time=DateTime.Now; dals.Add(models); return models.smscode; } } }