public string GetRewardsDayRiseList(string pRequest) { var rp = pRequest.DeserializeJSONTo <APIRequest <SellUserMainAchieveRP> >(); if (string.IsNullOrEmpty(rp.Parameters.UserOrRetailID)) { throw new APIException("缺少参数【UserOrRetailID】或参数值为空") { ErrorCode = 135 }; } var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, "1"); var bll = new RetailTraderBLL(loggingSessionInfo); var rd = new MonthDayRewardsRD(); var rsp = new SuccessResponse <IAPIResponseData>(rd); //获取分销商的信息,loggingSessionInfo.ClientID // int month = DateTime.Now.Month; //int year = DateTime.Now.Year;//目前只取今年的 //int month = DateTime.Now.Month;//目前只取今年的 DateTime nowDay = Convert.ToDateTime(DateTime.Now.ToShortDateString()); // var ds = bll.GetRewardsDayRiseList(rp.Parameters.UserOrRetailID, loggingSessionInfo.ClientID, nowDay.AddDays(-14), nowDay.AddDays(1).AddSeconds(-1)); //获取今天和前面14天的数据 var VipRiseList = new List <RewardsDayRiseTrand>(); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { var tempDt = ds.Tables[0]; VipRiseList = DataTableToObject.ConvertToList <RewardsDayRiseTrand>(tempDt);//直接根据所需要的字段反序列化 } int currentDay = DateTime.Now.Day; //判断账号是否存在 rd.MonthRewardList = new List <RewardsDayRiseTrand>(); for (DateTime i = nowDay.AddDays(-14); i <= nowDay; i = i.AddDays(1)) { RewardsDayRiseTrand temp = VipRiseList.Where(p => p.formatDate == i.ToString("yyyy-MM-dd")).SingleOrDefault();//直接根据所需要的字段反序列化 if (temp == null) { temp = new RewardsDayRiseTrand(); temp.Year = i.Year; temp.Month = i.Month; temp.Day = i.Day; temp.formatDate = temp.Year + "-" + temp.Month + "-" + temp.Day; temp.DayAmount = 0; temp.DayVipAmount = 0; temp.DayTradeAmount = 0; } temp.myDate = temp.Month + "/" + temp.Day; rd.MonthRewardList.Add(temp); } return(rsp.ToJSON()); }