增加项目,分层

This commit is contained in:
chfei committed 2026-09-11 19:11:12 +08:00
1 parent 6e995a5bdb
commit 0a3e5af6a9
234 files changed
+26994 -1

No files matched your search

@@ -0,0 +1,34 @@
using Store.Product.Models.Product.Image;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Store.Product.Models.Product
{
/// <summary>
/// 主图集合
/// </summary>
public class MainImageCollection : List<ProductImage>
{
/// <summary>
/// 随机排序
/// </summary>
public void RandomSort()
{
Random random = new Random();
List<ProductImage> newList = new List<ProductImage>();
foreach (ProductImage item in this.Take(4))
{
newList.Insert(random.Next(newList.Count + 1), item);
}
if (this.Count == 5)
{
newList.Add(this.Last());
}
this.Clear();
this.AddRange(newList);
}
}
}