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