diff --git a/src/0-core/HuanMeng.MiaoYu.Code/Other/OtherBLL.cs b/src/0-core/HuanMeng.MiaoYu.Code/Other/OtherBLL.cs
index 5bfd112..f506529 100644
--- a/src/0-core/HuanMeng.MiaoYu.Code/Other/OtherBLL.cs
+++ b/src/0-core/HuanMeng.MiaoYu.Code/Other/OtherBLL.cs
@@ -1,4 +1,11 @@
+using HuanMeng.MiaoYu.Code.Base;
using HuanMeng.MiaoYu.Code.Cache;
+using HuanMeng.MiaoYu.Code.DataAccess;
+using HuanMeng.MiaoYu.Code.Users;
+
+using Microsoft.Extensions.Logging;
+
+using StackExchange.Redis;
using System;
using System.Collections.Generic;
@@ -33,5 +40,42 @@ namespace HuanMeng.MiaoYu.Code.Other
MiaoYuCacheExtend.ReloadMiaoYuDataEntityCache(this);
return Task.CompletedTask;
}
+
+ ///
+ /// 获取广告奖励
+ ///
+ ///
+ ///
+ public async Task GetAdReward()
+ {
+
+ var user = await Dao.daoDbMiaoYu.context.T_User.FirstOrDefaultAsync(it => it.Id == _UserId);
+ if (user == null)
+ {
+
+ throw new ArgumentNullException($"error;用户不存在");
+ }
+ if (!RedisCache.StringSetLock($"ad:{_UserId}", "", 20))
+ {
+ throw new ArgumentNullException($"请求频繁");
+ }
+ using (IDbContextTransaction transaction = Dao.daoDbMiaoYu.context.Database.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted))
+ {
+ try
+ {
+ user.ConsumeMoneyNoWork(UserCurrencyType.聊天次数, 10, Dao, title: $"看广告赠送赠送{UserCurrencyType.聊天次数}{10}");
+ await transaction.CommitAsync();
+ }
+ catch (Exception ex)
+ {
+
+ await transaction.RollbackAsync();
+
+ throw new ArgumentNullException($"error;出现异常{ex.Message}");
+ }
+ }
+ return $"奖励已发放!";
+
+ }
}
}
diff --git a/src/0-core/HuanMeng.MiaoYu.Code/Users/UserAccount/VerificationCodeManager/MemoryVerificationCodeServer.cs b/src/0-core/HuanMeng.MiaoYu.Code/Users/UserAccount/VerificationCodeManager/MemoryVerificationCodeServer.cs
index 5fae7c1..83fdd0d 100644
--- a/src/0-core/HuanMeng.MiaoYu.Code/Users/UserAccount/VerificationCodeManager/MemoryVerificationCodeServer.cs
+++ b/src/0-core/HuanMeng.MiaoYu.Code/Users/UserAccount/VerificationCodeManager/MemoryVerificationCodeServer.cs
@@ -51,7 +51,7 @@ namespace HuanMeng.MiaoYu.Code.Users.UserAccount.VerificationCodeManager
///
private void DoWork(object state)
{
-
+
manager.RemoveExpiredRefreshCodes(DateTime.Now);
}
@@ -65,7 +65,10 @@ namespace HuanMeng.MiaoYu.Code.Users.UserAccount.VerificationCodeManager
{
// TODO: 释放托管状态(托管对象)
}
- _timer.Dispose();
+ if (_timer != null)
+ {
+ _timer.Dispose();
+ }
// TODO: 释放未托管的资源(未托管的对象)并重写终结器
// TODO: 将大型字段设置为 null
disposedValue = true;
diff --git a/src/2-api/HuanMeng.MiaoYu.WebApi/Controllers/OtherController.cs b/src/2-api/HuanMeng.MiaoYu.WebApi/Controllers/OtherController.cs
index bbcfb5c..3d9fbc0 100644
--- a/src/2-api/HuanMeng.MiaoYu.WebApi/Controllers/OtherController.cs
+++ b/src/2-api/HuanMeng.MiaoYu.WebApi/Controllers/OtherController.cs
@@ -1,10 +1,14 @@
+using HuanMeng.DotNetCore.Base;
using HuanMeng.MiaoYu.Code.Other;
+using HuanMeng.MiaoYu.Model.Dto.Music;
using HuanMeng.MiaoYu.WebApi.Base;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
+using SKIT.FlurlHttpClient.Wechat.TenpayV3.Models;
+
namespace HuanMeng.MiaoYu.WebApi.Controllers
{
[Route("api/[controller]")]
@@ -24,7 +28,7 @@ namespace HuanMeng.MiaoYu.WebApi.Controllers
{
OtherBLL otherBLL = new OtherBLL(ServiceProvider);
await otherBLL.CleraCache();
-
+
}
///
@@ -39,5 +43,17 @@ namespace HuanMeng.MiaoYu.WebApi.Controllers
await otherBLL.ReloadCache();
}
+ ///
+ /// 获取看广告奖励
+ ///
+ ///
+ [HttpPost]
+ [Authorize]
+ public async Task> GetAdReward()
+ {
+ OtherBLL otherBLL = new OtherBLL(ServiceProvider);
+ var s = await otherBLL.GetAdReward();
+ return new BaseResponse(0, s);
+ }
}
}