fix: 更换银行模块源及修复钱钱小数

This commit is contained in:
chenchun
2024-06-13 15:56:58 +08:00
parent 14db420cbe
commit 5b109e91d1
4 changed files with 26 additions and 3 deletions

View File

@@ -3,13 +3,16 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace Yi.Framework.Bbs.Domain.Shared.Etos namespace Yi.Framework.Bbs.Domain.Shared.Etos
{ {
public class MoneyChangeEventArgs public class MoneyChangeEventArgs
{ {
public MoneyChangeEventArgs() { } public MoneyChangeEventArgs() { }
public MoneyChangeEventArgs(Guid userId, decimal changeNumber) { UserId = userId; Number = changeNumber; } public MoneyChangeEventArgs(Guid userId, decimal changeNumber) { UserId = userId;
Number = Math.Round(changeNumber, 2); }
/// <summary> /// <summary>
/// 用户id /// 用户id

View File

@@ -35,7 +35,7 @@ namespace Yi.Framework.Bbs.Domain.Managers
/// <summary> /// <summary>
/// 用于存储当前汇率数据 /// 用于存储当前汇率数据
/// </summary> /// </summary>
private BankInterestRecordDto? _currentRateStore; private static BankInterestRecordDto? _currentRateStore;
/// <summary> /// <summary>
/// 获取当前的银行汇率,如果为空会从数据库拿最新一条 /// 获取当前的银行汇率,如果为空会从数据库拿最新一条
@@ -45,7 +45,7 @@ namespace Yi.Framework.Bbs.Domain.Managers
{ {
var output = new BankInterestRecordDto(); var output = new BankInterestRecordDto();
//先判断时间是否与当前时间差1小时小于1小时直接返回即可,可以由一个单例类提供 //先判断时间是否与当前时间差1小时小于1小时直接返回即可,可以由一个单例类提供
if (this._currentRateStore is null || this._currentRateStore.IsExpire()) if (_currentRateStore is null || _currentRateStore.IsExpire())
{ {
var currentInterestRecords = CreateInterestRecordsAsync().Result; var currentInterestRecords = CreateInterestRecordsAsync().Result;
output.ComparisonValue = currentInterestRecords.ComparisonValue; output.ComparisonValue = currentInterestRecords.ComparisonValue;

View File

@@ -9,6 +9,7 @@ using Volo.Abp.DependencyInjection;
namespace Yi.Framework.Bbs.Domain.Managers.BankValue namespace Yi.Framework.Bbs.Domain.Managers.BankValue
{ {
[Dependency(TryRegister =true)]
public class BiyingBankValueProvider : IBankValueProvider, ITransientDependency public class BiyingBankValueProvider : IBankValueProvider, ITransientDependency
{ {
//官网地址www.biyingapi.com //官网地址www.biyingapi.com

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
namespace Yi.Framework.Bbs.Domain.Managers.BankValue
{
[Dependency(ReplaceServices = true)]
internal class RandownBankValueProvider : IBankValueProvider, ITransientDependency
{
public Task<decimal> GetValueAsync()
{
var currentNumber = new Random().Next(800, 1200);
return Task.FromResult((decimal)currentNumber);
}
}
}