From 19b27d8e9a5213f8edb52fd2bc48905f5bd6aaa8 Mon Sep 17 00:00:00 2001 From: ccnetcore Date: Fri, 6 Feb 2026 00:41:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90api=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=90=AD=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/AiAccountService.cs | 3 +- .../components/UserManagement.vue | 56 ++++ .../src/layouts/components/Header/index.vue | 16 +- Yi.Ai.Vue3/src/pages/chat/api/index.vue | 305 ++++++++++++++++++ .../src/routers/modules/staticRouter.ts | 8 + Yi.Ai.Vue3/types/import_meta.d.ts | 1 - 6 files changed, 385 insertions(+), 4 deletions(-) create mode 100644 Yi.Ai.Vue3/src/pages/chat/api/index.vue 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() { 注册时间 + +
+
+ + +
+
+ VIP到期时间 + + {{ vipExpireStatusText }} + +
+
diff --git a/Yi.Ai.Vue3/src/layouts/components/Header/index.vue b/Yi.Ai.Vue3/src/layouts/components/Header/index.vue index dd99fc29..786e69ba 100644 --- a/Yi.Ai.Vue3/src/layouts/components/Header/index.vue +++ b/Yi.Ai.Vue3/src/layouts/components/Header/index.vue @@ -127,6 +127,9 @@ function toggleMobileMenu() { AI智能体 + + AI接口 + @@ -137,8 +140,11 @@ function toggleMobileMenu() { + + 模型库 + 模型排行榜 @@ -272,14 +278,20 @@ function toggleMobileMenu() { AI智能体 + + AI接口 + + + 模型库 + 模型排行榜 diff --git a/Yi.Ai.Vue3/src/pages/chat/api/index.vue b/Yi.Ai.Vue3/src/pages/chat/api/index.vue new file mode 100644 index 00000000..20e99e07 --- /dev/null +++ b/Yi.Ai.Vue3/src/pages/chat/api/index.vue @@ -0,0 +1,305 @@ + + + + + diff --git a/Yi.Ai.Vue3/src/routers/modules/staticRouter.ts b/Yi.Ai.Vue3/src/routers/modules/staticRouter.ts index 39337a03..b59b922a 100644 --- a/Yi.Ai.Vue3/src/routers/modules/staticRouter.ts +++ b/Yi.Ai.Vue3/src/routers/modules/staticRouter.ts @@ -77,6 +77,14 @@ export const layoutRouter: RouteRecordRaw[] = [ title: '意心Ai-AI智能体', }, }, + { + path: 'api', + name: 'chatApi', + component: () => import('@/pages/chat/api/index.vue'), + meta: { + title: '意心Ai-AI接口', + }, + }, ], }, diff --git a/Yi.Ai.Vue3/types/import_meta.d.ts b/Yi.Ai.Vue3/types/import_meta.d.ts index c98d612e..8f2a798b 100644 --- a/Yi.Ai.Vue3/types/import_meta.d.ts +++ b/Yi.Ai.Vue3/types/import_meta.d.ts @@ -7,7 +7,6 @@ interface ImportMetaEnv { readonly VITE_WEB_BASE_API: string; readonly VITE_API_URL: string; readonly VITE_FILE_UPLOAD_API: string; - readonly VITE_BUILD_COMPRESS: string; readonly VITE_SSO_SEVER_URL: string; readonly VITE_APP_VERSION: string; }