Ejemplo n.º 1
0
        public ActionResult AddPrizeWinner(string type)
        {
            bool ok = false;

            try
            {
                var stat = _statService.GetStart();
                switch (type)
                {
                // 九宫格抽奖
                case "00":
                    ok = (stat != null && stat.PrizeWinnerNum < LotteryPrizerNum);
                    if (ok)
                    {
                        stat.PrizeWinnerNum++;
                    }
                    break;

                // day1抽奖
                case "11":      // 店长D1
                case "12":      // 品牌经理兼督导D1
                case "13":      // 培训兼陈列D1
                case "14":      // 商品D1
                    ok = (stat != null && stat.Day1WinnerNum < Day1PrizerNum);
                    if (ok)
                    {
                        stat.Day1WinnerNum++;
                    }
                    break;

                // day2抽奖
                case "21":      // 店长D2
                case "22":      // 品牌经理兼督导D2
                case "23":      // 陈列兼培训D2
                case "24":      // 陈列D2
                    ok = (stat != null && stat.Day2WinnerNum < Day2PrizerNum);
                    if (ok)
                    {
                        stat.Day2WinnerNum++;
                    }
                    break;

                default:
                    break;
                }

                if (ok)
                {
                    ok = _statService.UpdateStat(stat);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }

            return(Json(new { ok = ok }, JsonRequestBehavior.AllowGet));
        }