lcy
4 天以前 3575c016271e455cfaab964b98e3d4ef84ef75cb
Main/System/Store/StoreModel.cs
@@ -181,7 +181,36 @@
        return datas;
    }
    /// <summary>
    /// 获取在上下架时间范围内的商品列表
    /// </summary>
    public List<StoreData> GetTimeValidStoreDatas(StoreFunc type)
    {
        List<StoreData> allDatas = TryGetStoreDatas(type);
        if (allDatas == null)
            return null;
        int curOpenDay = TimeUtility.OpenDay + 1;
        List<StoreData> validDatas = new List<StoreData>();
        for (int i = 0; i < allDatas.Count; i++)
        {
            StoreConfig cfg = allDatas[i].storeConfig;
            // <=0 或 StartTime >= EndTime 视为无限制
            if (cfg.StartTime <= 0 || cfg.EndTime <= 0 || cfg.StartTime >= cfg.EndTime)
            {
                validDatas.Add(allDatas[i]);
                continue;
            }
            // 未到上架时间
            if (curOpenDay < cfg.StartTime)
                continue;
            // 已过下架时间
            if (curOpenDay >= cfg.EndTime)
                continue;
            validDatas.Add(allDatas[i]);
        }
        return validDatas;
    }
 
    public StoreData GetStoreData(int shopId)