public static List<ShortUserInfo> GetUserListWithDigestTopicList(string digestTopicList, int digestType) { IDataReader reader = DatabaseProvider.GetInstance().GetUserListWithDigestTopicList(digestTopicList, digestType); List<ShortUserInfo> users = new List<ShortUserInfo>(); while (reader.Read()) { ShortUserInfo userInfo = new ShortUserInfo(); userInfo.Uid = TypeConverter.ObjectToInt(reader["posterid"], -1); users.Add(userInfo); } reader.Close(); return users; }
/// <summary> /// 根据得到给定主题的用户列表(posterid) /// </summary> /// <param name="topicList">主题列表</param> /// <param name="op">操作源(0:精华,1:删除)</param> /// <param name="losslessdel">删帖不减积分时间期限(天)</param> /// <returns></returns> public static List<ShortUserInfo> GetUserListWithTopicList(string topicList, int op, int losslessdel) { IDataReader reader = null; if (op == 1 && losslessdel != 0) reader = DatabaseProvider.GetInstance().GetUserListWithTopicList(topicList, losslessdel); else reader = DatabaseProvider.GetInstance().GetUserListWithTopicList(topicList); List<ShortUserInfo> users = new List<ShortUserInfo>(); while (reader.Read()) { ShortUserInfo userInfo = new ShortUserInfo(); userInfo.Uid = TypeConverter.ObjectToInt(reader["posterid"], -1); users.Add(userInfo); } reader.Close(); return users; }
public static ShortUserInfo[] GetUserOnlinetime(string field) { IDataReader reader = DatabaseProvider.GetInstance().GetUserByOnlineTime(field); List<ShortUserInfo> list = new List<ShortUserInfo>(); while (reader.Read()) { ShortUserInfo u = new ShortUserInfo(); u.Username = reader["username"].ToString(); u.Uid = TypeConverter.ObjectToInt(reader["uid"]); u.Oltime = TypeConverter.ObjectToInt(reader[field]); u.Password = u.Secques = u.Nickname = u.Bday = string.Empty; list.Add(u); } reader.Close(); return list.ToArray(); }
/// <summary> /// 获得用户列表 /// </summary> /// <param name="type"></param> /// <returns></returns> public static ShortUserInfo[] GetUserArray(string type, string postTableId) { IDataReader reader = DatabaseProvider.GetInstance().GetUsersRank(20, postTableId, type); if (reader == null) return new ShortUserInfo[0]; List<ShortUserInfo> list = new List<ShortUserInfo>(); while (reader.Read()) { ShortUserInfo u = new ShortUserInfo(); u.Username = reader["username"].ToString(); u.Uid = Utils.StrToInt(reader["uid"], 0); switch (type) { case "digestposts": u.Digestposts = TypeConverter.ObjectToInt(reader["digestposts"]); break; case "credits": u.Credits = TypeConverter.ObjectToInt(reader["credits"]); break; case "extcredits1": u.Extcredits1 = TypeConverter.ObjectToFloat(reader["extcredits1"]); break; case "extcredits2": u.Extcredits2 = TypeConverter.ObjectToFloat(reader["extcredits2"]); break; case "extcredits3": u.Extcredits3 = TypeConverter.ObjectToFloat(reader["extcredits3"]); break; case "extcredits4": u.Extcredits4 = TypeConverter.ObjectToFloat(reader["extcredits4"]); break; case "extcredits5": u.Extcredits5 = TypeConverter.ObjectToFloat(reader["extcredits5"]); break; case "extcredits6": u.Extcredits6 = TypeConverter.ObjectToFloat(reader["extcredits6"]); break; case "extcredits7": u.Extcredits7 = TypeConverter.ObjectToFloat(reader["extcredits7"]); break; case "extcredits8": u.Extcredits8 = TypeConverter.ObjectToFloat(reader["extcredits8"]); break; case "oltime": u.Oltime = TypeConverter.ObjectToInt(reader["oltime"]); break; default: u.Posts = TypeConverter.ObjectToInt(reader["posts"]); break; } u.Password = u.Secques = u.Nickname = u.Bday = string.Empty; list.Add(u); } reader.Close(); return list.ToArray(); }
/// <summary> /// 判断用户密码是否正确 /// </summary> /// <param name="username">用户名</param> /// <param name="password">密码</param> /// <param name="originalpassword">是否为未MD5密码</param> /// <returns>如果正确则返回uid</returns> public static ShortUserInfo CheckPassword(string username, string password, bool originalpassword) { ShortUserInfo userInfo = null; if (appDBCache) { userInfo = IUserService.CheckPassword(username, password, originalpassword); if (userInfo != null) return userInfo; } IDataReader reader = DatabaseProvider.GetInstance().CheckPassword(username, password, originalpassword); if (reader.Read()) { userInfo = new ShortUserInfo(); userInfo.Uid = Utils.StrToInt(reader[0].ToString(), -1); userInfo.Groupid = Utils.StrToInt(reader[1].ToString(), -1); userInfo.Adminid = Utils.StrToInt(reader[2].ToString(), -1); } reader.Close(); if (appDBCache && userInfo.Uid > 0) GetUserInfo(userInfo.Uid); return userInfo; }
public static ShortUserInfo LoadSingleShortUserInfo(IDataReader reader) { ShortUserInfo userInfo = null; if (reader.Read()) { userInfo = new ShortUserInfo(); userInfo.Uid = TypeConverter.ObjectToInt(reader["uid"]); userInfo.Username = reader["username"].ToString(); userInfo.Nickname = reader["nickname"].ToString(); userInfo.Password = reader["password"].ToString(); userInfo.Spaceid = TypeConverter.ObjectToInt(reader["spaceid"]); userInfo.Secques = reader["secques"].ToString(); userInfo.Gender = TypeConverter.ObjectToInt(reader["gender"]); userInfo.Adminid = TypeConverter.ObjectToInt(reader["adminid"]); userInfo.Groupid = TypeConverter.ObjectToInt(reader["groupid"]); userInfo.Groupexpiry = TypeConverter.ObjectToInt(reader["groupexpiry"]); userInfo.Extgroupids = reader["extgroupids"].ToString(); userInfo.Regip = reader["regip"].ToString(); userInfo.Joindate = reader["joindate"].ToString(); userInfo.Lastip = reader["lastip"].ToString(); userInfo.Lastvisit = reader["lastvisit"].ToString(); userInfo.Lastactivity = reader["lastactivity"].ToString(); userInfo.Lastpost = reader["lastpost"].ToString(); userInfo.Lastpostid = TypeConverter.ObjectToInt(reader["lastpostid"]); userInfo.Lastposttitle = reader["lastposttitle"].ToString(); userInfo.Posts = TypeConverter.ObjectToInt(reader["posts"]); userInfo.Digestposts = TypeConverter.StrToInt(reader["digestposts"].ToString()); userInfo.Oltime = TypeConverter.ObjectToInt(reader["oltime"]); userInfo.Pageviews = TypeConverter.StrToInt(reader["pageviews"].ToString()); userInfo.Credits = TypeConverter.ObjectToInt(reader["credits"]); userInfo.Extcredits1 = TypeConverter.StrToFloat(reader["extcredits1"].ToString()); userInfo.Extcredits2 = TypeConverter.StrToFloat(reader["extcredits2"].ToString()); userInfo.Extcredits3 = TypeConverter.StrToFloat(reader["extcredits3"].ToString()); userInfo.Extcredits4 = TypeConverter.StrToFloat(reader["extcredits4"].ToString()); userInfo.Extcredits5 = TypeConverter.StrToFloat(reader["extcredits5"].ToString()); userInfo.Extcredits6 = TypeConverter.StrToFloat(reader["extcredits6"].ToString()); userInfo.Extcredits7 = TypeConverter.StrToFloat(reader["extcredits7"].ToString()); userInfo.Extcredits8 = TypeConverter.StrToFloat(reader["extcredits8"].ToString()); userInfo.Email = reader["email"].ToString(); userInfo.Bday = reader["bday"].ToString(); userInfo.Sigstatus = TypeConverter.ObjectToInt(reader["sigstatus"]); userInfo.Tpp = TypeConverter.ObjectToInt(reader["tpp"]); userInfo.Ppp = TypeConverter.ObjectToInt(reader["ppp"]); userInfo.Templateid = TypeConverter.ObjectToInt(reader["templateid"]); userInfo.Pmsound = TypeConverter.ObjectToInt(reader["pmsound"]); userInfo.Showemail = TypeConverter.ObjectToInt(reader["showemail"]); userInfo.Newsletter = (ReceivePMSettingType)TypeConverter.ObjectToInt(reader["newsletter"]); userInfo.Invisible = TypeConverter.ObjectToInt(reader["invisible"]); userInfo.Newpm = TypeConverter.ObjectToInt(reader["newpm"]); userInfo.Newpmcount = TypeConverter.ObjectToInt(reader["newpmcount"]); userInfo.Accessmasks = TypeConverter.ObjectToInt(reader["accessmasks"]); userInfo.Onlinestate = TypeConverter.ObjectToInt(reader["onlinestate"]); userInfo.Salt = reader["salt"].ToString();//二次MD5所用的字段 } reader.Close(); return userInfo; }
/// <summary> /// 获得百度论坛收录协议xml /// </summary> /// <param name="ttl">TTL数值</param> /// <returns></returns> public static string GetBaiduSitemap(string sbforumlist, ShortUserInfo master) { StringBuilder sitemapBuilder = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n"); IDataReader reader = DatabaseProvider.GetInstance().GetSitemapNewTopics(sbforumlist.ToString()); sitemapBuilder.Append("<document xmlns:bbs=\"http://www.baidu.com/search/bbs_sitemap.xsd\">\r\n"); sitemapBuilder.AppendFormat(" <webSite>{0}</webSite>\r\n", forumurl); sitemapBuilder.AppendFormat(" <webMaster>{0}</webMaster>\r\n", master != null ? master.Email : ""); sitemapBuilder.AppendFormat(" <updatePeri>{0}</updatePeri>\r\n", config.Sitemapttl); sitemapBuilder.AppendFormat(" <updatetime>{0}</updatetime>\r\n", DateTime.Now.ToString("r")); sitemapBuilder.AppendFormat(" <version>AseFront {0}</version>\r\n", Utils.GetAssemblyVersion()); if (reader != null) { while (reader.Read()) { sitemapBuilder.Append(" <item>\r\n"); sitemapBuilder.AppendFormat(" <link>{0}", Utils.HtmlEncode(forumurl)); if (config.Aspxrewrite == 1) sitemapBuilder.AppendFormat("showtopic-{0}{1}", reader["tid"], config.Extname); else sitemapBuilder.AppendFormat("showtopic-{0}", reader["tid"]); sitemapBuilder.Append(" </link>\r\n"); sitemapBuilder.AppendFormat(" <title>{0}</title>\r\n", Utils.HtmlEncode(reader["title"].ToString().Trim())); sitemapBuilder.AppendFormat(" <pubDate>{0}</pubDate>\r\n", Utils.HtmlEncode(reader["postdatetime"].ToString().Trim())); sitemapBuilder.AppendFormat(" <bbs:lastDate>{0}</bbs:lastDate>\r\n", reader["lastpost"]); sitemapBuilder.AppendFormat(" <bbs:reply>{0}</bbs:reply>\r\n", reader["replies"]); sitemapBuilder.AppendFormat(" <bbs:hit>{0}</bbs:hit>\r\n", reader["views"]); sitemapBuilder.AppendFormat(" <bbs:boardid>{0}</bbs:boardid>\r\n", reader["fid"]); sitemapBuilder.AppendFormat(" <bbs:pick>{0}</bbs:pick>\r\n", reader["digest"]); sitemapBuilder.Append(" </item>\r\n"); } reader.Close(); sitemapBuilder.Append("</document>"); } else { sitemapBuilder.Length = 0; sitemapBuilder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"); sitemapBuilder.Append("<document>Error</document>\r\n"); } return sitemapBuilder.ToString(); }