private string GenerateEmail(Models.CouponGiftOrder order)
        {
            return($@"<p>{User.UserName},</p>
<p>  感谢你对其乐社区质量的认可与贡献!</p>
<p>  你在文券商店兑换的 Steam 钱包卡已成功生成订单。出于对社区内容作者的尊重,我们会对所有兑换者的文券历史进行简单的来源审核,并会在 96 小时以内通过电邮将充值代码发送到当前的电邮地址。请妥善保管以下订单信息以便日后问询。</p>
<p>订单编号:{order.Id.ToUpper()}<br />
UIC:{User.IdCode}<br />
兑换时间:{order.RedeemTime.ToString("yyyy-MM-dd HH:mm:ss")}<br />
面值:¥{Gift.Value} CNY<br />
价格:{order.RedeemPrice} ◆<br />
预计发码时间:{(order.RedeemTime + TimeSpan.FromDays(3)).ToString("yyyy-MM-dd HH:mm:ss")}</p>
<p>  请不要回复此则电邮,如有任何联系我们的需要,请致信其乐的反馈邮箱 <a href=""mailto:[email protected]"">[email protected]</a>,如果你在垃圾邮件文件夹中找到了当前这封邮件,请记得将我们的发件人地址([email protected])加入过滤白名单,以免错过之后的兑换码。</p>
<p>蒸汽动力 其乐游戏社区</p>
<p>Keylol.com</p>");
        }
        /// <summary>
        /// 商品兑换
        /// </summary>
        public override async Task RedeemAsync()
        {
            if (await GetCreditAsync() < Gift.Value)
            {
                throw new Exception(Errors.NotEnoughCredit);
            }

            if (string.IsNullOrWhiteSpace(User.Email))
            {
                throw new Exception(Errors.EmailNonExistent);
            }

            var order = new Models.CouponGiftOrder
            {
                UserId      = User.Id,
                GiftId      = Gift.Id,
                RedeemPrice = Gift.Price
            };

            _dbContext.CouponGiftOrders.Add(order);
            await _dbContext.SaveChangesAsync();

            await _coupon.UpdateAsync(User, CouponEvent.兑换商品, -Gift.Price, new { CouponGiftId = Gift.Id });

            var userManager = Global.Container.GetInstance <KeylolUserManager>();
            await userManager.SendEmailAsync(User.Id, "你的 Steam 钱包卡兑换订单", GenerateEmail(order));

            await userManager.SendSteamChatMessageAsync(User,
                                                        $"你的 Steam 钱包卡兑换订单已生成,详细信息已发送到你登记的邮箱 ({User.Email}) 中。若五分钟内没有收到任何邮件,请检查你的垃圾邮件文件夹,或与我们的站务职员邮箱 ([email protected]) 联络。");

            await userManager.EmailService.SendAsync(new IdentityMessage
            {
                Destination = "[email protected]; [email protected]",
                Subject     = $"用户兑换 Steam 充值卡通知 - {User.UserName}",
                Body        = $@"<p>订单编号:{order.Id}<br />
UIC:{User.IdCode}<br />
用户名:{User.UserName}<br />
Email:{User.Email}<br />
兑换时间:{order.RedeemTime.ToString("yyyy-MM-dd HH:mm:ss")}<br />
面值:¥{Gift.Value} CNY<br />
价格:{order.RedeemPrice} ◆</p>"
            });
        }