Skip to content

Commit

Permalink
更新[米读],关闭报错通知
Browse files Browse the repository at this point in the history
  • Loading branch information
gideonsenku committed May 5, 2020
1 parent afb4d99 commit 8cd3bcb
Showing 1 changed file with 104 additions and 107 deletions.
211 changes: 104 additions & 107 deletions midu/miduRead.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,56 @@ const cookieName = '米读阅读时长'

const senku = init()



debug ? senku.setdata('true', 'debug') : senku.setdata('false', 'debug')
bind ? '' : senku.setdata('', 'bind');
if (DeleteCookie) {
const one = senku.getdata('tokenMidu_read')
const two = senku.getdata('tokenMidu_sign')
const three = senku.getdata('tokenMidu_read2')
const four = senku.getdata('tokenMidu_sign2')
if (DeleteCookieAll) {
if (one || two || three || four) {
senku.setdata("", 'senku_signbody_midu')
senku.setdata("", 'senku_signbody_midu2')
senku.setdata("", 'senku_readTimebody_midu')
senku.setdata("", 'senku_readTimebody_midu2')
senku.setdata("", 'senku_readTimeheader_midu')
senku.setdata("", 'senku_readTimeheader_midu2')
senku.setdata("", "tokenMidu_read")
senku.setdata("", "tokenMidu_read2")
senku.setdata("", "tokenMidu_sign")
senku.setdata("", "tokenMidu_sign2")
senku.msg("米读 Cookie清除成功 !", "", '请手动关闭脚本内"DeleteCookie"选项')
} else {
senku.msg("米读 无可清除的Cookie !", "", '请手动关闭脚本内"DeleteCookie"选项')
}
} else if (DeleteCookieOne) {
if (one || two) {
senku.setdata("", 'senku_signbody_midu')
senku.setdata("", 'senku_readTimebody_midu')
senku.setdata("", 'senku_readTimeheader_midu')
senku.setdata("", "tokenMidu_read")
senku.setdata("", "tokenMidu_sign")
senku.msg("米读 Cookie清除成功 !", "清除账户一选项", '请手动关闭脚本内"DeleteCookie"选项')
} else {
senku.msg("米读 无可清除的Cookie !", "清除账户一选项", '请手动关闭脚本内"DeleteCookie"选项')
}
} else if (DeleteCookieTwo) {
if (three || four) {
senku.setdata("", 'senku_signbody_midu2')
senku.setdata("", 'senku_readTimebody_midu2')
senku.setdata("", 'senku_readTimeheader_midu2')
senku.setdata("", "tokenMidu_read2")
senku.setdata("", "tokenMidu_sign2")
senku.msg("米读 Cookie清除成功 !", "清除账户二选项", '请手动关闭脚本内"DeleteCookie"选项')
} else {
senku.msg("米读 无可清除的Cookie !", "清除账户二选项", '请手动关闭脚本内"DeleteCookie"选项')
}
} else {
senku.msg("米读 清除Cookie !", "未选取任何选项", '请手动关闭脚本内"DeleteCookie"选项')
}
}


function initial() {
signinfo = {
Expand All @@ -51,26 +97,32 @@ function initial() {
all()
}
senku.done()
})().catch((e) => senku.log(`❌ ${cookieName} 签到失败: ${e}`), senku.done())
})()


