From 534b03ef5cc0cd86d698d07d9f0a290ac1454aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Sat, 16 Mar 2024 17:57:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=88=A9=E6=81=AF?= =?UTF-8?q?=E8=B6=8B=E5=8A=BF=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Jobs/InterestRecordsJob.cs | 13 +++++----- .../Services/Bank/BankService.cs | 2 +- .../Managers/BankManager.cs | 6 ++++- Yi.Bbs.Vue3/src/views/bank/Index.vue | 24 +++++++++++++++---- .../views/bank/hooks/exchangeRateConfig.js | 4 ++-- 5 files changed, 34 insertions(+), 15 deletions(-) diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Jobs/InterestRecordsJob.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Jobs/InterestRecordsJob.cs index a67e1326..3763ae57 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Jobs/InterestRecordsJob.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Jobs/InterestRecordsJob.cs @@ -13,14 +13,15 @@ namespace Yi.Framework.Bbs.Application.Jobs JobDetail = JobBuilder.Create().WithIdentity(nameof(InterestRecordsJob)).Build(); //每个小时整点执行一次 - Trigger = TriggerBuilder.Create().WithIdentity(nameof(InterestRecordsJob)).WithCronSchedule("0 */1 * * *").Build(); + + Trigger = TriggerBuilder.Create().WithIdentity(nameof(InterestRecordsJob)).WithCronSchedule("* 0 * * * ?").Build(); //测试 - // Trigger = TriggerBuilder.Create().WithIdentity(nameof(InterestRecordsJob)) - //.WithSimpleSchedule(x => x - // .WithIntervalInSeconds(5) - // .RepeatForever()) - //.Build(); +// Trigger = TriggerBuilder.Create().WithIdentity(nameof(InterestRecordsJob)) +//.WithSimpleSchedule(x => x +// .WithIntervalInSeconds(10) +// .RepeatForever()) +//.Build(); } public override async Task Execute(IJobExecutionContext context) { diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Bank/BankService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Bank/BankService.cs index 54f2f12f..2933305e 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Bank/BankService.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Bank/BankService.cs @@ -30,7 +30,7 @@ namespace Yi.Framework.Bbs.Application.Services.Bank [HttpGet("bank/interest")] public async Task> GetInterestRecordsAsync() { - var entities = await _interestRepository._DbQueryable.OrderByDescending(x => x.CreationTime).ToPageListAsync(1, 24); + var entities = await _interestRepository._DbQueryable.OrderBy(x => x.CreationTime).ToPageListAsync(1, 24); var output = entities.Adapt>(); return output; } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankManager.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankManager.cs index 95ea4f1c..245b969c 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankManager.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankManager.cs @@ -51,6 +51,10 @@ namespace Yi.Framework.Bbs.Domain.Managers output.ComparisonValue = currentInterestRecords.ComparisonValue; output.CreationTime = currentInterestRecords.CreationTime; output.Value = currentInterestRecords.Value; + + _currentRateStore=new BankInterestRecordDto() { ComparisonValue= currentInterestRecords .ComparisonValue, + CreationTime=currentInterestRecords.CreationTime,Value=currentInterestRecords.Value}; + } return output; } @@ -101,7 +105,7 @@ namespace Yi.Framework.Bbs.Domain.Managers //根据上一次的老值进行变化率比较 - var currentValue = oldValue * changeRate; + var currentValue = oldValue + (oldValue* changeRate); var entity = new InterestRecordsEntity(lastThirdPartyStandardValue, currentValue); var output = await _interestRepository.InsertReturnEntityAsync(entity); diff --git a/Yi.Bbs.Vue3/src/views/bank/Index.vue b/Yi.Bbs.Vue3/src/views/bank/Index.vue index 074c9cf4..34dbebe2 100644 --- a/Yi.Bbs.Vue3/src/views/bank/Index.vue +++ b/Yi.Bbs.Vue3/src/views/bank/Index.vue @@ -4,7 +4,7 @@
-

当前实时利息:130%(可获取投入的百分之130%的本金)

+

当前实时利息:{{currentRate}}%(可获取投入的百分之{{currentRate}}的本金)

申领银行卡 @@ -65,10 +65,12 @@ const refreshData = async () => { bankCardList.value = data; } - const { data2: data } = await getInterestList(); - interestList.value = data; + const { data: data2 } = await getInterestList(); + interestList.value = data2; } + + onMounted(async () => { await refreshData(); }) @@ -137,14 +139,26 @@ const sendDeposit = async () => { message: '钱钱提款成功', }) } + +const getHours=(timeString)=>{ + const date = new Date(timeString); + return date.getHours(); +} + +const currentRate=computed(()=>{ + return (interestList.value.map(x=>x.value).slice(-1)[0])*100 +}) + + + const statisOptions = computed(() => { return { xAxis: { - data: ['1时', '2时', '3时', '4时', '5时', '6时', '7时', '1时', '2时', '3时', '4时', '5时', '6时', '7时', '5时', '6时', '7时', '1时', '2时', '3时', '4时', '5时', '6时', '7时'] + data:interestList.value.map(x=>getHours(x.creationTime)+"时") }, series: { - data: [10, 6, 13, 11, 12, 12, 9, 10, 11, 13, 11, 8, 14, 9, 12, 12, 9, 10, 11, 13, 11, 8, 14, 9] + data: interestList.value.map(x=>(x.value*100)) }, }; }); diff --git a/Yi.Bbs.Vue3/src/views/bank/hooks/exchangeRateConfig.js b/Yi.Bbs.Vue3/src/views/bank/hooks/exchangeRateConfig.js index 8d8b4185..668d6bf2 100644 --- a/Yi.Bbs.Vue3/src/views/bank/hooks/exchangeRateConfig.js +++ b/Yi.Bbs.Vue3/src/views/bank/hooks/exchangeRateConfig.js @@ -1,6 +1,6 @@ export const exchangeRateConfig ={ title: { - text: '银行利息趋势图-(暂未开放)' + text: '银行利息趋势图' }, tooltip: { trigger: 'axis' @@ -26,7 +26,7 @@ export const exchangeRateConfig ={ yAxis: { type: 'value', axisLabel: { - formatter: '{value} 率' + formatter: '{value} %' } }, series: [