feat: 游玩记录支持区分原故事和AI草稿,已下架草稿显示标签
This commit is contained in:
@@ -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 || []
|
||||
|
||||
Reference in New Issue
Block a user