//本月奖励金额、发展会员奖励(17)、会员消费奖励接口(消费奖励分为14会员首次消费奖励和15关注三个月内奖励) public string GetRewards(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 GetRewardsRD(); var rsp = new SuccessResponse <IAPIResponseData>(rd); //本月新增会员数量 int year = DateTime.Now.Year; int month = DateTime.Now.Month; int day = DateTime.Now.Day; var UserOrRetailID = rp.Parameters.UserOrRetailID; ////本月首次关注奖励 //decimal attenAmount = bll.RetailRewardByAmountSource(UserOrRetailID, loggingSessionInfo.ClientID, month, year, "17"); //获取 ////本月首次消费奖励 //decimal firstTradeAmount = bll.RetailRewardByAmountSource(UserOrRetailID, loggingSessionInfo.ClientID, month, year, "14"); //获取 = MonthTradeCount; ////本月三月内消费奖励 //decimal threeMonthAmount = bll.RetailRewardByAmountSource(UserOrRetailID, loggingSessionInfo.ClientID, month, year, "15"); //获取 = MonthTradeCount; //今日奖励 decimal DayRewards = bll.RetailRewardByAmountSource(UserOrRetailID, loggingSessionInfo.ClientID, year, month, day, "17") + bll.RetailRewardByAmountSource(UserOrRetailID, loggingSessionInfo.ClientID, year, month, day, "14") + bll.RetailRewardByAmountSource(UserOrRetailID, loggingSessionInfo.ClientID, year, month, day, "15"); //获取 //本月奖励 decimal MonthRewards = bll.RetailRewardByAmountSource(UserOrRetailID, loggingSessionInfo.ClientID, year, month, -1, "17") + bll.RetailRewardByAmountSource(UserOrRetailID, loggingSessionInfo.ClientID, year, month, -1, "14") + bll.RetailRewardByAmountSource(UserOrRetailID, loggingSessionInfo.ClientID, year, month, -1, "15"); //获取 //累积奖励 decimal TotalRewards = bll.RetailRewardByAmountSource(UserOrRetailID, loggingSessionInfo.ClientID, -1, -1, -1, "17") + bll.RetailRewardByAmountSource(UserOrRetailID, loggingSessionInfo.ClientID, -1, -1, -1, "14") + bll.RetailRewardByAmountSource(UserOrRetailID, loggingSessionInfo.ClientID, -1, -1, -1, "15"); //获取 rd.DayRewards = DayRewards; rd.MonthRewards = MonthRewards; rd.TotalRewards = TotalRewards; return(rsp.ToJSON()); }
public string RetailTraderMain(string pRequest) { var rp = pRequest.DeserializeJSONTo <APIRequest <GetRetailVipInfosRP> >(); if (string.IsNullOrEmpty(rp.Parameters.RetailTraderID)) { throw new APIException("缺少参数【RetailTraderID】或参数值为空") { ErrorCode = 135 }; } var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, "1"); var bll = new RetailTraderBLL(loggingSessionInfo); var rd = new RetailTraderMainRD(); var rsp = new SuccessResponse <IAPIResponseData>(rd); var CouponTypeBll = new CouponTypeBLL(loggingSessionInfo); // BringVipCount//我为兰博士带多少会员 // RewardAmount//奖励多少钱 //累计会员数量 var ds3 = bll.GetRetailVipInfos(rp.Parameters.RetailTraderID, loggingSessionInfo.ClientID, -1, -1, -1); //获取 if (ds3 != null && ds3.Tables.Count > 0 && ds3.Tables[0].Rows.Count > 0) { var tempDt = ds3.Tables[0]; rd.BringVipCount = tempDt.Rows.Count; } //累积奖励 decimal TotalRewards = bll.RetailRewardByAmountSource(rp.Parameters.RetailTraderID, loggingSessionInfo.ClientID, -1, -1, -1, "17") + bll.RetailRewardByAmountSource(rp.Parameters.RetailTraderID, loggingSessionInfo.ClientID, -1, -1, -1, "14") + bll.RetailRewardByAmountSource(rp.Parameters.RetailTraderID, loggingSessionInfo.ClientID, -1, -1, -1, "15"); //获取 rd.RewardAmount = TotalRewards; int?pageIndex = 1; int?pageSize = 10000; //未核销优惠券列表 int NoWriteOffCouponCount = 0; var ds4 = bll.GetRetailCoupon(rp.Parameters.RetailTraderID, loggingSessionInfo.ClientID, 0, pageIndex ?? 1, pageSize ?? 15, rp.Parameters.OrderBy, rp.Parameters.OrderType); //获取 if (ds4 != null && ds4.Tables.Count > 0 && ds4.Tables[0].Rows.Count > 0) { //var tempDt = ds4.Tables[0]; NoWriteOffCouponCount = Convert.ToInt32(ds4.Tables[0].Rows[0]["TotalCount"].ToString());//tempDt.Rows.Count; // rd.WriteOffCouponList = DataTableToObject.ConvertToList<RetailCouponInfo>(ds4.Tables[1]); } var ds5 = bll.GetRetailCoupon(rp.Parameters.RetailTraderID, loggingSessionInfo.ClientID, 1, pageIndex ?? 1, pageSize ?? 15, rp.Parameters.OrderBy, rp.Parameters.OrderType); //获取 if (ds5 != null && ds5.Tables.Count > 0 && ds5.Tables[0].Rows.Count > 0) { //var tempDt = ds5.Tables[0]; rd.UsedCoupon = Convert.ToInt32(ds5.Tables[0].Rows[0]["TotalCount"].ToString()); // rd.WriteOffCouponList = DataTableToObject.ConvertToList<RetailCouponInfo>(ds3.Tables[1]); } // rd.AllCouponCouponCount = rd.WriteOffCouponCount + rd.NoWriteOffCouponCount; rd.SendCouponCount = rd.UsedCoupon + NoWriteOffCouponCount;// 兰博士为我发券数量 #region 获取适用所有门店的券 var CouponTypeList = CouponTypeBll.QueryByEntity(new CouponTypeEntity() { SuitableForStore = 3, CustomerId = loggingSessionInfo.ClientID }, null).ToList(); if (CouponTypeList.Count > 0) { foreach (var item in CouponTypeList) { int Count = CouponTypeBll.GetCouponCount(item.CouponTypeID.ToString()); rd.SendCouponCount += Count; } } #endregion return(rsp.ToJSON()); }