public void SaveUserIntegralDetail(UserGetPrizeInfo info, IntegralExchangeType opraType) { try { var manage = new UserIntegralManager(); UserIntegralBalance entity = manage.GetUserIntegralBalance(info.UserId); if (entity == null && opraType == IntegralExchangeType.IntegralOut) { throw new Exception("您还没有积分,不能兑换奖品或领取彩金!"); } UserIntegralDetail detailEntity = new UserIntegralDetail(); detailEntity.UserId = info.UserId; detailEntity.PayIntegral = info.PayInegral; detailEntity.BeforeIntegral = entity == null ? 0 : entity.CurrIntegralBalance; if (opraType == IntegralExchangeType.IntegralIn) { detailEntity.OrderId = info.OrderId; detailEntity.Summary = "购彩" + info.OrderMoey + "元,增加积分" + Convert.ToInt32(info.OrderMoey) + "点"; detailEntity.AfterIntegral = detailEntity.BeforeIntegral + detailEntity.PayIntegral; } else if (opraType == IntegralExchangeType.IntegralOut) { detailEntity.OrderId = ""; if (info.PayInegral > entity.CurrIntegralBalance) { return; } if (info.PayInegral == 100000) { detailEntity.Summary = "用户10万积分,兑换IPhone5S手机一部"; } else if (info.PayInegral == 1000000) { detailEntity.Summary = "用户100万积分,兑换QQ3汽车一辆"; } detailEntity.AfterIntegral = detailEntity.BeforeIntegral - detailEntity.PayIntegral; } detailEntity.CreateTime = DateTime.Now; manage.AddUserIntegralDetail(detailEntity); } catch (Exception ex) { throw new Exception(ex.Message); } }