完善推荐页显示

This commit is contained in:
橙子
2022-10-16 22:51:53 +08:00
parent 6d99539730
commit 50d43a2fc5
8 changed files with 33 additions and 26 deletions

View File

@@ -11,14 +11,14 @@ namespace Yi.Framework.Common.Helper
{
public static List<T> SetTree<T>(List<T> list, Action<T> action = null)
{
if (list != null && list.Count > 0)
if (list is not null && list.Count > 0)
{
IList<T> result = new List<T>();
long pid = list.Min(m => (m as ITreeModel<T>).ParentId);
IList<T> t = list.Where(m => (m as ITreeModel<T>).ParentId == pid).ToList();
foreach (T model in t)
{
if (action != null)
if (action is not null)
{
action(model);
}
@@ -40,7 +40,7 @@ namespace Yi.Framework.Common.Helper
mm.Children = new List<T>();
foreach (T item in children)
{
if (action != null)
if (action is not null)
{
action(item);
}