async function all() {
senku.log(`🍎${readTimeheaderVal}`)
const headerVal = readTimeheaderVal
const urlVal = readTimebodyVal
const key = signbodyVal
const token = tokenVal
initial()
try {
senku.log(`🍎${readTimeheaderVal}`)
const headerVal = readTimeheaderVal
const urlVal = readTimebodyVal
const key = signbodyVal
const token = tokenVal
initial()

await readTime(headerVal, token, urlVal)
await userInfo(key)
await prizeInfo(key)
if (signinfo.prizeInfo.data.total_num) {
await prizeTask(key)
await drawPrize(key)
await readTime(headerVal, token, urlVal)
await userInfo(key)
await prizeInfo(key)
if (signinfo.prizeInfo.data.total_num) {
await prizeTask(key)
await drawPrize(key)
}
await showmsg()
senku.done()
} catch (e) {
senku.msg(cookieName, `失败`, `说明: ${e}`)
senku.log(`❌ ${cookieName} - 失败: ${e}`)
senku.done()
}
await showmsg()
senku.done()
}

function double() {
Expand Down Expand Up @@ -101,7 +153,7 @@ function drawPrize(bodyVal) {
signinfo.drawPrize = JSON.parse(data)
resolve()
} catch (e) {
senku.msg(cookieName, `抽奖: 失败`, `说明: ${e}`)
// senku.msg(cookieName, `抽奖: 失败`, `说明: ${e}`)
senku.log(`❌ ${cookieName} drawPrize - 抽奖失败: ${e}`)
senku.log(`❌ ${cookieName} drawPrize - response: ${JSON.stringify(response)}`)
resolve()
Expand All @@ -127,7 +179,7 @@ function prizeTask(bodyVal) {
signinfo.prizeTask = JSON.parse(data)
resolve()
} catch (e) {
senku.msg(cookieName, `观看视频抽奖: 失败`, `说明: ${e}`)
// senku.msg(cookieName, `观看视频抽奖: 失败`, `说明: ${e}`)
senku.log(`❌ ${cookieName} prizeTask - 观看视频抽奖失败: ${e}`)
senku.log(`❌ ${cookieName} prizeTask - response: ${JSON.stringify(response)}`)
resolve()
Expand All @@ -153,7 +205,7 @@ function prizeInfo(bodyVal) {
signinfo.prizeInfo = JSON.parse(data)
resolve()
} catch (e) {
senku.msg(cookieName, `抽奖信息: 失败`, `说明: ${e}`)
// senku.msg(cookieName, `抽奖信息: 失败`, `说明: ${e}`)
senku.log(`❌ ${cookieName} prizeInfo - 抽奖信息失败: ${e}`)
senku.log(`❌ ${cookieName} prizeInfo - response: ${JSON.stringify(response)}`)
resolve()
Expand Down Expand Up @@ -182,7 +234,7 @@ function readTime(header, token, urlVal) {
signinfo.readTime = JSON.parse(data)
resolve()
} catch (e) {
senku.msg(cookieName, `阅读时长: 失败`, `说明: ${e}`)
// senku.msg(cookieName, `阅读时长: 失败`, `说明: ${e}`)
senku.log(`❌ ${cookieName} readTime - 阅读时长失败: ${e}`)
senku.log(`❌ ${cookieName} readTime - response: ${JSON.stringify(response)}`)
resolve()
Expand All @@ -208,7 +260,7 @@ function userInfo(bodyVal) {
signinfo.userInfo = JSON.parse(data)
resolve()
} catch (e) {
senku.msg(cookieName, `用户信息: 失败`, `说明: ${e}`)
// senku.msg(cookieName, `用户信息: 失败`, `说明: ${e}`)
senku.log(`❌ ${cookieName} userInfo - 用户信息失败: ${e}`)
senku.log(`❌ ${cookieName} userInfo - response: ${JSON.stringify(response)}`)
resolve()
Expand All @@ -219,99 +271,44 @@ function userInfo(bodyVal) {

function showmsg() {
return new Promise((resolve, reject) => {
try {
let subTitle = ''
let detail = ''
const name = signinfo.userInfo.data.nickname ? signinfo.userInfo.data.nickname : `未设置昵称`
if (signinfo.readTime && signinfo.readTime.code == 0) {
const coin = signinfo.readTime.data.coin
const readTotalMinute = signinfo.readTime.data.readTotalMinute
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) {
detail += `【阅读时长】错误代码${signinfo.readTime.code},错误信息${signinfo.readTime.message}`
senku.msg(cookieName + ` 用户:${name}`, subTitle, detail)
} else {
detail += '【阅读时长】失败'
senku.msg(cookieName + ` 用户:${name}`, subTitle, detail)
}
let subTitle = ''
let detail = ''
const name = signinfo.userInfo.data.nickname ? signinfo.userInfo.data.nickname : `未设置昵称`
if (signinfo.readTime && signinfo.readTime.code == 0) {
const coin = signinfo.readTime.data.coin
const readTotalMinute = signinfo.readTime.data.readTotalMinute
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) {
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) {
senku.msg(cookieName + ` 用户:${name}`, subTitle, detail)
} else if (senku.getdata('debug') == 'true' || signinfo.readTime.data.readTotalMinute % 60 == 0) {
senku.msg(cookieName + ` 用户:${name}`, '阅读结果', '时间未到')
}
if (senku.getdata('debug') == 'true' || detail && signinfo.readTime.data.readTotalMinute % 60 == 0) {
senku.msg(cookieName + ` 用户:${name}`, subTitle, detail)
} else if (senku.getdata('debug') == 'true' || signinfo.readTime.data.readTotalMinute % 60 == 0) {
senku.msg(cookieName + ` 用户:${name}`, '阅读结果', '时间未到')
}

// 大转盘抽手机
if (signinfo.drawPrize) {
if (signinfo.drawPrize.code == 0) {
drawPrize.data.index >= 0 ? detail += `【转盘奖励】本次${drawPrize.data.title}\n` : detail += ``
} else {
detail += `【转盘奖励】无次数抽奖`
}
senku.msg(cookieName + ` 用户:${name}`, subTitle, detail)
// 大转盘抽手机
if (signinfo.drawPrize) {
if (signinfo.drawPrize.code == 0) {
drawPrize.data.index >= 0 ? detail += `【转盘奖励】本次${drawPrize.data.title}\n` : detail += ``
} else {
detail += `【转盘奖励】无次数抽奖`
}
if (DualAccount) double()
resolve()
} catch (e) {
senku.msg(cookieName, `通知信息: 失败`, `说明: ${e}`)
senku.log(`❌ ${cookieName} readTime - 通知信息失败: ${e}`)
resolve()
senku.msg(cookieName + ` 用户:${name}`, subTitle, detail)
}
if (DualAccount) double()
resolve()
})
}


if (DeleteCookie) {
const one = senku.getdata('tokenMidu_read')
const two = senku.getdata('tokenMidu_sign')
const three = senku.getdata('tokenMidu_read2')
const four = senku.getdata('tokenMidu_sign2')
if (DeleteCookieAll) {
if (one || two || three || four) {
senku.setdata("", 'senku_signbody_midu')
senku.setdata("", 'senku_signbody_midu2')
senku.setdata("", 'senku_readTimebody_midu')
senku.setdata("", 'senku_readTimebody_midu2')
senku.setdata("", 'senku_readTimeheader_midu')
senku.setdata("", 'senku_readTimeheader_midu2')
senku.setdata("", "tokenMidu_read")
senku.setdata("", "tokenMidu_read2")
senku.setdata("", "tokenMidu_sign")
senku.setdata("", "tokenMidu_sign2")
senku.msg("米读 Cookie清除成功 !", "", '请手动关闭脚本内"DeleteCookie"选项')
} else {
senku.msg("米读 无可清除的Cookie !", "", '请手动关闭脚本内"DeleteCookie"选项')
}
} else if (DeleteCookieOne) {
if (one || two) {
senku.setdata("", 'senku_signbody_midu')
senku.setdata("", 'senku_readTimebody_midu')
senku.setdata("", 'senku_readTimeheader_midu')
senku.setdata("", "tokenMidu_read")
senku.setdata("", "tokenMidu_sign")
senku.msg("米读 Cookie清除成功 !", "清除账户一选项", '请手动关闭脚本内"DeleteCookie"选项')
} else {
senku.msg("米读 无可清除的Cookie !", "清除账户一选项", '请手动关闭脚本内"DeleteCookie"选项')
}
} else if (DeleteCookieTwo) {
if (three || four) {
senku.setdata("", 'senku_signbody_midu2')
senku.setdata("", 'senku_readTimebody_midu2')
senku.setdata("", 'senku_readTimeheader_midu2')
senku.setdata("", "tokenMidu_read2")
senku.setdata("", "tokenMidu_sign2")
senku.msg("米读 Cookie清除成功 !", "清除账户二选项", '请手动关闭脚本内"DeleteCookie"选项')
} else {
senku.msg("米读 无可清除的Cookie !", "清除账户二选项", '请手动关闭脚本内"DeleteCookie"选项')
}
} else {
senku.msg("米读 清除Cookie !", "未选取任何选项", '请手动关闭脚本内"DeleteCookie"选项')
}
}


function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
Expand Down

0 comments on commit 8cd3bcb

Please sign in to comment.