/// <summary> /// 充值。 /// </summary> /// <returns>返回充值结果。</returns> public async Task <IActionResult> OnPostAsync() { var settings = await GetSettingsAsync <ScoreSettings>(); if (Input.Score <= 0) { ModelState.AddModelError("Input.Score", $"充值的{settings.ScoreName}不能为复数!"); return(Error()); } var result = await _scoreManager.RechargeAsync(Input.UserId, Input.Score, Input.Summary); if (result) { var user = await _userManager.FindByIdAsync(Input.UserId); await LogAsync($"对 {user.NickName} 充值 {Input.Score} {settings.ScoreUnit},备注:{Input.Summary}"); return(Success("恭喜你,你已经成功充值成功!")); } return(Error($"很抱歉,充值失败,原因:{Localizer[result.Status]}。")); }