/// <summary> /// 获取最新资讯,前9条 /// </summary> /// <param name="top">指定需要获取的数目</param> /// <param name="where">查询条件</param> /// <param name="num">标题字数限制</param> /// <returns></returns> public static string Get_New_ZX(int top, string where = "", int num = 22) { sbr.Clear(); try { string sql = "select top " + top + " id,title,types from hrenh_article where isend=0 and pub_state=0"; if (where != "") { sql += " and " + where; } else { sql += " and (types in(1,3,4,5) or types_pid in(1,3,4,5)) "; } sql += " order by istop desc,edittime desc"; ds = DbHelperSQL.Query(sql); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; int article_id = String_Manage.Return_Int(dr["id"].ToString(), 0); string article_title = String_Manage.Return_Str(dr["title"].ToString(), ""); string show_article_title = StringHelper.ReturnNumStr(article_title, 1, num); string article_url = "href=\"/article_detail_" + article_id + "\" target=\"_blank\" title=\"" + article_title + "\""; article_url = "href=\"/" + ArticleHelper.Get_Nav_Type_Name(Convert.ToInt32(dr["types"].ToString())) + "/detail_" + article_id + ".html\" target=\"_blank\" title=\"" + article_title + "\""; sbr.AppendFormat("<li>"); sbr.AppendFormat("<a {0}>{1}</a>", article_url, show_article_title); sbr.AppendFormat("</li>"); } } else { sbr.Append("<div class=\"nodata\">没有找到相关数据</div>"); } } catch (Exception ex) { sbr.AppendFormat(ex.ToString()); } return(sbr.ToString()); }
/// <summary> /// 获取列表页热点文章 /// </summary> /// <returns></returns> public static string Get_Hot_Articel() { sbr.Clear(); ds = recommend_bll.GetList_NewIndex(0, " pageid=2100 and cid=1001 "); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; string title = StringHelper.ReturnNumStr(dr["v1"].ToString(), 1, 0); string desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 0, 80); string imgurl = ImgHelper.GetCofigShowUrl() + dr["v3"].ToString(); string httpurl = String_Manage.Return_Str(dr["url"].ToString(), ""); //链接打开方式,1:在本页面打,2:在新页面打开 int openstyle = String_Manage.Return_Int(dr["v4"].ToString(), 0); string show_title = StringHelper.ReturnNumStr(title, 3, 20); sbr.AppendFormat("<li>"); if (openstyle != 1 && openstyle != 2) { sbr.AppendFormat("<a href=\"javascript:void(0)\" title=\"{0}\">{1}</a>", title, show_title); } else { if (httpurl.ToLower().Contains("http://")) { sbr.AppendFormat("<a {1} target='_blank' title=\"{0}\">{2}</a>", title, Return_HttpURL.Return_Url(httpurl, openstyle), show_title); } else { sbr.AppendFormat("<a href='{1}' target='_blank' title=\"{0}\">{2}</a>", title, Return_HttpURL.Return_Url(httpurl, openstyle), show_title); } } sbr.AppendFormat("</li>"); } } return(sbr.ToString()); }
/// <summary> /// 获取文章详情右侧广告图 /// </summary> /// <returns></returns> public static string Get_Article_Detail_Ad(int cid) { sbr.Clear(); ds = recommend_bll.GetList_NewIndex(1, " pageid=" + pid + " and cid= " + cid); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; string title = StringHelper.ReturnNumStr(dr["v1"].ToString(), 0, 0); string show_title = StringHelper.ReturnNumStr(title, 0, 22); string desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 0, 80); string imgurl = ImgHelper.GetCofigShowUrl() + dr["v3"].ToString(); string httpurl = String_Manage.Return_Str(dr["url"].ToString(), ""); //链接打开方式,1:在本页面打,2:在新页面打开 int openstyle = String_Manage.Return_Int(dr["v4"].ToString(), 0); string width_height = "height=\"250\" width=\"300\""; if (cid == 1011) { width_height = "height=\"60\" width=\"640\""; } if (openstyle != 1 && openstyle != 2) { sbr.AppendFormat("<a href=\"javascript:void(0)\" title=\"{0}\">", title); sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, title, width_height); sbr.AppendFormat("</a>"); } else { sbr.AppendFormat("<a {1} title=\"{0}\">", title, Return_HttpURL.Return_Url(httpurl, openstyle)); sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, title, width_height); sbr.AppendFormat("</a>"); } } } return(sbr.ToString()); }
/// <summary> /// 获取文章相关热门文章 /// </summary> /// <param name="article_id">当前被访问的文章的ID,可为0(代表列表页)</param> /// <returns></returns> public static string Get_New_Article(int article_id) { sbr.Clear(); ds = recommend_bll.GetList_NewIndex(10, " pageid=" + pid + " and cid=1008 "); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; string desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 0, 80); string imgurl = ImgHelper.GetCofigShowUrl() + dr["v3"].ToString(); string httpurl = String_Manage.Return_Str(dr["url"].ToString(), ""); //链接打开方式,1:在本页面打,2:在新页面打开 int openstyle = String_Manage.Return_Int(dr["v4"].ToString(), 0); string title = ""; try { title = DbHelperSQL.GetSingle("select top 1 isnull(title,0) as title from hrenh_article where id=" + desc + " and pub_state=0").ToString(); } catch (Exception ex) { } title = StringHelper.ReturnNumStr(title, 0, 0); string show_title = StringHelper.ReturnNumStr(title, 0, 18); sbr.AppendFormat("<li>"); sbr.AppendFormat("<i>{0}</i>", (i + 1)); if (openstyle != 1 && openstyle != 2) { sbr.AppendFormat("<a href=\"javascript:void(0)\" title=\"{0}\">{1}</a>", title, show_title); } else { sbr.AppendFormat("<a {1} title=\"{0}\">{2}</a>", title, Return_HttpURL.Return_Url(httpurl, openstyle), show_title); } //int cnt = 0; //try //{ // cnt=Convert.ToInt32(DbHelperSQL.GetSingle("select top 1 isnull(read_cnt,0) as cnt from hrenh_article where id="+desc+"").ToString()); //} //catch (Exception ex) //{ //} //if (desc == article_id.ToString()) //{ // cnt = cnt + 1; //} //sbr.AppendFormat("<span><b>{0}</b> 阅读</span>",cnt); sbr.AppendFormat("</li>"); } } return(sbr.ToString()); }
/// <summary> /// 获取指定数目的图片,可为0 /// </summary> /// <param name="top">具体的数目,可为0</param> /// <param name="pageid">页面ID</param> /// <param name="cid">栏目ID</param> /// <returns></returns> public static string Get_Tj_Img(int top, int pageid, int cid) { sbr.Clear(); ds = recommend_bll.GetList_NewIndex(top, " pageid=" + pageid + " and cid=" + cid + " "); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; string title = StringHelper.ReturnNumStr(dr["v1"].ToString(), 0, 0); string show_title = StringHelper.ReturnNumStr(title, 0, 18); string desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 0, 80); string imgurl = ImgHelper.GetCofigShowUrl() + dr["v3"].ToString(); string httpurl = String_Manage.Return_Str(dr["url"].ToString(), ""); //链接打开方式,1:在本页面打,2:在新页面打开 int openstyle = String_Manage.Return_Int(dr["v4"].ToString(), 0); string width_height = "height=\"300\" width=\"640\""; if (cid == 1002 || cid == 1003) { sbr.AppendFormat("<div class=\"item\"><div class=\"g-pic\">"); if (openstyle != 1 && openstyle != 2) { httpurl = " href='javascript:;' "; } else { httpurl = Return_HttpURL.Return_Url(httpurl, openstyle); } sbr.AppendFormat("<a title=\"{0}\" class=\"white\" {1}><img width=\"320\" height=\"250\" border=\"0\" alt=\"{0}\" src=\"{2}\"><em class=\"fcut\"><span>{3}</span></em></a>", title, httpurl, imgurl, show_title); sbr.AppendFormat("</div>"); sbr.AppendFormat("</div>"); } else if (pageid == 2300 && cid == 1001) { sbr.AppendFormat("<div>"); httpurl = Return_HttpURL.Return_Url(httpurl, openstyle); sbr.AppendFormat("<a title=\"{0}\" {1}><img alt=\"{0}\" src=\"{2}\"></a>", title, httpurl, imgurl); sbr.AppendFormat("</div>"); } else if (cid == 1004) { string curhref = " href='javascript:;' "; if (httpurl != "") { curhref = " href='" + httpurl + "' target='_blank' "; } string red_title = title; if (title == "羽绒服" || title == "呢子大衣" || title == "卫衣") { red_title = "<font style='font-weight:bold;'>" + title + "</font>"; } sbr.AppendFormat("<a {1} title=\"{0}\">{2}</a><span style=\"margin-left:10px;margin-right:10px;\">/</span>", title, curhref, red_title); } else if (cid == 1008) { if (openstyle != 1 && openstyle != 2) { httpurl = " href='javascript:;' "; } else { httpurl = Return_HttpURL.Return_Url(httpurl, openstyle); } sbr.AppendFormat("<a {0} title=\"{1}\"><img src=\"{2}\" alt=\"{1}\"></a>", httpurl, title, imgurl); } else if (cid == 1009) { sbr.AppendFormat("<div class=\"item\"><div class=\"g-pic\">"); if (openstyle != 1 && openstyle != 2) { httpurl = " href='javascript:;' "; } else { httpurl = Return_HttpURL.Return_Url(httpurl, openstyle); } //sbr.AppendFormat("<a title=\"{0}\" class=\"white\" href=\"{1}\"><img width=\"280\" height=\"429\" border=\"0\" alt=\"{0}\" src=\"{2}\"><em class=\"fcut\"><span>{3}</span></em></a>", title, httpurl, imgurl, show_title); sbr.AppendFormat("<a title=\"{0}\" class=\"white\" {1}><img width=\"280\" height=\"429\" border=\"0\" alt=\"{0}\" src=\"{2}\"></a>", title, httpurl, imgurl, show_title); sbr.AppendFormat("</div>"); sbr.AppendFormat("</div>"); } else if (cid == 1005)//详情页热门推荐轮播图 { show_title = StringHelper.ReturnNumStr(title, 1, 15); sbr.AppendFormat("<div class=\"item\"><div class=\"g-pic\">"); if (openstyle != 1 && openstyle != 2) { httpurl = " href='javascript:;' "; } else { httpurl = Return_HttpURL.Return_Url(httpurl, openstyle); } sbr.AppendFormat("<a {1} title=\"{0}\" class=\"white\"><img border=\"0\" alt=\"{0}\" src=\"{2}\"><em class=\"fcut\"><span>{3}</span></em></a>", title, httpurl, imgurl, show_title); sbr.AppendFormat("</div>"); sbr.AppendFormat("</div>"); } else if (cid == 1006) { show_title = StringHelper.ReturnNumStr(title, 1, 22); string cname_class = ""; if (i == 0) { cname_class = "mar10"; } sbr.AppendFormat("<dl class=\"ltjh-list {0}\">", cname_class); if (openstyle != 1 && openstyle != 2) { httpurl = " href='javascript:;' "; } else { httpurl = Return_HttpURL.Return_Url(httpurl, openstyle); } sbr.AppendFormat("<dt><a {0} title=\"{1}\"><img src=\"{2}\" alt=\"{1}\"></a></dt>", httpurl, title, imgurl); sbr.AppendFormat("<dd><a {0} title=\"{1}\">{2}</a></dd>", httpurl, title, show_title); sbr.AppendFormat("</dl>"); } else if (cid == 1007) { show_title = StringHelper.ReturnNumStr(title, 1, 13); desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 1, 13); if (openstyle != 1 && openstyle != 2) { httpurl = " href='javascript:;' "; } else { httpurl = Return_HttpURL.Return_Url(httpurl, openstyle); } sbr.AppendFormat("<div class=\"item\"><div class=\"g-pic\"><a {0} title=\"{1}\"><img width=\"300\" height=\"390\" border=\"0\" alt=\"{1}\" src=\"{2}\"></a></div>", httpurl, title, imgurl); sbr.AppendFormat("<p>"); sbr.AppendFormat("<a {0} title=\"{1}\">{2}</a>", httpurl, title, show_title); sbr.AppendFormat("<span>{0}</span>", desc); sbr.AppendFormat("</p>"); sbr.AppendFormat("<p class=\"everyday-pickC\">"); sbr.AppendFormat("</p>"); sbr.AppendFormat("<span style=\"position:absolute;left:15px;top:343px;color:#fff;font-size:20px;\"><i style=\"color:#c0292a\"></i>/<b style=\"color:#ffffff\"></b></span>"); sbr.AppendFormat("</div>"); } else if (cid == 1010) { show_title = StringHelper.ReturnNumStr(title, 1, 23); desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 1, 13); if (openstyle != 1 && openstyle != 2) { httpurl = " href='javascript:;' "; } else { httpurl = Return_HttpURL.Return_Url(httpurl, openstyle); } sbr.AppendFormat("<div class=\"item\"><div class=\"g-pic\"><a {0} title=\"{1}\"><img width=\"300\" height=\"390\" border=\"0\" alt=\"{1}\" src=\"{2}\"></a></div>", httpurl, title, imgurl); sbr.AppendFormat("<p>"); sbr.AppendFormat("<a {0} title=\"{1}\">{2}</a>", httpurl, title, show_title); //sbr.AppendFormat("<span>{0}</span>", desc); sbr.AppendFormat("</p>"); sbr.AppendFormat("<p class=\"everyday-pickC\">"); sbr.AppendFormat("</p>"); sbr.AppendFormat("<span style=\"position:absolute;left:15px;top:343px;color:#fff;font-size:20px;\"><i style=\"color:#c0292a\"></i>/<b style=\"color:#ffffff\"></b></span>"); sbr.AppendFormat("</div>"); } } } return(sbr.ToString()); }
/// <summary> /// 更新当前众筹结果 /// </summary> /// <param name="zcid">众筹ID</param> /// <param name="type">ID类型,0:众筹ID,1:支持ID</param> public static void Update_ZC_State(int zcid, int type) { string tabname = " HRENH_CROWDFUNDING_INFO a "; string coloum = " a.TOTAL_MONEY,a.ENDTIME,isnull((select SUM(MONEY) from HRENH_SUPPORT_USER_RECHARGE_RECORD where SUPPORT_ID in(select ID from HRENH_SUPPORT_TYPE_INFO where CROWD_ID=a.ID) and State=2),0) as get_money "; string where = " a.id=" + zcid + " "; if (type == 1) { where = " a.id in(select top 1 crowd_id from HRENH_SUPPORT_TYPE_INFO where id=" + zcid + ") "; } string sql = "select" + coloum + "from " + tabname + " where" + where; try { DataSet ds = DbHelperSQL.Query(sql); if (ds != null && ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { string endtime = TimeParser.ReturnCurTime(dr["endtime"].ToString(), 0); string total_money = String_Manage.Return_Str(dr["total_money"].ToString(), "0"); string get_money = String_Manage.Return_Str(dr["get_money"].ToString(), "0"); DateTime now = Convert.ToDateTime(DateTime.Now.ToShortDateString()); TimeSpan ts = Convert.ToDateTime(endtime) - now; int results = 0; int leave_days = 0; decimal tmoney = Convert.ToDecimal(total_money); decimal gmoney = Convert.ToDecimal(get_money); if (ts.Days > 0) { if (gmoney >= tmoney) { results = 2; } else { results = 1; } endtime = ts.Days.ToString(); leave_days = ts.Days; } else { if (gmoney >= tmoney) { results = 2; } else { results = 3; } } #region 更新当前众筹结果 try { if (results > 0) { DbHelperSQL.ExecuteSql("update HRENH_CROWDFUNDING_INFO set results=" + results + " where id=" + zcid); } } catch (Exception ex) { } #endregion } } } catch (Exception ex) { } }