修复cookies删除不成功;修复后台批量操作因更新boottable后无法获取选中id

This commit is contained in:
2020-10-23 14:46:40 +08:00
parent ab40520cda
commit 3b50120a5c
10 changed files with 60 additions and 16 deletions
+30
View File
@@ -228,6 +228,36 @@ namespace COMCMS.Core
else
return null;
}
/// <summary>
/// 获取前几条文章
/// </summary>
/// <param name="kid">栏目id</param>
/// <param name="records">条数</param>
/// <returns></returns>
public static IList<Article> FindTopList(int kid, int records, bool isShowSub = false)
{
if (!isShowSub)
return FindAll(_.KId == kid & _.IsHide == 0, _.Id.Desc(), null, 0, records);
else
{
Expression ex = _.IsHide == 0;
List<int> kids = new List<int>();
kids.Add(kid);
IList<ArticleCategory> subkinds = ArticleCategory.FindByParentID(kid);
if (subkinds != null && subkinds.Count > 0)
{
foreach (var item in subkinds)
{
kids.Add(item.Id);
}
}
ex &= Article._.KId.In(kids);
return FindAll(ex, _.Id.Desc(), null, 0, records);
}
}
#endregion
}
}
+2 -1
View File
@@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Xml.Serialization;
using COMCMS.Common;
using NewLife;
using NewLife.Data;
using NewLife.Log;
@@ -359,7 +360,7 @@ namespace COMCMS.Core
}
else
{
re += " &gt; " + string.Format(tpl, "/article/index/" + model.Id, model.KindName);
re += " &gt; " + string.Format(tpl, ViewsHelper.EchoURL(Utils.CMSType.ArticleCategory, kid), model.KindName);
if (model.PId != 0)
{
re = GetNav(model.PId) + re;
+153
View File
@@ -0,0 +1,153 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using COMCMS.Core;
using COMCMS.Common;
using XCode;
namespace COMCMS.Core
{
/// <summary>
/// 识图方法
/// </summary>
public class ViewsHelper
{
#region 获取分类链接
/// <summary>
/// 文章分类
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public static string EchoURL(ArticleCategory model)
{
if (model == null)
return "javascript:;";
if (!string.IsNullOrEmpty(model.FilePath))
return model.FilePath + "/index.html";
else
return $"/article/index/{model.Id}";
}
/// <summary>
/// 商品分类
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public static string EchoURL(Category model)
{
if (model == null)
return "javascript:;";
if (!string.IsNullOrEmpty(model.FilePath))
return model.FilePath + "/index.html";
else
return $"/product/index/{model.Id}";
}
/// <summary>
/// 生成文章详情地址
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public static string EchoURL(Article model)
{
if (model == null)
return "javascript:;";
ArticleCategory categoty = ArticleCategory.FindById(model.KId);
if (categoty != null && !string.IsNullOrEmpty(categoty.FilePath))
{
string url = $"{categoty.FilePath}/{model.Id}.html";
if (!string.IsNullOrEmpty(model.FileName))
{
url = $"{categoty.FilePath}/{model.FileName}";
}
return url;
}
else
return $"/article/detail/{model.Id}";
}
/// <summary>
/// 商品
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public static string EchoURL(Product model)
{
return $"/product/detail/{model.Id}";
}
/// <summary>
///
/// </summary>
/// <param name="ctype"></param>
/// <param name="id"></param>
/// <returns></returns>
public static string EchoURL(Utils.CMSType ctype, int id)
{
string url = "/";
switch (ctype)
{
case Utils.CMSType.ArticleCategory:
ArticleCategory ac = ArticleCategory.FindById(id);
url = EchoURL(ac);
break;
case Utils.CMSType.ProductCategory:
Category pc = Category.FindById(id);
url = EchoURL(pc);
break;
case Utils.CMSType.Article:
Article a = Article.FindById(id);
url = EchoURL(a);
break;
case Utils.CMSType.Product:
Product p = Product.FindById(id);
url = EchoURL(p);
break;
default:
url = "/";
break;
}
return url;
}
#endregion
#region 生成详情地址
/// <summary>
/// 生成文章详情地址
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public static string EchoArticleURL(Article model)
{
if (model == null)
return "javascript:;";
if (!string.IsNullOrEmpty(model.ArticleKind.FilePath))
{
string url = $"{model.ArticleKind.FilePath}/{model.Id}.html";
if (!string.IsNullOrEmpty(model.FileName))
{
url = $"{model.ArticleKind.FilePath}/{model.FileName}";
}
return url;
}
else
return $"/article/detail/{model.Id}";
}
/// <summary>
/// 生成文章详情地址
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public static string EchoArticleURL(int id)
{
Article model = Article.FindById(id);
return EchoArticleURL(model);
}
#endregion
}
}