feat: 模型回退 Avalonia 独立窗口;积分精确到 0.01;人品值/二选一接入后端计费

模型(回退 Flutter 内嵌 → Avalonia):
- 恢复 model/_sdk、5 个模型 src/、GC-DRAW/PlayerWindow、ModelHost/AvaloniaHost(源自 5b62897)
- FlutterShell 主线程承载 Avalonia 事件循环,根治 1.1.1 的 AppKit 崩溃
- /api/models/{id}/launch 由后端开独立 Avalonia 窗口
- 前端删除 Flutter 模型实现与 ModelViewPage 死代码(13 个文件)

积分:
- Points/ThemePaid int → decimal,精确到 0.01;pw.yaml 兼容旧整数格式
- 主题色退款保留 2 位小数;前端新增 formatPoints 显示

人品值/二选一计费(原前端本地免费随机 → 后端计费):
- 新增 POST /api/user/fortune、/api/user/pick,随机数与扣费都在服务端
- 人品值阶梯:当日免费 1 次 → 0.1×5 → 0.2×5 → 0.5×15 → 1.0 起
- 二选一:当日免费 1 次 → 0.5/次;计数按 UTC 日期持久化,跨天清零
- 前端两个功能需登录,扣费后提示本次消耗

附 RELEASE-1.1.2.md 更新日志。
This commit is contained in:
远影科技 committed 2026-11-21 21:51:34 +08:00
1 parent 38781c9807
commit cfd6809714
57 files changed
+8300 -1966

No files matched your search

+14 -4
View File
@@ -15,7 +15,9 @@ class UserRecord {
});
final String username;
final int points;
/// 积分,精确到 0.01
final double points;
/// 连续签到天数(断签会重置)
final int consecutiveDays;
@@ -38,7 +40,7 @@ class UserRecord {
final String? themeColor;
/// 当前这个颜色实际花了多少分
final int themePaid;
final double themePaid;
/// 退款窗口剩余秒数(0 表示没有可退的)
final int refundSeconds;
@@ -46,7 +48,7 @@ class UserRecord {
factory UserRecord.fromJson(Map<String, dynamic> json) {
return UserRecord(
username: json['username'] as String? ?? '',
points: (json['points'] as num?)?.toInt() ?? 0,
points: (json['points'] as num?)?.toDouble() ?? 0,
consecutiveDays: (json['consecutive_days'] as num?)?.toInt() ?? 0,
cycleDay: (json['cycle_day'] as num?)?.toInt() ?? 1,
cycleDays: (json['cycle_days'] as num?)?.toInt() ?? 30,
@@ -54,7 +56,7 @@ class UserRecord {
nextReward: (json['next_reward'] as num?)?.toInt() ?? 10,
lastSignIn: json['last_sign_in'] as String?,
themeColor: json['theme_color'] as String?,
themePaid: (json['theme_paid'] as num?)?.toInt() ?? 0,
themePaid: (json['theme_paid'] as num?)?.toDouble() ?? 0,
refundSeconds: (json['refund_seconds'] as num?)?.toInt() ?? 0,
);
}
@@ -132,6 +134,14 @@ class ThemeColor {
}
}
/// 积分显示:整数不带小数位,小数保留到 0.01(去掉多余的 0)。
String formatPoints(double v) {
var s = v.toStringAsFixed(2);
if (s.endsWith('.00')) return s.substring(0, s.length - 3);
if (s.endsWith('0')) return s.substring(0, s.length - 1);
return s;
}
/// 人品值结果
class FortuneResult {
const FortuneResult(this.value, this.comment);