Skip to content

Let's use AI to Earn!

已经点赞收藏的状态管理

DESKTOP-EMF2SH4\Administratorb221e093cfb8
diff --git a/electron/main/plat/platforms/douyin/index.ts b/electron/main/plat/platforms/douyin/index.ts
index 37a24908..b20ee6a6 100644
--- a/electron/main/plat/platforms/douyin/index.ts
+++ b/electron/main/plat/platforms/douyin/index.ts
@@ -212,10 +212,10 @@ export class Douyin extends PlatformBase {
const v = s.aweme_info;
list.push({
dataId: v.aweme_id,
- readCount: v.note_card?.interact_info?.view_count,
- likeCount: v.note_card?.interact_info?.liked_count,
- collectCount: v.note_card?.interact_info?.collected_count,
- commentCount: v.note_card?.interact_info?.comment_count,
+ readCount: v.statistics?.digg_count,
+ likeCount: v.statistics?.digg_count,
+ collectCount: v.statistics?.collect_count,
+ commentCount: v.statistics?.comment_count,
title: v.desc,
coverUrl: v.video.cover.url_list[0] || '',
option: {
diff --git a/src/views/replyother/replyother.tsx b/src/views/replyother/replyother.tsx
index 70882a0b..8795ea12 100644
--- a/src/views/replyother/replyother.tsx
+++ b/src/views/replyother/replyother.tsx
@@ -691,7 +691,7 @@ export default function Page() {
const likePost = async (post: any) => {
try {
// 如果已经点赞,则不重复操作
- if (likedPosts[post.dataId] || post?.data?.note_card?.interact_info?.liked ) {
+ if (likedPosts[post.dataId] || post?.data?.note_card?.interact_info?.liked || post?.data?.statistics?.digg_count) {
message.info('已经点赞过了');
return;
}
@@ -741,7 +741,7 @@ export default function Page() {
const collectPost = async (post: any) => {
try {
// 如果已经收藏,则不重复操作
- if (collectedPosts[post.dataId] || post?.data?.note_card?.interact_info?.collected) {
+ if (collectedPosts[post.dataId] || post?.data?.note_card?.interact_info?.collected || post?.data?.statistics?.collect_count) {
message.info('已经收藏过了');
return;
}
@@ -1108,10 +1108,10 @@ export default function Page() {
>
<LikeOutlined
style={{
- color: (likedPosts[item.dataId] || item?.data.note_card?.interact_info?.liked)
+ color: (likedPosts[item.dataId] || item?.data.note_card?.interact_info?.liked || item?.data.statistics?.digg_count)
? '#ff4d4f'
: undefined,
- fontSize: (likedPosts[item.dataId] || item?.data.note_card?.interact_info?.liked)
+ fontSize: (likedPosts[item.dataId] || item?.data.note_card?.interact_info?.liked || item?.data.statistics?.digg_count)
? '18px'
: undefined,
}}
@@ -1138,10 +1138,10 @@ export default function Page() {
>
<StarOutlined
style={{
- color: (collectedPosts[item.dataId] || item?.data.note_card?.interact_info?.collected)
+ color: (collectedPosts[item.dataId] || item?.data.note_card?.interact_info?.collected || item?.data.statistics?.collect_count)
? '#faad14'
: undefined,
- fontSize: (collectedPosts[item.dataId] || item?.data.note_card?.interact_info?.collected)
+ fontSize: (collectedPosts[item.dataId] || item?.data.note_card?.interact_info?.collected || item?.data.statistics?.collect_count)
? '18px'
: undefined,
}}