|
| 1 | +const cookieName = '百词斩领取铜板' |
| 2 | +const cookieKey = 'cookie_tb' |
| 3 | +const shareKey = `share_key` |
| 4 | +const senku = init() |
| 5 | +const cookieVal = senku.getdata(cookieKey) |
| 6 | +const shareVal = senku.getdata(shareKey) |
| 7 | + |
| 8 | +let signinfo = {} //signinfo 对象初始化 |
| 9 | +senku.log() |
| 10 | +check() |
| 11 | +// ^https?://app\.xiaoyuan\.ccb\.com/channelManage/outbreak/addOutbreak Cookie: cookieVal |
| 12 | +function check(cb) { |
| 13 | + const url = { url: `https://group.baicizhan.com/group/apply_reward`, headers: { Cookie: cookieVal } } |
| 14 | + url.headers['Content-Type'] = `text/plain;charset=utf-8` |
| 15 | + url.headers['User-Agent'] = `Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.10(0x17000a21) NetType/4G Language/zh_CN` |
| 16 | + const key = {share_key:shareVal} |
| 17 | + url.body = JSON.stringify(key) |
| 18 | + senku.log(url.body) |
| 19 | + senku.post(url, (error, response, data) => { |
| 20 | + signinfo = JSON.parse(data) |
| 21 | + |
| 22 | + senku.log(JSON.stringify(signinfo)) |
| 23 | + |
| 24 | + const title = `${cookieName}` |
| 25 | + let subTitle = `` |
| 26 | + let detail = '' |
| 27 | + if (signinfo.code == 1) { |
| 28 | + if (signinfo.data.is_new) { |
| 29 | + subTitle += `成功` |
| 30 | + detail = `获取铜板数${signinfo.data.reward[2]}` |
| 31 | + } |
| 32 | + else { |
| 33 | + subTitle += `失败(重复签到)` |
| 34 | + } |
| 35 | + } |
| 36 | + else { |
| 37 | + detail = `状态: ${signinfo.message}` |
| 38 | + subTitle += '失败' |
| 39 | + } |
| 40 | + senku.msg(title, subTitle, detail) |
| 41 | + senku.done() |
| 42 | + }) |
| 43 | +} |
| 44 | + |
| 45 | + |
| 46 | +function init() { |
| 47 | + isSurge = () => { |
| 48 | + return undefined === this.$httpClient ? false : true |
| 49 | + } |
| 50 | + isQuanX = () => { |
| 51 | + return undefined === this.$task ? false : true |
| 52 | + } |
| 53 | + getdata = (key) => { |
| 54 | + if (isSurge()) return $persistentStore.read(key) |
| 55 | + if (isQuanX()) return $prefs.valueForKey(key) |
| 56 | + } |
| 57 | + setdata = (key, val) => { |
| 58 | + if (isSurge()) return $persistentStore.write(key, val) |
| 59 | + if (isQuanX()) return $prefs.setValueForKey(key, val) |
| 60 | + } |
| 61 | + msg = (title, subtitle, body) => { |
| 62 | + if (isSurge()) $notification.post(title, subtitle, body) |
| 63 | + if (isQuanX()) $notify(title, subtitle, body) |
| 64 | + } |
| 65 | + log = (message) => console.log(message) |
| 66 | + get = (url, cb) => { |
| 67 | + if (isSurge()) { |
| 68 | + $httpClient.get(url, cb) |
| 69 | + } |
| 70 | + if (isQuanX()) { |
| 71 | + url.method = 'GET' |
| 72 | + $task.fetch(url).then((resp) => cb(null, {}, resp.body)) |
| 73 | + } |
| 74 | + } |
| 75 | + post = (url, cb) => { |
| 76 | + if (isSurge()) { |
| 77 | + $httpClient.post(url, cb) |
| 78 | + } |
| 79 | + if (isQuanX()) { |
| 80 | + url.method = 'POST' |
| 81 | + $task.fetch(url).then((resp) => cb(null, {}, resp.body)) |
| 82 | + } |
| 83 | + } |
| 84 | + done = (value = {}) => { |
| 85 | + $done(value) |
| 86 | + } |
| 87 | + return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done } |
| 88 | +} |
0 commit comments