📖 短故事模块
版本 PanGrowth
🔖 短故事解锁记录绑定
⚠️ 功能状态: 计划中 / 未实现
此功能当前版本暂未实现,本文档仅作功能规划参考。 如需类似功能,请参考短剧解锁记录绑定。
📋 功能说明
短故事解锁记录绑定功能旨在支持用户跨设备同步阅读记录和解锁状态。
计划功能
- 绑定解锁记录 - 将本地解锁记录上传至服务器
- 查询解锁记录 - 从服务器获取已绑定的解锁记录
- 同步解锁状态 - 跨设备同步解锁状态
- 记录管理 - 更新和删除解锁记录
🔍 当前替代方案
在正式功能实现前,可以通过以下方式管理短故事阅读状态:
1. 使用阅读进度API
import 'package:pangrowth_content/pangrowth_content.dart';
// 更新阅读进度
await PangrowthContent.updateReadProgress(
'story_123',
readDuration: 5 * 60 * 1000, // 5分钟
);
// 获取阅读历史
final history = await PangrowthContent.getStoryHistory(
page: 1,
count: 20,
);
2. 使用收藏功能
// 收藏短故事
await PangrowthContent.favoriteStory('story_123', isFavorite: true);
// 获取收藏列表
final favorites = await PangrowthContent.getFavoriteStories(
page: 1,
count: 20,
);
3. 本地存储方案
import 'package:shared_preferences/shared_preferences.dart';
class StoryProgressManager {
static const String _keyPrefix = 'story_progress_';
/// 保存阅读进度
static Future<void> saveProgress(String storyId, int chapter, double progress) async {
final prefs = await SharedPreferences.getInstance();
await prefs.setString('${_keyPrefix}$storyId', '$chapter:$progress');
}
/// 获取阅读进度
static Future<Map<String, dynamic>?> getProgress(String storyId) async {
final prefs = await SharedPreferences.getInstance();
final value = prefs.getString('${_keyPrefix}$storyId');
if (value == null) return null;
final parts = value.split(':');
return {
'chapter': int.parse(parts[0]),
'progress': double.parse(parts[1]),
};
}
}
📖 参考文档
相关功能文档
开发流程文档
如果您是开发者,计划实现此功能,请参考:
💡 实现建议
如果您需要实现短故事解锁记录绑定功能,建议参考短剧模块的实现:
API设计参考
// 参考短剧解锁绑定API设计
class PangrowthContent {
/// 生成短故事解锁记录签名
static Future<String?> generateStoryUnlockSign({
required String serverKey,
required String nonce,
required int timestamp,
Map<String, String>? payload,
}) async {
// 待实现
}
/// 绑定短故事解锁记录
static Future<Map<String, dynamic>> loginStoryUnlock({
String? params,
String? serverKey,
String? nonce,
int? timestamp,
Map<String, String>? payload,
}) async {
// 待实现
}
/// 解绑短故事解锁记录
static Future<Map<String, dynamic>> logoutStoryUnlock() async {
// 待实现
}
/// 查询短故事解锁记录绑定状态
static Future<bool> isStoryUnlockLogin() async {
// 待实现
}
}
⚠️ 注意事项
- 功能未实现: 本文档描述的API方法当前版本不存在
- 替代方案: 使用现有的阅读进度和收藏API
- 开发计划: 如需此功能,请联系开发团队确认实现计划