diff --git a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/AiAccountService.cs b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/AiAccountService.cs index 28b0c1f2..83ec7b10 100644 --- a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/AiAccountService.cs +++ b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/AiAccountService.cs @@ -13,6 +13,7 @@ using Yi.Framework.Rbac.Application.Contracts.IServices; using Yi.Framework.Rbac.Domain.Shared.Dtos; using Yi.Framework.SqlSugarCore.Abstractions; using Yi.Framework.AiHub.Domain.Extensions; +using Yi.Framework.AiHub.Domain.Shared.Enums; namespace Yi.Framework.AiHub.Application.Services; @@ -58,7 +59,7 @@ public class AiAccountService : ApplicationService if (output.IsVip) { var recharges = await _rechargeRepository._DbQueryable - .Where(x => x.UserId == userId) + .Where(x => x.UserId == userId && x.RechargeType == RechargeTypeEnum.Vip) .ToListAsync(); if (recharges.Any()) diff --git a/Yi.Ai.Vue3/src/components/userPersonalCenter/components/UserManagement.vue b/Yi.Ai.Vue3/src/components/userPersonalCenter/components/UserManagement.vue index efe5d286..e55a8a17 100644 --- a/Yi.Ai.Vue3/src/components/userPersonalCenter/components/UserManagement.vue +++ b/Yi.Ai.Vue3/src/components/userPersonalCenter/components/UserManagement.vue @@ -36,6 +36,40 @@ const userVipStatus = computed(() => { return isUserVip(); }); +// VIP到期时间 +const vipExpireTime = computed(() => { + return userStore.userInfo?.vipExpireTime || null; +}); + +// 计算距离VIP到期还有多少天 +const vipRemainingDays = computed(() => { + if (!vipExpireTime.value) return null; + const expireDate = new Date(vipExpireTime.value); + const now = new Date(); + const diffTime = expireDate.getTime() - now.getTime(); + const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); + return diffDays; +}); + +// VIP到期状态文本 +const vipExpireStatusText = computed(() => { + if (!userVipStatus.value) return ''; + if (!vipExpireTime.value) return '永久VIP'; + if (vipRemainingDays.value === null) return ''; + if (vipRemainingDays.value < 0) return '已过期'; + if (vipRemainingDays.value === 0) return '今日到期'; + return `${vipRemainingDays.value}天后到期`; +}); + +// VIP到期状态标签类型 +const vipExpireTagType = computed(() => { + if (!vipExpireTime.value) return 'success'; + if (vipRemainingDays.value === null) return 'info'; + if (vipRemainingDays.value < 0) return 'danger'; + if (vipRemainingDays.value <= 7) return 'warning'; + return 'success'; +}); + // 格式化日期 function formatDate(dateString: string | null) { if (!dateString) @@ -161,6 +195,28 @@ function bindWechat() { 注册时间 + +
支持多种主流AI接口协议,一键切换
+ + +