コード例 #1
0
        public JsonResult Post(int id)
        {
            ResultState result = new ResultState();

            result.State = 500;
            result.Msg   = "亲,你已经投过票了";
            var item = _sortService.FindItemByID(id);

            if (item.RandomID != 0)
            {
                return(Json(result));
            }
            else
            {
                try
                {
                    int num = _sortService.ProduceRandom(item);
                    result.State = 200;
                    result.Msg   = num.ToString();
                    return(Json(result));
                }
                catch (Exception)
                {
                    result.Msg = "程序内部异常,请联系管理员";
                    return(Json(result));
                }
            }
        }