コード例 #1
0
ファイル: Info.ashx.cs プロジェクト: uvbs/mmp
        /// <summary>
        /// 获取当前用户信息
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string currentuserinfo(HttpContext context)
        {
            try
            {
                currentUserInfo = bllUser.GetUserInfo(bllUser.GetCurrUserID(), bllUser.WebsiteOwner);
                var websiteInfo = bllUser.GetWebsiteInfoModelFromDataBase();
                Open.HongWareSDK.Client hongWareClient = new Open.HongWareSDK.Client(websiteInfo.WebsiteOwner);
                //double totalScore =CurrentUserInfo.TotalScore;
                #region 使用yike积分
                if (bllCommRelation.ExistRelation(BLLJIMP.Enums.CommRelationType.SyncYike, bllCommRelation.WebsiteOwner, ""))
                {
                    if ((!string.IsNullOrEmpty(currentUserInfo.Ex2)) && (!string.IsNullOrEmpty(currentUserInfo.Phone)))
                    {
                        Open.EZRproSDK.Entity.BonusGetResp yikeUser = yiKeClient.GetBonus(currentUserInfo.Ex1, currentUserInfo.Ex2, currentUserInfo.Phone);
                        if (yikeUser != null)
                        {
                            currentUserInfo.TotalScore = yikeUser.Bonus;
                        }
                        else
                        {
                            currentUserInfo.TotalScore = 0;
                        }
                    }
                }
                #endregion

                #region 使用宏巍积分余额
                if (websiteInfo.IsUnionHongware == 1)
                {
                    var hongWareMemberInfo = hongWareClient.GetMemberInfo(currentUserInfo.WXOpenId);
                    if (hongWareMemberInfo.member != null)
                    {
                        currentUserInfo.TotalScore    = Convert.ToInt32(hongWareMemberInfo.member.point);
                        currentUserInfo.AccountAmount = (decimal)hongWareMemberInfo.member.balance;
                    }
                    else
                    {
                        currentUserInfo.TotalScore    = 0;
                        currentUserInfo.AccountAmount = 0;
                    }
                }
                #endregion


                //var carOwnerInfo = bllUserEx.GetCurrUserCarOwnerInfo();
                //var bankcard = bllUser.Get<BindBankCard>(string.Format("UserId='{0}'", currentUserInfo.UserID));

                var hasidentitycardphoto = !string.IsNullOrWhiteSpace(currentUserInfo.IdentityCardPhotoFront + currentUserInfo.IdentityCardPhotoBehind + currentUserInfo.IdentityCardPhotoHandheld);
                var hasbusinessintelligencecertificatephoto = !string.IsNullOrWhiteSpace(currentUserInfo.BusinessIntelligenceCertificatePhoto1 + currentUserInfo.BusinessIntelligenceCertificatePhoto2
                                                                                         + currentUserInfo.BusinessIntelligenceCertificatePhoto3 + currentUserInfo.BusinessIntelligenceCertificatePhoto4 + currentUserInfo.BusinessIntelligenceCertificatePhoto5);
                var hasinvoicinginformation = bllUserEx.ExistUserExpand(UserExpandType.InvoicingInformation, currentUserInfo.UserID);

                var data = new
                {
                    id                 = currentUserInfo.AutoID,
                    userid             = currentUserInfo.UserID,
                    head_img_url       = bllUser.GetUserDispalyAvatar(currentUserInfo), //GetHeadImgUrl(context,CurrentUserInfo),
                    nickname           = bllUser.GetUserDispalyName(currentUserInfo),   //CurrentUserInfo.WXNickname,
                    wx_nickname        = currentUserInfo.WXNickname,
                    phone              = currentUserInfo.Phone,
                    username           = currentUserInfo.UserID,
                    unionid            = currentUserInfo.WXUnionID,
                    totalscore         = currentUserInfo.TotalScore,
                    history_totalscore = currentUserInfo.HistoryTotalScore,
                    company_name       = currentUserInfo.Company,
                    position           = currentUserInfo.Postion,
                    email              = currentUserInfo.Email,
                    truename           = currentUserInfo.TrueName,
                    ex1                = currentUserInfo.Ex1,
                    ex2                = currentUserInfo.Ex2,
                    ex3                = currentUserInfo.Ex3,
                    ex4                = currentUserInfo.Ex4,
                    ex5                = currentUserInfo.Ex5,
                    wxOpenId           = currentUserInfo.WXOpenId,
                    //carServerType = CurrentUserInfo.CarServerType,
                    //carOwnerInfo = carOwnerInfo == null ? null : new
                    //{

                    //    carModel = carOwnerInfo.CarModel == null ? null : new
                    //    {
                    //        carModelId = carOwnerInfo.CarModel.CarModelId,
                    //        carBrandId = carOwnerInfo.CarModel.CarBrandId,
                    //        carBrandName = bllCar.GetBrand(carOwnerInfo.CarModel.CarBrandId).CarBrandName,
                    //        carSeriesCateId = carOwnerInfo.CarModel.CarSeriesCateId,
                    //        carSeriesId = carOwnerInfo.CarModel.CarSeriesId,
                    //        carSeriesName = bllCar.GetSeriesInfo(carOwnerInfo.CarModel.CarSeriesId).CarSeriesName,
                    //        carModelName = carOwnerInfo.CarModel.CarModelName,
                    //        showName = carOwnerInfo.CarModel.ShowName,
                    //        allName = carOwnerInfo.CarModel.AllName,
                    //        year = carOwnerInfo.CarModel.Year,
                    //        img = carOwnerInfo.CarModel.Img,
                    //        guidePrice = carOwnerInfo.CarModel.GuidePrice,
                    //        colors = string.IsNullOrWhiteSpace(carOwnerInfo.CarModel.Colors) ? null : JsonConvert.DeserializeObject<List<BLLJIMP.Model.CarModelColorInfo>>(carOwnerInfo.CarModel.Colors).Select(c => new { name = c.Name, value = c.Value })
                    //    },
                    //    carNumber = carOwnerInfo.CarNumber,
                    //    carNumberTime = carOwnerInfo.CarNumberTime == null ? "" : carOwnerInfo.CarNumberTime.Value.ToString("yyyy-MM-dd HH:mm"),
                    //    drivingLicenseTime = carOwnerInfo.DrivingLicenseTime == null ? "" : carOwnerInfo.DrivingLicenseTime.Value.ToString("yyyy-MM-dd HH:mm"),
                    //    drivingLicenseType = carOwnerInfo.DrivingLicenseType,
                    //    vin = carOwnerInfo.VIN
                    //},
                    address        = currentUserInfo.Address,
                    imgs           = currentUserInfo.Images,
                    province       = currentUserInfo.Province,
                    province_code  = currentUserInfo.ProvinceCode,
                    city           = currentUserInfo.City,
                    city_code      = currentUserInfo.CityCode,
                    district       = currentUserInfo.District,
                    district_code  = currentUserInfo.DistrictCode,
                    identification = currentUserInfo.Ex5,
                    salary         = currentUserInfo.Salary,
                    birthday       = DateTimeHelper.DateTimeToUnixTimestamp(currentUserInfo.Birthday),
                    birthday_str   = DateTimeHelper.DateTimeToString(currentUserInfo.Birthday),
                    gender         = currentUserInfo.Gender,
                    sex            = currentUserInfo.WXSex.HasValue ? currentUserInfo.WXSex.Value : 0,
                    member_level   = currentUserInfo.MemberLevel,
                    hasqrcode      = bllUser.IsDistributionMember(currentUserInfo),
                    describe       = currentUserInfo.Description,
                    avatar         = currentUserInfo.Avatar,
                    credit_acount  = currentUserInfo.CreditAcount,
                    //hasbankcard = bankcard == null ? false : true,
                    hasidentitycardphoto                     = hasidentitycardphoto,
                    identity_card_photo_front                = currentUserInfo.IdentityCardPhotoFront,
                    identity_card_photo_behind               = currentUserInfo.IdentityCardPhotoBehind,
                    identity_card_photo_handheld             = currentUserInfo.IdentityCardPhotoHandheld,
                    hasbusinessintelligencecertificatephoto  = hasbusinessintelligencecertificatephoto,
                    intelligence_certificate_business        = currentUserInfo.IntelligenceCertificateBusiness,
                    business_intelligence_certificate_photo1 = currentUserInfo.BusinessIntelligenceCertificatePhoto1,
                    business_intelligence_certificate_photo2 = currentUserInfo.BusinessIntelligenceCertificatePhoto2,
                    business_intelligence_certificate_photo3 = currentUserInfo.BusinessIntelligenceCertificatePhoto3,
                    business_intelligence_certificate_photo4 = currentUserInfo.BusinessIntelligenceCertificatePhoto4,
                    business_intelligence_certificate_photo5 = currentUserInfo.BusinessIntelligenceCertificatePhoto5,
                    hasinvoicinginformation                  = hasinvoicinginformation,
                    websiteowner       = bllUser.WebsiteOwner,
                    account_amount     = currentUserInfo.AccountAmount,                        //账户余额
                    is_bind_hongware   = bllUser.IsBindHongWare(currentUserInfo, websiteInfo), //是否已经绑定宏巍
                    memberattribution  = currentUserInfo.MemberAttribution,
                    distribution_owner = currentUserInfo.DistributionOwner
                                         //is_attention_weixin = bllWeiXin.IsWeixinFollower(bllWeiXin.GetAccessToken(), CurrentUserInfo.WXOpenId)
                };
                return(ZentCloud.Common.JSONHelper.ObjectToJson(data));
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
        }
コード例 #2
0
ファイル: AWARDAPI.ashx.cs プロジェクト: uvbs/mmp
        /// <summary>
        /// 抽奖
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string Scratch(HttpContext context)
        {
            try
            {
                if (!bll.IsLogin)
                {
                    return("请先登录");
                }
                string id = context.Request["id"];
                if (string.IsNullOrEmpty(id))
                {
                    return("id必传");
                }

                /*
                 * 检查是否是签到抽奖,是则:
                 * 1.当前是否是在周日,不在周日则不能抽奖
                 * 2.如果在周日,检查是否一周内有签到记录,否则不能抽奖
                 *
                 */

                var signInModel = new BLLJIMP.BLLSignIn().Get <SignInAddress>(string.Format(" WebsiteOwner='{0}' AND Type='Sign' ", currentUserInfo.WebsiteOwner));
                if (signInModel != null && signInModel.LotteryId == id)
                {
                    var dt = DateTime.Now;

                    if (dt.DayOfWeek != DayOfWeek.Sunday)
                    {
                        return("周日才可以抽奖");
                    }

                    //获取本周签到记录,倒退七天是否有七条
                    var signInCount = bll.GetCount <SignInLog>(string.Format("  cast(SignInDate as date) between '{0}' and '{1}' and  WebsiteOwner = '{2}' and UserID = '{3}' ",
                                                                             dt.AddDays(-6).ToString("yyyy-MM-dd"),
                                                                             dt.ToString("yyyy-MM-dd"),
                                                                             currentUserInfo.WebsiteOwner,
                                                                             currentUserInfo.UserID
                                                                             ));

                    if (signInCount < 7)
                    {
                        return("一周连续签到才可以抽奖");
                    }
                }

                #region 检查是否可以继续
                ScratchJsonModel apiResult = new ScratchJsonModel();
                apiResult.awardName = "谢谢参与";
                WXLotteryV1 model = bll.Get <WXLotteryV1>(string.Format("LotteryID={0}", id));
                if (model == null)
                {
                    goto outoff;
                }
                apiResult.awardId = model.LotteryID;
                apiResult.isStart = model.Status == 1 ? true : false;
                if (model.StartTime != null)
                {
                    apiResult.startTime = model.StartTime.Value.ToString("yyyy/MM/dd HH:mm:ss");
                    if (model.StartTime <= DateTime.Now)//已经到了开奖时间了
                    {
                        if (model.Status == 1)
                        {
                            apiResult.isStart = true;
                        }
                        else
                        {
                            apiResult.errorCode = (int)BLLJIMP.Enums.APIErrCode.NotStart;
                            apiResult.awardName = "刮奖未开启";
                            apiResult.isStart   = false;
                        }
                    }
                    else//开奖时间还没到
                    {
                        apiResult.errorCode = (int)BLLJIMP.Enums.APIErrCode.NotStart;
                        apiResult.awardName = "未到刮奖时间";
                        apiResult.isStart   = false;
                        goto outoff;
                    }
                }

                //检查结束时间
                if (model.EndTime != null)
                {
                    apiResult.startTime = model.EndTime.Value.ToString("yyyy/MM/dd HH:mm:ss");
                    if (model.EndTime.Value <= DateTime.Now)
                    {
                        apiResult.errorCode = (int)BLLJIMP.Enums.APIErrCode.IsEnd;
                        apiResult.awardName = "已结束";
                        apiResult.isStart   = false;
                        goto outoff;
                    }
                }

                if (context.Request["hideAward"] != "1")
                {
                    apiResult.winRecord = bll.GetWXLotteryRecordList(model.LotteryID, currentUserInfo.UserID);
                }
                if (model.WinLimitType.Equals(0))
                {
                    var lotteryRecord = bll.GetWXLotteryRecordV1(currentUserInfo.UserID, model.LotteryID);
                    if (lotteryRecord != null)
                    {
                        if (context.Request["hideAward"] != "1")
                        {
                            WXLotteryLogV1 logWinLimit = new WXLotteryLogV1();
                            logWinLimit.LotteryId  = model.LotteryID;
                            logWinLimit.UserId     = currentUserInfo.UserID;
                            logWinLimit.InsertDate = DateTime.Now;
                            logWinLimit.IP         = Common.MySpider.GetClientIP();
                            if (bll.AddWXLotteryLogV1(logWinLimit))//下一步
                            {
                            }

                            apiResult.awardName = string.Format("{0}", lotteryRecord.WXAwardName);
                            apiResult.isAward   = true;

                            //告诉前端你已经中过奖了
                            apiResult.errorCode = (int)BLLJIMP.Enums.APIErrCode.LotteryHaveRecord;; //LotteryHaveRecord
                        }
                        goto outoff;
                    }
                }

                if (!apiResult.isStart)
                {
                    apiResult.errorCode = (int)BLLJIMP.Enums.APIErrCode.NotStart;
                    apiResult.awardName = "刮奖未开启";
                    apiResult.isStart   = false;
                    goto outoff;
                }
                #endregion

                #region 内定中奖
                List <WXLotteryWinningDataV1> winData = bll.GetList <WXLotteryWinningDataV1>(string.Format("LotteryId={0}", model.LotteryID));
                if (winData.SingleOrDefault(p => p.UserId.Equals(currentUserInfo.UserID)) != null)
                {
                    //给默认中奖者中奖
                    WXLotteryRecordV1 record = new WXLotteryRecordV1();
                    record.InsertDate = DateTime.Now;
                    record.LotteryId  = model.LotteryID;
                    record.Token      = "0";
                    record.WXAwardsId = winData.Single(p => p.UserId.Equals(currentUserInfo.UserID)).WXAwardsId;
                    record.UserId     = currentUserInfo.UserID;
                    record.IsGetPrize = 0;
                    if (bll.AddWXLotteryRecordV1(record))
                    {
                        apiResult.awardName = string.Format("{0}", winData.Single(p => p.UserId.Equals(currentUserInfo.UserID)).WXAwardName);
                        apiResult.isAward   = true;
                    }

                    goto outoff;
                }
                //设置默认中奖
                #endregion

                #region 外部积分读取
                var isSyncYike = new BLLJIMP.BLLCommRelation().ExistRelation(BLLJIMP.Enums.CommRelationType.SyncYike, currentUserInfo.WebsiteOwner, "");

                Open.EZRproSDK.Client zrClient = new Open.EZRproSDK.Client();

                if (isSyncYike)
                {
                    var getBonusResp = zrClient.GetBonus(currentUserInfo.Ex1, currentUserInfo.Ex2, currentUserInfo.Phone);
                    if (getBonusResp != null)
                    {
                        currentUserInfo.TotalScore = getBonusResp.Bonus;
                    }
                    else
                    {
                        currentUserInfo.TotalScore = 0;
                    }
                }
                #endregion


                #region 使用宏巍积分

                Open.HongWareSDK.Client hongWareClient = new Open.HongWareSDK.Client(websiteInfo.WebsiteOwner);
                if (websiteInfo.IsUnionHongware == 1)
                {
                    var hongWareMemberInfo = hongWareClient.GetMemberInfo(currentUserInfo.WXOpenId);
                    if (hongWareMemberInfo.member != null)
                    {
                        currentUserInfo.TotalScore = hongWareMemberInfo.member.point;
                    }
                    else
                    {
                        currentUserInfo.TotalScore = 0;
                    }
                }
                #endregion

                string tempMsg = "";
                #region 抽奖限制 总共多少次或每天几次  用购买的刮奖次数除外

                #region 总共多少次
                if (model.LuckLimitType.Equals(0))//总共多少次
                {
                    int count = bll.GetWXLotteryLogCountV1(model.LotteryID, currentUserInfo.UserID);
                    if (count >= model.MaxCount)
                    {
                        //判读是否够积分
                        if (model.UsePoints > 0)
                        {
                            if (currentUserInfo.TotalScore >= model.UsePoints)
                            {
                                //扣积分
                                if (isSyncYike)
                                {
                                    var resp = zrClient.BonusUpdate(currentUserInfo.Ex2, -model.UsePoints, "抽奖减少积分");
                                }
                                else
                                {
                                    bllUser.AddUserScoreDetail(currentUserInfo.UserID, EnumStringHelper.ToString(ScoreDefineType.Lottery), bllUser.WebsiteOwner, out tempMsg, -model.UsePoints, "抽奖减少积分", "", false);
                                }
                            }
                            else
                            {
                                if (currentUserInfo.LotteryCount == 0)
                                {
                                    apiResult.errorCode = (int)BLLJIMP.Enums.APIErrCode.IntegralProblem;
                                    apiResult.awardName = "积分不足";
                                    apiResult.isStart   = false;
                                    goto outoff;
                                }
                                else
                                {
                                    //剩余刮奖次数减1
                                    if (bll.Update(currentUserInfo, string.Format(" LotteryCount-=1"), string.Format("AutoId={0}", currentUserInfo.AutoID)) <= 0)
                                    {
                                        apiResult.errorCode = (int)BLLJIMP.Enums.APIErrCode.IntegralProblem;
                                        apiResult.awardName = "谢谢参与";
                                        apiResult.isStart   = false;
                                        goto outoff;
                                    }
                                }
                            }
                        }
                        else
                        {
                            apiResult.errorCode = (int)BLLJIMP.Enums.APIErrCode.CountIsOver;
                            apiResult.awardName = "谢谢参与";
                            goto outoff;
                        }
                    }
                }
                #endregion

                #region 每天多少次
                else
                {
                    //判读一天有没有超出
                    int count = bll.GetWXLotteryLogCountV1(model.LotteryID, currentUserInfo.UserID, DateTime.Now);
                    if (count >= model.MaxCount)
                    {
                        //判读是否够积分
                        if (model.UsePoints > 0)
                        {
                            if (currentUserInfo.TotalScore >= model.UsePoints)
                            {
                                if (isSyncYike)
                                {
                                    var resp = zrClient.BonusUpdate(currentUserInfo.Ex2, -model.UsePoints, "抽奖减少积分");
                                }
                                else
                                {
                                    //扣积分
                                    bllUser.AddUserScoreDetail(currentUserInfo.UserID, EnumStringHelper.ToString(ScoreDefineType.Lottery), bllUser.WebsiteOwner, out tempMsg, -model.UsePoints, "抽奖减少积分", "", false);
                                }
                            }
                            else
                            {
                                if (currentUserInfo.LotteryCount == 0)
                                {
                                    apiResult.errorCode = (int)BLLJIMP.Enums.APIErrCode.IntegralProblem;
                                    apiResult.awardName = "积分不足";
                                    apiResult.isStart   = false;
                                    goto outoff;
                                }
                                else
                                {
                                    //剩余刮奖次数减1
                                    if (bll.Update(currentUserInfo, string.Format(" LotteryCount-=1"), string.Format("AutoId={0}", currentUserInfo.AutoID)) <= 0)
                                    {
                                        apiResult.errorCode = (int)BLLJIMP.Enums.APIErrCode.IntegralProblem;
                                        apiResult.awardName = "谢谢参与";
                                        apiResult.isStart   = false;
                                        goto outoff;
                                    }
                                }
                            }
                        }
                        else
                        {
                            apiResult.errorCode = (int)BLLJIMP.Enums.APIErrCode.CountIsOver;
                            apiResult.awardName = "谢谢参与";
                            goto outoff;
                        }
                    }
                }
                #endregion

                #endregion

                WXLotteryLogV1 log = new WXLotteryLogV1();
                log.LotteryId  = model.LotteryID;
                log.UserId     = currentUserInfo.UserID;
                log.InsertDate = DateTime.Now;
                log.IP         = Common.MySpider.GetClientIP();
                if (bll.AddWXLotteryLogV1(log))//下一步
                {
                    #region 奖池生成
                    List <AwardModel> awardModelList = new List <AwardModel>();                                                             //奖池
                    List <WXAwardsV1> awardsList     = bll.GetAwardsListV1(model.LotteryID).Where(p => p.WinCount < p.PrizeCount).ToList(); //奖品列表 //已经中完的不参与
                    foreach (var item in awardsList)
                    {
                        for (int i = 1; i <= item.Probability; i++)
                        {
                            AwardModel m = new AwardModel();
                            m.AwardID    = item.AutoID;
                            m.PrizeName  = item.PrizeName;
                            m.AwardsType = item.AwardsType;
                            m.Img        = item.Img;
                            m.Value      = item.Value;
                            awardModelList.Add(m);
                        }
                    }
                    if (awardsList.Sum(p => p.Probability) < 100)//总中奖概率小于100 补足
                    {
                        for (int i = 1; i <= (100 - (awardsList.Sum(p => p.Probability))); i++)
                        {
                            AwardModel m = new AwardModel();
                            m.AwardID   = 0;
                            m.PrizeName = "谢谢参与";
                            awardModelList.Add(m);
                        }
                    }
                    #endregion
                    //打乱数组顺序
                    awardModelList = GetRandomList <AwardModel>(awardModelList);
                    Random rand  = new Random();
                    int    index = rand.Next(0, awardModelList.Count);

                    #region 抽奖
                    if (awardModelList[index].AwardID > 0)//随机数中奖
                    {
                        string sqlUpdate = string.Format(" Update ZCJ_WXAwardsV1  Set WinCount+=1  where AutoID={0} And WinCount<PrizeCount ", awardModelList[index].AwardID);
                        if (ZentCloud.ZCBLLEngine.BLLBase.ExecuteSql(sqlUpdate) > 0)
                        {
                            int token = rand.Next(1111, 9999);
                            //插入中奖记录
                            WXLotteryRecordV1 record = new WXLotteryRecordV1();
                            record.InsertDate = DateTime.Now;
                            record.LotteryId  = model.LotteryID;
                            record.Token      = token.ToString();
                            record.WXAwardsId = awardModelList[index].AwardID;
                            record.UserId     = currentUserInfo.UserID;
                            record.IsGetPrize = 0;
                            if (bll.AddWXLotteryRecordV1(record))
                            {
                                apiResult.awardName  = string.Format("{0}", awardModelList[index].PrizeName);
                                apiResult.isAward    = true;
                                apiResult.awardsType = awardModelList[index].AwardsType;
                                apiResult.img        = awardModelList[index].Img;
                                apiResult.value      = awardModelList[index].Value;

                                if (apiResult.awardsType == 2)
                                {
                                    BLLJIMP.BLLCardCoupon bllCardCoupon = new BLLJIMP.BLLCardCoupon();

                                    var coupon = bllCardCoupon.GetCardCoupon(int.Parse(apiResult.value));
                                    apiResult.cardcoupon_name  = coupon.Name;
                                    apiResult.cardcoupon_type  = coupon.CardCouponType;
                                    apiResult.cardcoupon_start = coupon.ValidFrom == null ? "" : coupon.ValidFrom.Value.ToShortDateString();
                                    apiResult.cardcoupon_end   = coupon.ValidTo == null ? "" : coupon.ValidTo.Value.ToShortDateString();
                                    if (coupon.ExpireTimeType == "1")
                                    {
                                        apiResult.cardcoupon_start = DateTime.Now.ToShortDateString();
                                        apiResult.cardcoupon_end   = DateTime.Now.AddDays(Convert.ToInt32(coupon.ExpireDay)).ToShortDateString();
                                    }
                                }
                                if (apiResult.awardsType == 1 || apiResult.awardsType == 2)
                                {
                                    //中奖记录标记为已经领奖
                                    WXLotteryRecordV1 rec = bll.Get <WXLotteryRecordV1>(string.Format(" UserId='{0}' And LotteryId={1} And WXAwardsId={2} And Token='{3}'", record.UserId, record.LotteryId, record.WXAwardsId, record.Token));
                                    if (rec != null)
                                    {
                                        rec.IsGetPrize = 1;
                                        bll.Update(rec);
                                    }
                                }

                                goto outoff;
                            }
                            else
                            {
                                goto outoff;
                            }
                        }
                        else
                        {
                            goto outoff;
                        }

                        //}
                        //else
                        //{   //#region 虽然随机数中奖,但是奖项数量已经达到上限,重新随机抽奖
                        //    //if (reCount >= 5)
                        //    //{
                        //    goto outoff;
                        //    //}
                        //    //reCount++;
                        //    //goto start;
                        //}
                    }
                    else
                    {
                        //随机数未中奖
                    }
                    #endregion
                }
outoff:
                if (!string.IsNullOrEmpty(context.Request["callback"]))
                {
                    return(string.Format("{0}({1})", context.Request["callback"], Common.JSONHelper.ObjectToJson(apiResult)));
                }
                return(Common.JSONHelper.ObjectToJson(apiResult));
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
        }