diff --git a/src/components/userScripts/tus-mission.vue b/src/components/userScripts/tus-mission.vue index b7a32088..3d0e19c5 100644 --- a/src/components/userScripts/tus-mission.vue +++ b/src/components/userScripts/tus-mission.vue @@ -226,7 +226,7 @@ async function tryAuto(skip: boolean = false): Promise { } viewCnt++; if (likeCnt < 5) { - const isLike = detailResp.self_operation.upvote_type === 1; + const isLike = (detailResp.self_operation?.upvote_type ?? 0) > 0; if (isLike) { await TGLogger.Script(`[米游币任务]帖子${post.post.post_id}已点赞,跳过`); continue; diff --git a/src/types/BBS/Post.d.ts b/src/types/BBS/Post.d.ts index 49ac64fd..6d142e0f 100644 --- a/src/types/BBS/Post.d.ts +++ b/src/types/BBS/Post.d.ts @@ -1,6 +1,6 @@ /** * 帖子类型定义文件 - * @since Beta v0.8.6 + * @since Beta v0.9.8 */ declare namespace TGApp.BBS.Post { @@ -124,7 +124,7 @@ declare namespace TGApp.BBS.Post { /** * 帖子数据 - * @since Beta v0.7.2 + * @since Beta v0.9.8 */ type FullData = { /** 帖子信息 */ @@ -136,7 +136,7 @@ declare namespace TGApp.BBS.Post { /** 发帖人,可能为 null */ user: User | null; /** 当前用户操作 */ - self_operation: TGApp.BBS.User.SelfOperation; + self_operation: TGApp.BBS.User.SelfOperation | null; /** 帖子统计,可能为 null */ stat: Stat | null; /** 帮助系统,可能为 null */ diff --git a/src/views/t-post.vue b/src/views/t-post.vue index 3a0ba85c..0b637d4d 100644 --- a/src/views/t-post.vue +++ b/src/views/t-post.vue @@ -245,7 +245,7 @@ onMounted(async () => { } postData.value = resp; console.log(resp); - isLike.value = postData.value.self_operation.upvote_type !== 0; + isLike.value = (postData.value.self_operation?.upvote_type ?? 0) > 0; await showLoading.update("正在渲染数据"); renderPost.value = await getRenderPost(postData.value); await webviewWindow