Skip to content

Commit

Permalink
fix: 赠送失败时自动移交给下一个直播间, Fixed #6
Browse files Browse the repository at this point in the history
  • Loading branch information
Curtion committed May 23, 2024
1 parent 6269dbe commit 2ca5a6d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/renderer/run/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ async function start() {
}, 10000)
return
}
let faildNumber = 0
for (const item of Object.values(Jobs)) {
try {
if (item.count === 0) {
Expand All @@ -103,14 +104,21 @@ async function start() {
text.value = `即将赠送${item.roomId}房间${item.count}个荧光棒`
const did = await getDid(item.roomId.toString())
args.did = did
item.count = item?.count ?? 0 + faildNumber
await sendGift(args, item)
faildNumber = 0
text.value = `赠送${item.roomId}房间${item.count}个荧光棒成功`
} catch (error) {
text.value = `${item.roomId}房间赠送失败${error}`
faildNumber += item?.count ?? 0
text.value = `${item.roomId}房间赠送失败${error}, ${item.count}个荧光棒自动移交给下一个房间`
}
await sleep(2000)
}
text.value = '任务执行完毕'
if (faildNumber > 0) {
text.value = `任务执行完毕, 有${faildNumber}个荧光棒未赠送成功`
} else {
text.value = '任务执行完毕'
}
setTimeout(async () => {
runing.value = false
if (close) {
Expand Down

0 comments on commit 2ca5a6d

Please sign in to comment.