From c4a3d5d5a2e660a0bf337ef08973538204dcc60e Mon Sep 17 00:00:00 2001 From: zpc Date: Wed, 25 Mar 2026 10:06:27 +0800 Subject: [PATCH] =?UTF-8?q?feat(invite):=20=E8=A7=84=E5=88=99=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E5=BC=B9=E7=AA=97=E6=94=B9=E4=B8=BA=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=86=85=E5=AE=B9=EF=BC=8C=E4=BB=8E=E5=90=8E=E7=AB=AF=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增invite_rule业务配置项 - ISystemService/SystemService新增GetInviteRuleAsync方法 - SystemController新增getInviteRule接口 - 前端规则说明弹窗改为纯文本展示,匹配设计图样式 --- .../Controllers/SystemController.cs | 32 ++++++++++--- .../Interfaces/ISystemService.cs | 9 ++++ .../Services/SystemService.cs | 12 +++++ uniapp/api/system.js | 11 ++++- uniapp/pages/invite/index.vue | 47 ++++++++++--------- 5 files changed, 80 insertions(+), 31 deletions(-) diff --git a/server/MiAssessment/src/MiAssessment.Api/Controllers/SystemController.cs b/server/MiAssessment/src/MiAssessment.Api/Controllers/SystemController.cs index 69fc4d6..e4a7427 100644 --- a/server/MiAssessment/src/MiAssessment.Api/Controllers/SystemController.cs +++ b/server/MiAssessment/src/MiAssessment.Api/Controllers/SystemController.cs @@ -141,13 +141,6 @@ public class SystemController : ControllerBase /// /// 获取小程序信息 /// - /// - /// GET /api/system/getMiniappInfo - /// - /// 从配置表读取小程序名称和简介 - /// 不需要用户登录认证 - /// - /// 小程序名称和简介 [HttpGet("getMiniappInfo")] [ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)] public async Task> GetMiniappInfo() @@ -163,4 +156,29 @@ public class SystemController : ControllerBase return ApiResponse.Fail("获取小程序信息失败"); } } + + /// + /// 获取邀请规则说明 + /// + /// + /// GET /api/system/getInviteRule + /// + /// 从配置表读取邀请规则说明内容 + /// 不需要用户登录认证 + /// + /// 邀请规则说明内容 + [HttpGet("getInviteRule")] + public async Task> GetInviteRule() + { + try + { + var content = await _systemService.GetInviteRuleAsync(); + return ApiResponse.Success(content); + } + catch (Exception ex) + { + _logger.LogError(ex, "Failed to get invite rule"); + return ApiResponse.Fail("获取邀请规则失败"); + } + } } diff --git a/server/MiAssessment/src/MiAssessment.Core/Interfaces/ISystemService.cs b/server/MiAssessment/src/MiAssessment.Core/Interfaces/ISystemService.cs index 876eb0f..ab4d70a 100644 --- a/server/MiAssessment/src/MiAssessment.Core/Interfaces/ISystemService.cs +++ b/server/MiAssessment/src/MiAssessment.Core/Interfaces/ISystemService.cs @@ -51,4 +51,13 @@ public interface ISystemService /// /// 小程序信息数据 Task GetMiniappInfoAsync(); + + /// + /// 获取邀请规则说明 + /// + /// + /// 从配置表读取邀请规则说明内容(config_key: invite_rule) + /// + /// 邀请规则说明内容 + Task GetInviteRuleAsync(); } diff --git a/server/MiAssessment/src/MiAssessment.Core/Services/SystemService.cs b/server/MiAssessment/src/MiAssessment.Core/Services/SystemService.cs index 53b41e9..56fd63c 100644 --- a/server/MiAssessment/src/MiAssessment.Core/Services/SystemService.cs +++ b/server/MiAssessment/src/MiAssessment.Core/Services/SystemService.cs @@ -20,6 +20,7 @@ public class SystemService : ISystemService private const string ServiceQrcodeKey = "service_qrcode"; private const string MiniappNameKey = "miniapp_name"; private const string MiniappIntroKey = "miniapp_intro"; + private const string InviteRuleKey = "invite_rule"; // 默认版本号 private const string DefaultVersion = "1.0.0"; @@ -127,4 +128,15 @@ public class SystemService : ISystemService Intro = intro ?? string.Empty }; } + + /// + public async Task GetInviteRuleAsync() + { + _logger.LogDebug("获取邀请规则说明"); + + var content = await _configService.GetConfigValueAsync(InviteRuleKey); + + return content ?? string.Empty; + } + } diff --git a/uniapp/api/system.js b/uniapp/api/system.js index 7d3c5ed..27c3fc6 100644 --- a/uniapp/api/system.js +++ b/uniapp/api/system.js @@ -44,10 +44,19 @@ export function getMiniappInfo() { return get('/system/getMiniappInfo') } +/** + * 获取邀请规则说明 + * @returns {Promise} + */ +export function getInviteRule() { + return get('/system/getInviteRule') +} + export default { getAgreement, getPrivacy, getAbout, getContactInfo, - getMiniappInfo + getMiniappInfo, + getInviteRule } diff --git a/uniapp/pages/invite/index.vue b/uniapp/pages/invite/index.vue index 559ce38..5cccfae 100644 --- a/uniapp/pages/invite/index.vue +++ b/uniapp/pages/invite/index.vue @@ -16,7 +16,7 @@ import { applyWithdraw, getWithdrawList } from '@/api/invite.js' -import { getMiniappInfo } from '@/api/system.js' +import { getMiniappInfo, getInviteRule } from '@/api/system.js' import Empty from '@/components/Empty/index.vue' import Loading from '@/components/Loading/index.vue' @@ -64,6 +64,9 @@ const qrcodeLoading = ref(false) const miniappName = ref('') const miniappIntro = ref('') +// 规则说明内容 +const ruleContent = ref('') + // 提现表单 const withdrawAmount = ref('') const withdrawLoading = ref(false) @@ -150,6 +153,20 @@ async function loadMiniappInfo() { } } +/** + * 加载邀请规则说明 + */ +async function loadInviteRule() { + try { + const res = await getInviteRule() + if (res.code === 0 && res.data) { + ruleContent.value = res.data + } + } catch (error) { + console.error('获取邀请规则失败:', error) + } +} + /** * 加载邀请记录列表 */ @@ -361,6 +378,7 @@ onShow(() => { loadRecordList(true) loadMiniappInfo() loadQrcodeUrl() + loadInviteRule() }) onMounted(() => { userStore.restoreFromStorage() }) @@ -463,16 +481,7 @@ onMounted(() => { userStore.restoreFromStorage() }) - - {{ idx + 1 }}. {{ rule }} - + {{ ruleContent || '暂无规则说明' }} @@ -908,18 +917,10 @@ onMounted(() => { userStore.restoreFromStorage() }) } .rule-content { - .rule-item { - margin-bottom: $spacing-md; - - &:last-child { - margin-bottom: 0; - } - - .rule-text { - font-size: $font-size-md; - color: $text-color; - line-height: 1.6; - } + .rule-text { + font-size: $font-size-md; + color: $text-color; + line-height: 1.8; } } }