Beispiel #1
0
        public JsonResult SetUserVip(int id)
        {
            AjaxResult result = new AjaxResult();
            try
            {
                UserService service = new UserService();
                User user = service.GetUserById(id);

                if (user.Vip.HasValue && user.Vip == (int)VipState.VIP)
                {
                    result.ExceptionInfo = "该用户已经是VIP会员";
                }
                else if (user.Vip.HasValue && (user.Vip == (int)VipState.Normal || user.Vip == (int)VipState.Invalid))
                {
                    result.ExceptionInfo = "只有认证会员才能设置VIP,请先通知会员进行认证,保证信息准确";
                }
                else if (!service.SetUserToVip(id))
                {
                    result.ExceptionInfo = "用户升级1年VIP失败";
                }
            }
            catch (Exception ex)
            {
                LogService.Log("SetUserVip", ex.ToString());
                result.ExceptionInfo = "用户升级1年VIP失败";
            }
            return Json(result);
        }