123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- using Business.TK;
- using Common;
- using M55128_rec.Business.TK;
- using M55128_rec.Models.ViewModels.TrendChartModel;
- using Models;
- using Models.Entity.LottomatBaseDB;
- using Models.Views;
- using Services;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace M55128_rec.Business.ZS
- {
- public static class ZSapiBLL
- {
-
-
- static ZSapiBLL()
- {
-
- }
- /// <summary>
- /// 走势图名称,值为"QGC", "DFC", "GPC11X5", "GPCK3", "GPCKL12", "GPCKLSF" , "GPCQTC",注意:高频彩请传(GPC),高频彩下面的分类请传对应代码
- /// </summary>
- /// <param name="lotteryType"> //如果传入为 GPC 的话,就默认返回高频彩11选5相关数据</param>
- public static List<TrendChart_Preview> GetTrendChartNewsList(string lotteryType)
- {
- if (lotteryType== "GPC")
- {
- lotteryType = "GPC11X5";
- }
- List<TrendChart_Preview> res = new List<TrendChart_Preview>();
- try
- {
- //如果传入为 GPC 的话,就默认返回高频彩11选5相关数据
- List<DataItemModel> data = DataItemBLL.GetDataItemListbyEnCode(lotteryType);
- //dataItemCache.GetDataItemList(arg.Category.Equals("GPC") ? "GPC11X5" : arg.Category).OrderBy(n => n.SortCode).ToList();
- string[] ids = data.Select(d => d.ItemDetailId).ToArray();
- List<EExpression> listexp = new List<EExpression>();
- listexp.Add(new EExpression("IsDelete", "=", 0));
- listexp.Add(new EExpression("IsStick", "=", 1));
- listexp.Add(new EExpression("CategoryId", EnumExpression.In, ids.ToList()));
- //获取该分类下符合要求的数据
- List<Base_TrendChart> trendChartEntities = TrendChartBLL.GetList("SortCode", listexp);
- //TrendChartBll.GetPageList(n => n.IsDelete == false && n.IsStick == true && ids.Contains(n.CategoryId)).OrderBy(n => n.SortCode).ToList();
- if (trendChartEntities.Count > 0)
- {
- //组装父级相关属性
- TrendChart_Preview previewItem = new TrendChart_Preview
- {
- TrendChartType = lotteryType,
- ItemName = DataItemBLL.GetBaseDataItemListbyEnCode(lotteryType).ItemName
- };
- //根据分类ID进行分组
- List<string> idlist = trendChartEntities.Select(w => w.CategoryId).ToList();
- IEnumerable<IGrouping<string, Base_TrendChart>> group = trendChartEntities.GroupBy(t => t.CategoryId);
- List<Base_DataItemDetail> dataItemlist = DataItemBLL.GetListbyItemId(idlist);
- List<TempTrendChartPreviewItem> temp = new List<TempTrendChartPreviewItem>();
- foreach (IGrouping<string, Base_TrendChart> chartEntities in group)
- {
- //分类ID
- string key = chartEntities.Key;
- //获取分类信息
- var dataItemEntity = dataItemlist.SingleOrDefault(w => w.ItemDetailId == key);
- List<TrendChartPreviewItem> trendChartPreviewItems = new List<TrendChartPreviewItem>();
- //组装项目相关属性
- TempTrendChartPreviewItem item = new TempTrendChartPreviewItem
- {
- TrendChartChildType = dataItemEntity.ItemValue,
- TrendChartChildName = dataItemEntity.ItemName
- };
- //组装具体信息
- foreach (Base_TrendChart entity in chartEntities)
- {
- TrendChartPreviewItem p = new TrendChartPreviewItem
- {
- Title = entity.Title,
- TrendChartUrl = entity.TrendChartUrl,
- TrendChartUrlId=entity.PK.ToString()
- };
- trendChartPreviewItems.Add(p);
- }
- item.TrendChartPreviewItem = trendChartPreviewItems;
- temp.Add(item);
- }
- previewItem.TrendChartPreviewItems = temp;
- res.Add(previewItem);
- }
- }
- catch (Exception ee)
- {
- LogHelper.Error(typeof(ZSapiBLL), ee.Message + "GetTrendChartNewsList");
- }
- return res;
- }
-
- }
- }
|