Skip to content

Commit

Permalink
feat: 增加记录本场直播时长
Browse files Browse the repository at this point in the history
  • Loading branch information
orangelckc committed Feb 14, 2023
1 parent 3cd67ed commit 15da9d8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"targets": [
"deb",
"msi",
"app"
"dmg"
],
"windows": {
"certificateThumbprint": null,
Expand Down
4 changes: 4 additions & 0 deletions src/views/Robot/message/robot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ watch(manage, (val) => {
})

const messages: string[] = [];
let liveTime = 0
let todayFans = 0;

const online = `${manage.hostName}的小管家${manage.robotName}上钟咯,给大家请安~`;
Expand Down Expand Up @@ -89,6 +90,7 @@ const onClock = (start: number) => {
// 解析后是本地的时间
const diff = dayjs().diff(dayjs(start * 1000));
const minutes = Math.floor(diff / 1000 / 60);
liveTime = minutes;

const str: string[] = [];
if (minutes % 60 === 0) {
Expand Down Expand Up @@ -283,6 +285,8 @@ watch(active, async (value) => {
}
}, 1000 * 3);
} else {
// 计算今日直播时间,增长粉丝数量
messages.push(`@${manage.hostName}今日直播时长 ${liveTime}分钟`);
messages.push(offline);
clearInterval(clockInterval);
}
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@/*": [
"src/*"
]
},
}
},
"include": [
"src/**/*.ts",
Expand All @@ -33,4 +33,4 @@
"path": "./tsconfig.node.json"
}
]
}
}

0 comments on commit 15da9d8

Please sign in to comment.