Ejemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            string ids = context.Request["ids"];

            if (!string.IsNullOrEmpty(ids))
            {
                resp.isSuccess = true;
                resp.errmsg    = "ids 为必填项,请检查";
                bllLottery.ContextResponse(context, resp);
                return;
            }
            WXLotteryV1 model = new WXLotteryV1();

            foreach (var item in ids.Split(','))
            {
                model = bllLottery.Get <WXLotteryV1>(string.Format("LotteryID={0}", item));
                if (model == null || (!model.WebsiteOwner.Equals(bllLottery.WebsiteOwner)))
                {
                    resp.errmsg  = "无权访问";
                    resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IntegralProblem;
                    bllLottery.ContextResponse(context, resp);
                    return;
                }
            }
            bllLottery.Delete(new WXLotteryLogV1(), string.Format("LotteryId in ({0})", ids));
            bllLottery.Delete(new WXLotteryRecordV1(), string.Format("LotteryId in ({0})", ids));
            ZentCloud.ZCBLLEngine.BLLBase.ExecuteSql(string.Format(" Update ZCJ_WXAwardsV1 Set WinCount=0 Where LotteryId  in({0})", ids));
            resp.errmsg    = "已成功重置";
            resp.isSuccess = true;
            bllLottery.ContextResponse(context, resp);
        }
Ejemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            string autoId  = context.Request["id"];
            string userId  = context.Request["user_id"];
            string awardId = context.Request["award_id"];

            if (string.IsNullOrEmpty(autoId))
            {
                resp.errcode = (int)APIErrCode.IsNotFound;
                resp.errmsg  = "活动id为必填项,请检查";
                bllLottery.ContextResponse(context, resp);
                return;
            }
            if (string.IsNullOrEmpty(userId))
            {
                resp.errcode = (int)APIErrCode.IsNotFound;
                resp.errmsg  = "用户id为必填项,请检查";
                bllLottery.ContextResponse(context, resp);
                return;
            }
            if (string.IsNullOrEmpty(awardId))
            {
                resp.errcode = (int)APIErrCode.IsNotFound;
                resp.errmsg  = "奖项id为必填项,请检查";
                bllLottery.ContextResponse(context, resp);
                return;
            }
            if (bllUser.GetUserInfo(userId) == null)
            {
                resp.errcode = (int)APIErrCode.IsNotFound;
                resp.errmsg  = "用户名不存在,请检查";
                bllLottery.ContextResponse(context, resp);
                return;
            }

            WXLotteryWinningDataV1 model = bllLottery.GetByKey <WXLotteryWinningDataV1>("AutoID", autoId);

            model.UserId     = userId;
            model.WXAwardsId = Convert.ToInt32(awardId);
            if (bllLottery.Update(model))
            {
                resp.isSuccess = true;
                resp.errcode   = (int)APIErrCode.IsSuccess;
            }
            else
            {
                resp.errcode = (int)APIErrCode.OperateFail;
                resp.errmsg  = "更新失败";
            }
            bllLottery.ContextResponse(context, resp);
        }
Ejemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            string ids = context.Request["ids"];

            if (bllLottery.DeleteMultByKey <WXLotteryWinningDataV1>("AutoID", ids) > 0)
            {
                resp.isSuccess = true;
                resp.errcode   = (int)APIErrCode.IsSuccess;
            }
            else
            {
                resp.errcode = (int)APIErrCode.OperateFail;
                resp.errmsg  = "删除默认中奖出错";
            }
            bllLottery.ContextResponse(context, resp);
        }
Ejemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            string id          = context.Request["id"];
            string forceDelete = context.Request["force_delete"];

            //force_delete等于1时,则不管是否存在中奖记录,进行强制删除
            if (forceDelete != "1")
            {
                if (bllLottery.GetCountByKey <WXLotteryRecordV1>("LotteryId", id) > 0)
                {
                    resp.errcode = (int)APIErrCode.LotteryHaveRecord;
                    resp.errmsg  = string.Format("已经有人中奖,不能删除");
                    bllLottery.ContextResponse(context, resp);
                    return;
                }
            }
            BLLTransaction tran = new BLLTransaction();

            try
            {
                if (bllLottery.DeleteByKey <WXLotteryV1>("LotteryID", id, tran) == -1)
                {
                    tran.Rollback();
                    resp.errcode = (int)APIErrCode.OperateFail;
                    resp.errmsg  = "删除活动主表失败";
                    bllLottery.ContextResponse(context, resp);
                    return;
                }

                if (bllLottery.DeleteByKey <WXAwardsV1>("LotteryId", id, tran) == -1)
                {
                    tran.Rollback();
                    resp.errcode = (int)APIErrCode.OperateFail;
                    resp.errmsg  = "删除奖项失败";
                    bllLottery.ContextResponse(context, resp);
                    return;
                }
                if (bllLottery.DeleteByKey <WXLotteryRecordV1>("LotteryId", id, tran) == -1)
                {
                    tran.Rollback();
                    resp.errcode = (int)APIErrCode.OperateFail;
                    resp.errmsg  = "删除中奖记录失败";
                    bllLottery.ContextResponse(context, resp);
                    return;
                }
                if (bllLottery.DeleteByKey <WXLotteryLogV1>("LotteryId", id, tran) == -1)
                {
                    tran.Rollback();
                    resp.errcode = (int)APIErrCode.OperateFail;
                    resp.errmsg  = "删除抽奖记录失败";
                    bllLottery.ContextResponse(context, resp);
                    return;
                }
                if (bllLottery.DeleteByKey <WXLotteryWinningDataV1>("LotteryId", id, tran) == -1)
                {
                    tran.Rollback();
                    resp.errcode = (int)APIErrCode.OperateFail;
                    resp.errmsg  = "删除默认中奖设置失败";
                    bllLottery.ContextResponse(context, resp);
                    return;
                }
                tran.Commit();
                resp.isSuccess = true;
            }
            catch (Exception ex)
            {
                tran.Rollback();
                resp.errcode = (int)APIErrCode.OperateFail;
                resp.errmsg  = ex.Message;
            }
            bllLottery.ContextResponse(context, resp);
        }
Ejemplo n.º 5
0
        public void ProcessRequest(HttpContext context)
        {
            string lotteryId = context.Request["lottery_id"];
            string userId    = context.Request["user_id"];
            string awardId   = context.Request["award_id"];

            if (string.IsNullOrEmpty(lotteryId))
            {
                resp.errcode = (int)APIErrCode.IsNotFound;
                resp.errmsg  = "活动id为必填项,请检查";
                bllLottery.ContextResponse(context, resp);
                return;
            }
            if (string.IsNullOrEmpty(userId))
            {
                resp.errcode = (int)APIErrCode.IsNotFound;
                resp.errmsg  = "用户id为必填项,请检查";
                bllLottery.ContextResponse(context, resp);
                return;
            }
            if (string.IsNullOrEmpty(awardId))
            {
                resp.errcode = (int)APIErrCode.IsNotFound;
                resp.errmsg  = "奖项id为必填项,请检查";
                bllLottery.ContextResponse(context, resp);
                return;
            }
            if (bllUser.GetUserInfo(userId) == null)
            {
                resp.errcode = (int)APIErrCode.IsNotFound;
                resp.errmsg  = "用户名不存在,请检查";
                bllLottery.ContextResponse(context, resp);
                return;
            }
            if (bllLottery.ExistsWinningData(lotteryId, userId))
            {
                resp.errcode = (int)APIErrCode.IsRepeat;
                resp.errmsg  = "该用户名已经在中奖名单中";
                bllLottery.ContextResponse(context, resp);
                return;
            }
            int AwardCount = bllLottery.GetByKey <WXAwardsV1>("AutoID", awardId).PrizeCount;

            if (AwardCount - bllLottery.GetCountByKey <WXLotteryWinningDataV1>("WXAwardsId", awardId) - 1 < 0)
            {
                resp.errcode = (int)APIErrCode.OperateFail;
                resp.errmsg  = "默认中奖奖项之和超过了该奖项的数量";
                bllLottery.ContextResponse(context, resp);
                return;
            }

            WXLotteryWinningDataV1 model = new WXLotteryWinningDataV1();

            model.LotteryId  = Convert.ToInt32(lotteryId);
            model.UserId     = userId;
            model.WXAwardsId = Convert.ToInt32(awardId);
            if (bllLottery.Add(model))
            {
                resp.isSuccess = true;
                resp.errcode   = (int)APIErrCode.IsSuccess;
            }
            else
            {
                resp.errcode = (int)APIErrCode.OperateFail;
                resp.errmsg  = "添加失败";
            }
            bllLottery.ContextResponse(context, resp);
        }