feat: 游玩记录支持区分原故事和AI草稿,已下架草稿显示标签

This commit is contained in:
wangwuww111
2026-03-13 12:28:42 +08:00
parent 411110ce0c
commit 4a69bf2711
8 changed files with 449 additions and 99 deletions

View File

@@ -203,6 +203,29 @@ export default class UserManager {
});
}
/**
* 收藏草稿
*/
async collectDraft(draftId, isCollected) {
if (!this.isLoggedIn) return;
await put(`/drafts/${draftId}/collect`, null, {
params: { userId: this.userId, isCollected }
});
}
/**
* 获取草稿收藏状态
*/
async getDraftCollectStatus(draftId) {
if (!this.isLoggedIn) return false;
try {
const res = await get(`/drafts/${draftId}/collect-status`, { userId: this.userId });
return res?.isCollected || false;
} catch (e) {
return false;
}
}
/**
* 获取收藏列表
*/
@@ -323,12 +346,13 @@ export default class UserManager {
/**
* 保存游玩记录
*/
async savePlayRecord(storyId, endingName, endingType, pathHistory) {
async savePlayRecord(storyId, endingName, endingType, pathHistory, draftId = null) {
if (!this.isLoggedIn) return null;
try {
return await post('/user/play-record', {
userId: this.userId,
storyId,
draftId, // AI草稿ID原故事为null
endingName,
endingType: endingType || '',
pathHistory: pathHistory || []