Skip to content

Commit

Permalink
更新[米读],阅读关闭报错
Browse files Browse the repository at this point in the history
  • Loading branch information
gideonsenku committed May 7, 2020
1 parent 8cd3bcb commit 5459326
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions midu/miduRead.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async function all() {
await readTime(headerVal, token, urlVal)
await userInfo(key)
await prizeInfo(key)
if (signinfo.prizeInfo.data.total_num) {
if (signinfo.prizeInfo && signinfo.prizeInfo.data && signinfo.prizeInfo.data.total_num) {
await prizeTask(key)
await drawPrize(key)
}
Expand Down Expand Up @@ -150,7 +150,9 @@ function drawPrize(bodyVal) {
senku.post(url, (error, response, data) => {
try {
senku.log(`🐍🐢 ${cookieName} drawPrize - response: ${JSON.stringify(response)}`)
signinfo.drawPrize = JSON.parse(data)
if (data) {
signinfo.drawPrize = JSON.parse(data)
}
resolve()
} catch (e) {
// senku.msg(cookieName, `抽奖: 失败`, `说明: ${e}`)
Expand All @@ -176,7 +178,9 @@ function prizeTask(bodyVal) {
senku.post(url, (error, response, data) => {
try {
senku.log(`🐍🐢 ${cookieName} prizeTask - response: ${JSON.stringify(response)}`)
signinfo.prizeTask = JSON.parse(data)
if (data) {
signinfo.prizeTask = JSON.parse(data)
}
resolve()
} catch (e) {
// senku.msg(cookieName, `观看视频抽奖: 失败`, `说明: ${e}`)
Expand All @@ -202,7 +206,9 @@ function prizeInfo(bodyVal) {
senku.post(url, (error, response, data) => {
try {
senku.log(`🐍🐢 ${cookieName} prizeInfo - response: ${JSON.stringify(response)}`)
signinfo.prizeInfo = JSON.parse(data)
if (data) {
signinfo.prizeInfo = JSON.parse(data)
}
resolve()
} catch (e) {
// senku.msg(cookieName, `抽奖信息: 失败`, `说明: ${e}`)
Expand Down Expand Up @@ -231,7 +237,9 @@ function readTime(header, token, urlVal) {
senku.post(url, (error, response, data) => {
try {
senku.log(`🐍🐢 ${cookieName} readTime - response: ${JSON.stringify(response)}`)
signinfo.readTime = JSON.parse(data)
if (data) {
signinfo.readTime = JSON.parse(data)
}
resolve()
} catch (e) {
// senku.msg(cookieName, `阅读时长: 失败`, `说明: ${e}`)
Expand All @@ -257,7 +265,9 @@ function userInfo(bodyVal) {
senku.post(url, (error, response, data) => {
try {
senku.log(`🐍🐢 ${cookieName} userInfo - response: ${JSON.stringify(response)}`)
signinfo.userInfo = JSON.parse(data)
if (data) {
signinfo.userInfo = JSON.parse(data)
}
resolve()
} catch (e) {
// senku.msg(cookieName, `用户信息: 失败`, `说明: ${e}`)
Expand All @@ -280,17 +290,17 @@ function showmsg() {
const total_coin = signinfo.readTime.data.total_coin
coin == 0 ? detail += `` : detail += `【阅读时长】获得${coin}💰`
readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟,该账户:${total_coin}💰` : detail += `该账户:${total_coin}💰`
} else if (signinfo.readTime.code != 0) {
} else if (signinfo.readTime && signinfo.readTime.code != 0) {
detail += `【阅读时长】错误代码${signinfo.readTime.code},错误信息${signinfo.readTime.message}`
senku.msg(cookieName + ` 用户:${name}`, subTitle, detail)
} else {
detail += '【阅读时长】失败'
senku.msg(cookieName + ` 用户:${name}`, subTitle, detail)
}

if (senku.getdata('debug') == 'true' || detail && signinfo.readTime.data.readTotalMinute % 60 == 0) {
if (senku.getdata('debug') == 'true' || detail && signinfo.readTime && signinfo.readTime.data && signinfo.readTime.data.readTotalMinute % 60 == 0) {
senku.msg(cookieName + ` 用户:${name}`, subTitle, detail)
} else if (senku.getdata('debug') == 'true' || signinfo.readTime.data.readTotalMinute % 60 == 0) {
} else if (senku.getdata('debug') == 'true' || signinfo.readTime && signinfo.readTime.data && signinfo.readTime.data.readTotalMinute % 60 == 0) {
senku.msg(cookieName + ` 用户:${name}`, '阅读结果', '时间未到')
}

Expand Down

0 comments on commit 5459326

Please sign in to comment.