Пример #1
0
        public HttpResponseMessage GetTrendChartSRC(TrendChartParams param)
        {
            BaseJson <TrendChartModel> resultMsg = new BaseJson <TrendChartModel> {
                Status = (int)JsonObjectStatus.Error, Message = "服务器未知错误。", Data = null
            };

            Logger(typeof(GallerMangerApiController), param.TryToJson(), "GetTkPeriodsNumberList - 图库期数列表", () =>
            {
                if (string.IsNullOrEmpty(param.LotteryType))
                {
                    resultMsg = new BaseJson <TrendChartModel>
                    {
                        Status  = (int)JsonObjectStatus.Exception,
                        Data    = null,
                        Message = JsonObjectStatus.Exception.GetEnumText() + ",参数有误请确认:",
                        BackUrl = null
                    };
                }
                TrendChartBLL trendChartBLL  = new TrendChartBLL();
                DataItemModel itemdata       = itemCache.GetItemDetailByItemValue(param.LotteryType);//.GetEntityByCode(param.CategoryId);
                List <TrendChartEntity> list = trendChartBLL.GetPageList(s => s.CategoryId == itemdata.ItemDetailId && s.Title.Contains("基本走势图")).ToList();
                TrendChartModel data         = new TrendChartModel();
                if (list.Count == 0)//继续采用走势图匹配
                {
                    list = trendChartBLL.GetPageList(s => s.CategoryId == itemdata.ItemDetailId && s.Title == "走势图").ToList();
                }
                if (list.Count == 0)//继续采用走势图带连线 匹配
                {
                    list = trendChartBLL.GetPageList(s => s.CategoryId == itemdata.ItemDetailId && s.Title == "走势图带连线").ToList();
                }
                if (list.Count == 0)//还是就返回失败
                {
                    resultMsg = new BaseJson <TrendChartModel>
                    {
                        Status  = (int)JsonObjectStatus.Fail,
                        Data    = null,
                        Message = JsonObjectStatus.Exception.GetEnumText() + ",查询不到结果:",
                        BackUrl = null
                    };
                }
                else
                {
                    data = new TrendChartModel()
                    {
                        Name = list[0].Title,
                        Url  = list[0].TrendChartUrl
                    };
                }

                resultMsg = new BaseJson <TrendChartModel>()
                {
                    Status  = (int)JsonObjectStatus.Success,
                    Data    = data,
                    Message = JsonObjectStatus.Success.GetEnumText(),
                    BackUrl = null
                };
            }, e =>
            {
                resultMsg = new BaseJson <TrendChartModel>
                {
                    Status  = (int)JsonObjectStatus.Exception,
                    Data    = null,
                    Message = JsonObjectStatus.Exception.GetEnumText() + ",异常信息:" + e.Message,
                    BackUrl = null
                };
            });
            return(resultMsg.TryToJson().ToHttpResponseMessage());
        }