Exemple #1
0
        public string GetAchievements(string pRequest)//	获取本月新增会员数量、累计会员数量、本月交易量接口(取该会员的订单数)
        {
            var rp = pRequest.DeserializeJSONTo <APIRequest <SellUserMainAchieveRP> >();

            if (string.IsNullOrEmpty(rp.UserID))
            {
                throw new APIException("缺少参数【UserID】或参数值为空")
                      {
                          ErrorCode = 135
                      };
            }

            var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, "1");
            var bll = new RetailTraderBLL(loggingSessionInfo);
            var rd  = new GetAchievementsRD();
            var rsp = new SuccessResponse <IAPIResponseData>(rd);
            //本月新增会员数量
            int year  = DateTime.Now.Year;
            int month = DateTime.Now.Month;
            var ds    = bll.GetMonthVipList(rp.UserID, loggingSessionInfo.ClientID, month, year); //获取

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                var tempDt = ds.Tables[0];
                rd.MonthVipCount = tempDt.Rows.Count;//直接根据所需要的字段反序列化
            }
            //累计会员数量
            var ds2 = bll.GetMonthVipList(rp.UserID, loggingSessionInfo.ClientID, -1, -1);   //获取

            if (ds2 != null && ds2.Tables.Count > 0 && ds2.Tables[0].Rows.Count > 0)
            {
                var tempDt = ds2.Tables[0];
                rd.TotalVipCount = tempDt.Rows.Count;//直接根据所需要的字段反序列化
            }
            //本月交易量
            int MonthTradeCount = bll.GetMonthTradeCount(rp.UserID, loggingSessionInfo.ClientID, month, year);   //获取

            rd.MonthTradeCount = MonthTradeCount;

            return(rsp.ToJSON());
        }