@ -0,0 +1,30 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Web; | |||||
using System.Data; | |||||
/// <summary> | |||||
/// 网站配置 | |||||
/// </summary> | |||||
namespace Basic.BLL | |||||
{ | |||||
public class address | |||||
{ | |||||
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; | |||||
} | |||||
} | |||||
} |
@ -0,0 +1,204 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Web; | |||||
/// <summary> | |||||
/// 网站配置 | |||||
/// </summary> | |||||
namespace Basic.BLL | |||||
{ | |||||
public class attribute | |||||
{ | |||||
/// <summary> | |||||
/// 读取attribute分类的名字 | |||||
/// </summary> | |||||
public static string GetTitle(int id) | |||||
{ | |||||
Basic.DAL.attribute dala = new Basic.DAL.attribute(); | |||||
Basic.Model.attribute modela = dala.GetModel(id); | |||||
string strTitle = ""; | |||||
if (modela != null) | |||||
{ | |||||
strTitle = modela.title; | |||||
} | |||||
return strTitle; | |||||
} | |||||
/// <summary> | |||||
/// 获取根据产品id和属性id获取属性的名字 | |||||
/// </summary> | |||||
/// <param name="_attrid"></param> | |||||
/// <param name="_proid"></param> | |||||
/// <returns></returns> | |||||
public static string GetListTitle(int _attrid, int _proid) | |||||
{ | |||||
Basic.DAL.product_attribute_list dal = new Basic.DAL.product_attribute_list(); | |||||
Basic.Model.product_attribute_list model = dal.GetModel(_attrid, _proid); | |||||
if (model != null) | |||||
{ | |||||
return model.title; | |||||
} | |||||
else | |||||
{ | |||||
return ""; | |||||
} | |||||
} | |||||
public static string GetAllAttrId(int _color, string _size, int _proid) | |||||
{ | |||||
string strAttrId = ""; | |||||
strAttrId += _color + ","; | |||||
if (_size != "") | |||||
{ | |||||
string[] ArraySize = _size.Split(','); | |||||
for (int i = 0; i < ArraySize.Length; i++) | |||||
{ | |||||
strAttrId += ArraySize[i] + ","; | |||||
} | |||||
} | |||||
if (strAttrId != "") | |||||
{ | |||||
strAttrId = strAttrId.Substring(0, strAttrId.Length - 1); | |||||
} | |||||
return strAttrId; | |||||
} | |||||
public static string GetAllAttr(int _color, string _size, int _proid) | |||||
{ | |||||
string strAttrId = ""; | |||||
strAttrId += GetListTitle(_color, _proid) + ","; | |||||
if (_size != "") | |||||
{ | |||||
string[] ArraySize = _size.Split(','); | |||||
for (int i = 0; i < ArraySize.Length; i++) | |||||
{ | |||||
strAttrId += GetListTitle(Convert.ToInt32(ArraySize[i]), _proid) + ","; | |||||
} | |||||
} | |||||
if (strAttrId != "") | |||||
{ | |||||
strAttrId = strAttrId.Substring(0, strAttrId.Length - 1); | |||||
} | |||||
return strAttrId; | |||||
} | |||||
public static string GetAttriString(int _color, string _size) | |||||
{ | |||||
string strWhereSize = ""; | |||||
if (_size != "") | |||||
{ | |||||
strWhereSize += "-" + _size.Replace(",", "-") + "-"; | |||||
} | |||||
string strWhereColor = ""; | |||||
if (_color != 0) | |||||
{ | |||||
strWhereColor += "-" + _color + "-"; | |||||
} | |||||
string strWhere = strWhereColor + strWhereSize; | |||||
strWhere = strWhere.Replace("--", "-"); | |||||
return strWhere; | |||||
} | |||||
//显示属性名称 | |||||
public static string ShowSizeAttribute(string _size, int _proid) | |||||
{ | |||||
string strResult = ""; | |||||
if (!string.IsNullOrEmpty(_size)) | |||||
{ | |||||
string[] ArraySzie = _size.Split(','); | |||||
for (int m = 0; m < ArraySzie.Length; m++) | |||||
{ | |||||
strResult += attribute.GetListTitle(Convert.ToInt32(ArraySzie[m]), _proid) + ","; | |||||
} | |||||
} | |||||
strResult = strResult.Trim(); | |||||
return strResult; | |||||
} | |||||
//显示属性名称 | |||||
public static string ShowAttribute(int _color, string _size, int _proid) | |||||
{ | |||||
string strResult = ""; | |||||
Basic.DAL.product_attribute_list dala = new Basic.DAL.product_attribute_list(); | |||||
Basic.Model.product_attribute_list modela = dala.GetModel(_color, _proid); | |||||
if (modela != null) | |||||
{ | |||||
strResult += modela.title + ","; | |||||
} | |||||
strResult += ShowSizeAttribute(_size, _proid); | |||||
strResult = strResult.Trim(','); | |||||
return strResult; | |||||
} | |||||
public static int GetKucun(string attrid, int _proid) | |||||
{ | |||||
int Kucun = 0; | |||||
Basic.DAL.product_attribute_value dalpav = new Basic.DAL.product_attribute_value(); | |||||
Basic.Model.product_attribute_value modelpayv = dalpav.GetModel(_proid, ("-" + attrid.Replace(",", "-") + "-")); | |||||
if (modelpayv != null) | |||||
{ | |||||
Kucun = modelpayv.count; | |||||
} | |||||
else | |||||
{ | |||||
Basic.DAL.product dalp = new Basic.DAL.product(); | |||||
Basic.Model.product modelp = dalp.GetModel(_proid); | |||||
if (modelp != null) | |||||
{ | |||||
Kucun = modelp.kucun; | |||||
} | |||||
} | |||||
return Kucun; | |||||
} | |||||
public static string CountKucun(string attrid,int _proid,int _count,string strProInfo) | |||||
{ | |||||
bool Flag = true; | |||||
int Kucun = 0; | |||||
int yiyouCount = 0; | |||||
Basic.DAL.product_attribute_value dalpav = new Basic.DAL.product_attribute_value(); | |||||
Basic.Model.product_attribute_value modelpayv = dalpav.GetModel(_proid,("-"+attrid.Replace(",","-")+"-")); | |||||
if (modelpayv != null) | |||||
{ | |||||
Kucun = modelpayv.count; | |||||
if (Kucun < _count) | |||||
{ | |||||
Flag = false; | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
Basic.DAL.product dalp = new Basic.DAL.product(); | |||||
Basic.Model.product modelp = dalp.GetModel(_proid); | |||||
if (modelp != null) | |||||
{ | |||||
if (modelp.kucun < _count) | |||||
{ | |||||
Flag = false; | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
Flag = false; | |||||
} | |||||
} | |||||
if (!Flag) | |||||
{ | |||||
return "产品["+strProInfo.Trim()+"]库存少于购买数量。 "; | |||||
} | |||||
else | |||||
{ | |||||
return ""; | |||||
} | |||||
} | |||||
} | |||||
} |
@ -0,0 +1,55 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Web; | |||||
namespace Basic.BLL | |||||
{ | |||||
/// <summary> | |||||
/// 管理员 | |||||
/// </summary> | |||||
public class manager_role | |||||
{ | |||||
/// <summary> | |||||
/// 检查是否有权限 | |||||
/// </summary> | |||||
public bool Exists(int role_id, string channel_name, string action_type) | |||||
{ | |||||
Model.manager_role model = new DAL.manager_role().GetModel(role_id); | |||||
if (model != null) | |||||
{ | |||||
if (model.role_type == 1) | |||||
{ | |||||
return true; | |||||
} | |||||
Model.manager_role_value modelt = model.manager_role_values.Find(p => p.channel_name == channel_name && p.action_type == action_type); | |||||
if (modelt != null) | |||||
{ | |||||
return true; | |||||
} | |||||
} | |||||
return false; | |||||
} | |||||
/// <summary> | |||||
/// 检查是否有权限 | |||||
/// </summary> | |||||
public bool Exists(int role_id, int channel_id, string action_type) | |||||
{ | |||||
Model.manager_role model = new DAL.manager_role().GetModel(role_id); | |||||
if (model != null) | |||||
{ | |||||
if (model.role_type == 1) | |||||
{ | |||||
return true; | |||||
} | |||||
Model.manager_role_value modelt = model.manager_role_values.Find(p => p.channel_id == channel_id && p.action_type == action_type); | |||||
if (modelt != null) | |||||
{ | |||||
return true; | |||||
} | |||||
} | |||||
return false; | |||||
} | |||||
} | |||||
} |
@ -0,0 +1,43 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Web; | |||||
using System.Data; | |||||
using Basic; | |||||
using System.Collections; | |||||
/// <summary> | |||||
/// 网站配置 | |||||
/// </summary> | |||||
namespace Basic.BLL | |||||
{ | |||||
public class news_class | |||||
{ | |||||
/// <summary> | |||||
/// 获取父级列表 | |||||
/// </summary> | |||||
/// <param name="_classid"></param> | |||||
/// <returns></returns> | |||||
public static Hashtable GetParentList(int _classid) | |||||
{ | |||||
Hashtable htList = new Hashtable(); | |||||
int _parentId = _classid; | |||||
int i = 0; | |||||
while (_parentId > 0) | |||||
{ | |||||
Basic.DAL.news_class dalp = new Basic.DAL.news_class(); | |||||
Basic.Model.news_class modelparent = dalp.GetModel(_parentId); | |||||
i++; | |||||
htList.Add("title"+i, modelparent.title); | |||||
htList.Add("url"+i, modelparent.url); | |||||
if (modelparent != null) | |||||
{ | |||||
_parentId = modelparent.parent_id; | |||||
} | |||||
} | |||||
return htList; | |||||
} | |||||
} | |||||
} |
@ -0,0 +1,148 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Web; | |||||
using System.Data; | |||||
/// <summary> | |||||
/// 网站配置 | |||||
/// </summary> | |||||
namespace Basic.BLL | |||||
{ | |||||
public class order | |||||
{ | |||||
public static int GetPayNum(string orderid) | |||||
{ | |||||
int Num = 0; | |||||
Basic.DAL.order dalo = new Basic.DAL.order(); | |||||
Basic.Model.order modelo = dalo.GetModel(orderid); | |||||
if (modelo != null) | |||||
{ | |||||
modelo.paynum++; | |||||
dalo.Update(modelo); | |||||
Num = modelo.paynum; | |||||
} | |||||
return Num; | |||||
} | |||||
public static void assetOrder(string orderid, string paytype) | |||||
{ | |||||
if (orderid.IndexOf("_") != (-1)) | |||||
{ | |||||
orderid = orderid.Split('_')[0]; | |||||
} | |||||
try | |||||
{ | |||||
Basic.DAL.order dalo = new Basic.DAL.order(); | |||||
Basic.Model.order modelo = dalo.GetModel(orderid); | |||||
DateTime dtPay = DateTime.Now; | |||||
if (modelo != null) | |||||
{ | |||||
#region 将订单状态标记为已结算 | |||||
modelo.paystate = 1; | |||||
modelo.zhifutype = paytype; | |||||
modelo.paydate =dtPay.ToString("yyyy-MM-dd HH:mm:ss") ; | |||||
#endregion | |||||
#region 将订单的商品库存减少 | |||||
Basic.DAL.orderdetail dalod = new Basic.DAL.orderdetail(); | |||||
DataTable dstOd = dalod.GetList(0, " orderid='" + orderid + "' ", " id desc").Tables[0]; | |||||
string strProInfo = ""; | |||||
for (int i = 0; i < dstOd.Rows.Count; i++) | |||||
{ | |||||
//if (i < 3) | |||||
//{ | |||||
// strProInfo += dstOd.Rows[i]["product_name"].ToString() + dstOd.Rows[i]["attribute"].ToString() + " ,"; | |||||
//} | |||||
int count = Convert.ToInt32(dstOd.Rows[i]["count"].ToString()); | |||||
int proid = Convert.ToInt32(dstOd.Rows[i]["product_id"].ToString()); | |||||
Basic.DAL.product dalp = new Basic.DAL.product(); | |||||
Basic.Model.product modelp = dalp.GetModel(proid); | |||||
modelp.kucun -= count; | |||||
#region 不同的款式也要精确一下,去扣相应的库存 | |||||
string strAttri = dstOd.Rows[i]["attribute_id"].ToString(); | |||||
if (!(strAttri == "" || strAttri == "0,")) | |||||
{ | |||||
Basic.DAL.product_attribute_value dalpav = new Basic.DAL.product_attribute_value(); | |||||
Basic.Model.product_attribute_value modelpav = dalpav.GetModel(proid, ("-" + strAttri.Replace(",", "-") + "-")); | |||||
if (modelpav != null) | |||||
{ | |||||
modelpav.count -= count; | |||||
dalpav.Update(modelpav); | |||||
string[] ArrayProAttr = modelp.attribute_content.Split('|'); | |||||
string strAttrContent = ""; | |||||
for (int m = 0; m < ArrayProAttr.Length - 1; m++) | |||||
{ | |||||
string strAttrId = ArrayProAttr[m].Split(',')[0]; | |||||
string strAttrCount = ArrayProAttr[m].Split(',')[1]; | |||||
if (strAttrId == dstOd.Rows[i]["attribute_id"].ToString().Replace(",", "-") + "_0") | |||||
{ | |||||
int intAttrCount = Convert.ToInt32(strAttrCount) - count; | |||||
strAttrContent += strAttrId + "," + intAttrCount.ToString() + "|"; | |||||
} | |||||
else | |||||
{ | |||||
strAttrContent += ArrayProAttr[m] + "|"; | |||||
} | |||||
} | |||||
if (ArrayProAttr.Length > 1) | |||||
{ | |||||
modelp.attribute_content = strAttrContent; | |||||
} | |||||
} | |||||
} | |||||
//销量增加 | |||||
modelp.sales += count; | |||||
dalp.Update(modelp); | |||||
#endregion | |||||
} | |||||
strProInfo = dstOd.Rows.Count + "件"; | |||||
//strProInfo = strProInfo.Trim(','); | |||||
//if (dstOd.Rows.Count > 3) | |||||
//{ | |||||
// strProInfo += "等"; | |||||
//} | |||||
//发信息给管理员通知他付款了。 | |||||
//wxutil.WX_Util.log(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "_即将发短信:" + strProInfo + "__" + orderid + "<br/>"); | |||||
if (modelo.smsstatus == "" || modelo.smsstatus==null) { modelo.smsstatus = "|"; } | |||||
if (modelo.smsstatus.IndexOf("|pay|") == (-1)) | |||||
{ | |||||
//通知管理员 | |||||
if (Basic.Tools.SendSms.SendPayTz(orderid, strProInfo, modelo.price.ToString(), modelo.userid, paytype, dtPay) == "发送成功") | |||||
{ | |||||
modelo.smsstatus += "pay|"; | |||||
} | |||||
} | |||||
if (modelo.smsstatus.IndexOf("|pay2|") == (-1)) | |||||
{ | |||||
//通知会员 | |||||
if (Basic.Tools.SendSms.SendPayTz2(orderid, strProInfo, modelo.price.ToString(), modelo.userid, paytype, dtPay) == "发送成功") | |||||
{ | |||||
modelo.smsstatus += "pay2|"; | |||||
} | |||||
} | |||||
dalo.Update(modelo); | |||||
#endregion | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
wxutil.WX_Util.log(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "_error:" + ex.Message.ToString() + " ex.StackTrace:" + ex.StackTrace + "<br/>"); | |||||
} | |||||
} | |||||
} | |||||
} |
@ -0,0 +1,121 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Web; | |||||
using System.Data; | |||||
using Basic; | |||||
using System.Collections; | |||||
/// <summary> | |||||
/// 网站配置 | |||||
/// </summary> | |||||
namespace Basic.BLL | |||||
{ | |||||
public class product | |||||
{ | |||||
public static string GetParentWhere(int _parentid) | |||||
{ | |||||
Basic.BLL.product bllp = new Basic.BLL.product(); | |||||
string strWhereParentId = _parentid.ToString(); | |||||
strWhereParentId += bllp.GetChild("", _parentid); | |||||
return strWhereParentId; | |||||
} | |||||
private string GetChild(string strAllChild, int _parentid) | |||||
{ | |||||
Basic.DAL.pro_class dalpc = new Basic.DAL.pro_class(); | |||||
DataTable dt = dalpc.GetList(_parentid); | |||||
for (int i = 0; i < dt.Rows.Count; i++) | |||||
{ | |||||
int childId = Convert.ToInt32(dt.Rows[i]["id"].ToString()); | |||||
strAllChild += "," + childId; | |||||
strAllChild = GetChild(strAllChild, childId); | |||||
} | |||||
return strAllChild; | |||||
} | |||||
/// <summary> | |||||
/// 取顶级父级的id | |||||
/// </summary> | |||||
/// <param name="_classid"></param> | |||||
/// <returns></returns> | |||||
public static int GetParentId(int _classid) | |||||
{ | |||||
int _parentId = _classid; | |||||
int _parent2 = 0; | |||||
while (_parentId > 0) | |||||
{ | |||||
_parent2 = _parentId; | |||||
Basic.DAL.pro_class dalp = new Basic.DAL.pro_class(); | |||||
Basic.Model.pro_class modelp = dalp.GetModel(_parentId); | |||||
if (modelp != null) | |||||
{ | |||||
_parentId = modelp.parent_id; | |||||
} | |||||
} | |||||
return _parent2; | |||||
} | |||||
public static Hashtable GetParentListName(int _classid) | |||||
{ | |||||
Hashtable htList = new Hashtable(); | |||||
int _parentId = _classid; | |||||
int i = 0; | |||||
while (_parentId > 0) | |||||
{ | |||||
Basic.DAL.pro_class dalp = new Basic.DAL.pro_class(); | |||||
Basic.Model.pro_class modelparent = dalp.GetModel(_parentId); | |||||
i++; | |||||
htList.Add("title"+i, modelparent.title); | |||||
htList.Add("id"+i, modelparent.id); | |||||
if (modelparent != null) | |||||
{ | |||||
_parentId = modelparent.parent_id; | |||||
} | |||||
} | |||||
return htList; | |||||
} | |||||
/// <summary> | |||||
/// 根据某一个列,来获得排列的值 | |||||
/// </summary> | |||||
/// <param name="strWhere"></param> | |||||
/// <param name="key"></param> | |||||
/// <returns></returns> | |||||
public static DataTable GetListGroup(string strWhere,string key) | |||||
{ | |||||
BasicPage bp=new BasicPage(); | |||||
DataTable dt = bp.SelectDataBase("news", "select " + key + ",count(id) as countid from tb_product where " + key + "<>'' and " + key + " is not null and " + strWhere + " group by " + key + " order by count(id) desc").Tables[0]; | |||||
return dt; | |||||
} | |||||
/// <summary> | |||||
/// 获取价格范围 | |||||
/// </summary> | |||||
/// <param name="strWhere"></param> | |||||
/// <returns></returns> | |||||
public static string[] GetPriceRange(string strWhere) | |||||
{ | |||||
Basic.DAL.product dalp = new Basic.DAL.product(); | |||||
Decimal deMax = dalp.GetMaxPrice(strWhere); | |||||
int intCount = 0; | |||||
if (deMax % 100.00m > 0.00m) | |||||
{ | |||||
intCount = (Convert.ToInt32((deMax-(deMax % 100.00m)) / 100.00m) + 1); | |||||
} | |||||
else | |||||
{ | |||||
intCount = Convert.ToInt32( deMax / 100.00m) ; | |||||
} | |||||
string[] ArrayRange=new string[ intCount ]; | |||||
for (int i = 0; i < intCount; i++) | |||||
{ | |||||
ArrayRange[i] = (i*100)+"-"+((i+1)*100); | |||||
} | |||||
return ArrayRange; | |||||
} | |||||
} | |||||
} |
@ -0,0 +1,82 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Web; | |||||
/// <summary> | |||||
/// 网站配置 | |||||
/// </summary> | |||||
namespace Basic.BLL | |||||
{ | |||||
public class siteconfig | |||||
{ | |||||
private readonly Basic.DAL.siteconfig dal = new Basic.DAL.siteconfig(); | |||||
/// <summary> | |||||
/// 读取配置文件 | |||||
/// </summary> | |||||
public Basic.Model.siteconfig loadConfig(string configFilePath) | |||||
{ | |||||
Basic.Model.siteconfig model = CacheHelper.Get<Basic.Model.siteconfig>(Keys.CACHE_SITE_CONFIG); | |||||
if (model == null) | |||||
{ | |||||
CacheHelper.Insert(Keys.CACHE_SITE_CONFIG, dal.loadConfig(configFilePath), configFilePath); | |||||
model = CacheHelper.Get<Basic.Model.siteconfig>(Keys.CACHE_SITE_CONFIG); | |||||
} | |||||
return model; | |||||
} | |||||
/// <summary> | |||||
/// 读取客户端站点配置信息 | |||||
/// </summary> | |||||
public Basic.Model.siteconfig loadConfig(string configFilePath, bool isClient) | |||||
{ | |||||
Basic.Model.siteconfig model = CacheHelper.Get<Basic.Model.siteconfig>(Keys.CACHE_SITE_CONFIG_CLIENT); | |||||
if (model == null) | |||||
{ | |||||
model = dal.loadConfig(configFilePath); | |||||
model.templateskin = model.webpath + "templates/" + model.templateskin; | |||||
CacheHelper.Insert(Keys.CACHE_SITE_CONFIG_CLIENT, model, configFilePath); | |||||
} | |||||
return model; | |||||
} | |||||
public static string getConfig(string valueName) | |||||
{ | |||||
Basic.BLL.siteconfig bll = new Basic.BLL.siteconfig(); | |||||
Basic.Model.siteconfig model = bll.loadConfig(Basic.Tools.Utils.GetXmlMapPath(Basic.Keys.FILE_SITE_XML_CONFING)); | |||||
string strResult = ""; | |||||
if (model != null) | |||||
{ | |||||
switch (valueName) | |||||
{ | |||||
case "appid": | |||||
strResult = model.Wechat_appid; | |||||
break; | |||||
case "appsecret": | |||||
strResult = model.Wechat_appsecret; | |||||
break; | |||||
case "mchid": | |||||
strResult = model.Wechat_hchid; | |||||
break; | |||||
case "key": | |||||
strResult = model.Wechat_key; | |||||
break; | |||||
} | |||||
} | |||||
return strResult; | |||||
} | |||||
/// <summary> | |||||
/// 保存配置文件 | |||||
/// </summary> | |||||
public Basic.Model.siteconfig saveConifg(Basic.Model.siteconfig model, string configFilePath) | |||||
{ | |||||
return dal.saveConifg(model, configFilePath); | |||||
} | |||||
} | |||||
} |
@ -0,0 +1,66 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Web; | |||||
using System.Data; | |||||
/// <summary> | |||||
/// 网站配置 | |||||
/// </summary> | |||||
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; | |||||
} | |||||
/// <summary> | |||||
/// 判断当前这个手机号是否可以再发一次验证码 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
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; | |||||
} | |||||
/// <summary> | |||||
/// 获取一个随机的验证码,然后添加一条sms | |||||
/// </summary> | |||||
/// <param name="strPhone"></param> | |||||
/// <returns></returns> | |||||
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; | |||||
} | |||||
} | |||||
} |