修改报错

This commit is contained in:
黄志军
2021-11-14 19:09:08 +08:00
parent 51a5967c4e
commit 5cde8a86fd
5 changed files with 129 additions and 73 deletions
+3 -3
View File
@@ -26,7 +26,7 @@ const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送 let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送
const helpAuthor = false; // 是否帮助作者助力,false打开通知推送,true关闭通知推送 const helpAuthor = false; // 是否帮助作者助力,false打开通知推送,true关闭通知推送
//IOS等用户直接用NobyDa的jd cookie //IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [], cookie = '', message; let cookiesArr = [], cookie = '', message = "" ;
let newShareCodes = [] let newShareCodes = []
let roleMap = { let roleMap = {
"jd_4521b375ebb5d": "锟子怪", "jd_4521b375ebb5d": "锟子怪",
@@ -41,7 +41,7 @@ let roleMap = {
"jd_4311ac0ff4456": "居子" "jd_4311ac0ff4456": "居子"
} }
let dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=d2b6042cb38f0df63e20797c002208d2710104750c18a1dc84d54106a859a3f0" let dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=d2b6042cb38f0df63e20797c002208d2710104750c18a1dc84d54106a859a3f0"
let username = ""
if ($.isNode()) { if ($.isNode()) {
@@ -92,7 +92,7 @@ const JD_API_HOST = 'https://api.m.jd.com/';
message += "----\n\n" message += "----\n\n"
} }
postToDingTalk(message) postToDingTalk(message)
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>额外领京豆</font> \n\n" message = "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>额外领京豆</font> \n\n"
for (let i = 0; i < cookiesArr.length; i++) { for (let i = 0; i < cookiesArr.length; i++) {
if (cookiesArr[i]) { if (cookiesArr[i]) {
+11 -9
View File
@@ -5,8 +5,8 @@ const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送 let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送
const randomCount = $.isNode() ? 0 : 5; const randomCount = $.isNode() ? 0 : 5;
//IOS等用户直接用NobyDa的jd cookie //IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [], cookie = '', message; let cookiesArr = [], cookie = '', message = "";
$.tuanList = []; let tuanList = [];
let roleMap = { let roleMap = {
"jd_4521b375ebb5d": "锟子怪", "jd_4521b375ebb5d": "锟子怪",
"jd_542c10c0222bc": "康子怪", "jd_542c10c0222bc": "康子怪",
@@ -20,6 +20,8 @@ let roleMap = {
"jd_4311ac0ff4456": "居子" "jd_4311ac0ff4456": "居子"
} }
let dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=d2b6042cb38f0df63e20797c002208d2710104750c18a1dc84d54106a859a3f0" let dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=d2b6042cb38f0df63e20797c002208d2710104750c18a1dc84d54106a859a3f0"
let username = ""
if ($.isNode()) { if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => { Object.keys(jdCookieNode).forEach((item) => {
@@ -70,7 +72,7 @@ const JD_API_HOST = 'https://api.m.jd.com/api';
} }
postToDingTalk(message) postToDingTalk(message)
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>赚京豆</font> \n\n" message = "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>赚京豆</font> \n\n"
that.log(`\n\n内部互助 【赚京豆(微信小程序)-瓜分京豆】活动(优先内部账号互助(需内部cookie数量大于${$.assistNum || 4}个)\n`) that.log(`\n\n内部互助 【赚京豆(微信小程序)-瓜分京豆】活动(优先内部账号互助(需内部cookie数量大于${$.assistNum || 4}个)\n`)
for (let i = 0; i < cookiesArr.length; i++) { for (let i = 0; i < cookiesArr.length; i++) {
@@ -79,11 +81,11 @@ const JD_API_HOST = 'https://api.m.jd.com/api';
cookie = cookiesArr[i]; cookie = cookiesArr[i];
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]) $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
if ($.canHelp && (cookiesArr.length > $.assistNum)) { if ($.canHelp && (cookiesArr.length > $.assistNum)) {
if ($.tuanList.length) that.log(`开始账号内部互助 赚京豆-瓜分京豆 活动,优先内部账号互助`) if (tuanList.length) that.log(`开始账号内部互助 赚京豆-瓜分京豆 活动,优先内部账号互助`)
for (let j = 0; j < $.tuanList.length; ++j) { for (let j = 0; j < tuanList.length; ++j) {
that.log(`账号 ${$.UserName} 开始给 【${$.tuanList[j]['assistedPinEncrypted']}】助力`) that.log(`账号 ${$.UserName} 开始给 【${tuanList[j]['assistedPinEncrypted']}】助力`)
message += "<font color=\'#FFA500\'>" + `账号 ${$.UserName} 开始给 【${$.tuanList[j]['assistedPinEncrypted']}】助力` + "</font> \n\n" message += "<font color=\'#FFA500\'>" + `账号 ${$.UserName} 开始给 【${tuanList[j]['assistedPinEncrypted']}】助力` + "</font> \n\n"
await helpFriendTuan($.tuanList[j]) await helpFriendTuan(tuanList[j])
if (!$.canHelp) break if (!$.canHelp) break
await $.wait(200) await $.wait(200)
} }
@@ -547,7 +549,7 @@ async function distributeBeanActivity() {
if ($.hasOpen) await getUserTuanInfo() if ($.hasOpen) await getUserTuanInfo()
} }
if ($.tuan && $.tuan.hasOwnProperty('assistedPinEncrypted') && $.assistStatus !== 3) { if ($.tuan && $.tuan.hasOwnProperty('assistedPinEncrypted') && $.assistStatus !== 3) {
$.tuanList.push($.tuan); tuanList.push($.tuan);
const code = Object.assign($.tuan, { "time": Date.now() }); const code = Object.assign($.tuan, { "time": Date.now() });
$.post({ $.post({
url: `http://go.chiang.fun/autocommit`, url: `http://go.chiang.fun/autocommit`,
+46 -44
View File
@@ -13,7 +13,7 @@ const notify = $.isNode() ? require('./sendNotify') : '';
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送 let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送
//IOS等用户直接用NobyDa的jd cookie //IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [], cookie = '', message; let cookiesArr = [], cookie = '', message = "";
const randomCount = $.isNode() ? 5 : 5; const randomCount = $.isNode() ? 5 : 5;
let cash_exchange = false;//是否消耗2元红包兑换200京豆,默认否 let cash_exchange = false;//是否消耗2元红包兑换200京豆,默认否
let shareCodes = []; //助力码 let shareCodes = []; //助力码
@@ -28,8 +28,10 @@ let roleMap = {
"jd_4333d5dc1ac5f": "舒楠子", "jd_4333d5dc1ac5f": "舒楠子",
"jd_66ea783827d30": "军子", "jd_66ea783827d30": "军子",
"jd_4311ac0ff4456": "居子" "jd_4311ac0ff4456": "居子"
} }
let dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=d2b6042cb38f0df63e20797c002208d2710104750c18a1dc84d54106a859a3f0" let dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=d2b6042cb38f0df63e20797c002208d2710104750c18a1dc84d54106a859a3f0"
let username = ""
if ($.isNode()) { if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => { Object.keys(jdCookieNode).forEach((item) => {
@@ -58,9 +60,9 @@ let allMessage = '';
if (roleMap[username] != undefined) { if (roleMap[username] != undefined) {
username = roleMap[username] username = roleMap[username]
} }
//加上名称 //加上名称
message = message + "<font color=\'#778899\' size=2>【羊毛姐妹】<font color=\'#FFA500\' size=3>" + username + " </font> </font> \n\n " message = message + "<font color=\'#778899\' size=2>【羊毛姐妹】<font color=\'#FFA500\' size=3>" + username + " </font> </font> \n\n "
console.log(`\n******开始【京东账号${$.index}${$.nickName || $.UserName}*********\n`); console.log(`\n******开始【京东账号${$.index}${$.nickName || $.UserName}*********\n`);
if (!$.isLogin) { if (!$.isLogin) {
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, { "open-url": "https://bean.m.jd.com/bean/signIndex.action" }); $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, { "open-url": "https://bean.m.jd.com/bean/signIndex.action" });
@@ -75,7 +77,7 @@ let allMessage = '';
} }
postToDingTalk(message) postToDingTalk(message)
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>签到领现金</font> \n\n" message = "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>签到领现金</font> \n\n"
for (let i = 0; i < cookiesArr.length; i++) { for (let i = 0; i < cookiesArr.length; i++) {
if (cookiesArr[i]) { if (cookiesArr[i]) {
@@ -128,7 +130,7 @@ async function appindex(info = false) {
if (message) { if (message) {
allMessage += `京东账号${$.index}${$.nickName}\n${message}${$.index !== cookiesArr.length ? '\n\n' : ''}`; allMessage += `京东账号${$.index}${$.nickName}\n${message}${$.index !== cookiesArr.length ? '\n\n' : ''}`;
} }
message += "<font color=\'#FFA500\'>" + `当前现金:${data.data.result.totalMoney}`+ "</font> \n\n" message += "<font color=\'#FFA500\'>" + `当前现金:${data.data.result.totalMoney}` + "</font> \n\n"
console.log(`\n\n当前现金:${data.data.result.totalMoney}`); console.log(`\n\n当前现金:${data.data.result.totalMoney}`);
return return
} }
@@ -138,8 +140,8 @@ async function appindex(info = false) {
let helpInfo = { let helpInfo = {
'inviteCode': data.data.result.invitedCode, 'inviteCode': data.data.result.invitedCode,
'shareDate': data.data.result.shareDate 'shareDate': data.data.result.shareDate
} }
shareCodes = shareCodes.push(helpInfo) //添加我的助力码 shareCodes = shareCodes.push(helpInfo) //添加我的助力码
for (let task of data.data.result.taskInfos) { for (let task of data.data.result.taskInfos) {
if (task.type === 4) { if (task.type === 4) {
@@ -232,7 +234,7 @@ async function helpFriends() {
$.canHelp = true $.canHelp = true
for (let code of shareCodes) { for (let code of shareCodes) {
console.log(`去帮助好友${code['inviteCode']}`) console.log(`去帮助好友${code['inviteCode']}`)
message += "<font color=\'#FFA500\'>" + `去帮助好友${code['inviteCode']}`+ "</font> \n\n" message += "<font color=\'#FFA500\'>" + `去帮助好友${code['inviteCode']}` + "</font> \n\n"
await helpFriend(code) await helpFriend(code)
if (!$.canHelp) break if (!$.canHelp) break
await $.wait(1000) await $.wait(1000)
@@ -251,7 +253,7 @@ function helpFriend(helpInfo) {
data = JSON.parse(data); data = JSON.parse(data);
if (data.code === 0 && data.data.bizCode === 0) { if (data.code === 0 && data.data.bizCode === 0) {
message += "<font color=\'#FFA500\'>" + `助力成功,获得${data.data.result.cashStr}`+ "</font> \n\n" message += "<font color=\'#FFA500\'>" + `助力成功,获得${data.data.result.cashStr}` + "</font> \n\n"
console.log(`助力成功,获得${data.data.result.cashStr}`) console.log(`助力成功,获得${data.data.result.cashStr}`)
// console.log(data.data.result.taskInfos) // console.log(data.data.result.taskInfos)
} else if (data.data.bizCode === 207) { } else if (data.data.bizCode === 207) {
@@ -340,7 +342,7 @@ function getReward(source = 1) {
data = JSON.parse(data); data = JSON.parse(data);
if (data.code === 0 && data.data.bizCode === 0) { if (data.code === 0 && data.data.bizCode === 0) {
console.log(`领奖成功,${data.data.result.shareRewardTip}${data.data.result.shareRewardAmount}`) console.log(`领奖成功,${data.data.result.shareRewardTip}${data.data.result.shareRewardAmount}`)
message += "<font color=\'#FFA500\'>" +`领奖成功,${data.data.result.shareRewardTip}${data.data.result.shareRewardAmount}元】\n`+ "</font> \n\n" message += "<font color=\'#FFA500\'>" + `领奖成功,${data.data.result.shareRewardTip}${data.data.result.shareRewardAmount}元】\n` + "</font> \n\n"
// console.log(data.data.result.taskInfos) // console.log(data.data.result.taskInfos)
} else { } else {
@@ -651,44 +653,44 @@ function postToDingTalk(messgae) {
// that.log(messgae) // that.log(messgae)
const body = { const body = {
"msgtype": "markdown", "msgtype": "markdown",
"markdown": { "markdown": {
"title": "签到领现金", "title": "签到领现金",
"text": message1 "text": message1
}, },
"at": { "at": {
"atMobiles": [], "atMobiles": [],
"isAtAll": false "isAtAll": false
} }
} }
$.post(toDingtalk(dingtalk, JSON.stringify(body)), (data, status, xhr) => { $.post(toDingtalk(dingtalk, JSON.stringify(body)), (data, status, xhr) => {
try { try {
that.log(resp) that.log(resp)
that.log(data) that.log(data)
if (err) { if (err) {
that.log(JSON.stringify(err)); that.log(JSON.stringify(err));
$.logErr(err); $.logErr(err);
} else { } else {
if (safeGet(data)) { if (safeGet(data)) {
$.duckRes = JSON.parse(data); $.duckRes = JSON.parse(data);
} }
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve();
} }
} catch (e) {
$.logErr(e, resp)
} finally {
resolve();
}
}, "json") }, "json")
} }
function toDingtalk(urlmain, bodyMain) { function toDingtalk(urlmain, bodyMain) {
return { return {
url: urlmain, url: urlmain,
body: bodyMain, body: bodyMain,
headers: { 'Content-Type': 'application/json;charset=utf-8' }, headers: { 'Content-Type': 'application/json;charset=utf-8' },
timeout: 10000, timeout: 10000,
} }
} }
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -45,7 +45,7 @@ let roleMap = {
"jd_4311ac0ff4456": "居子" "jd_4311ac0ff4456": "居子"
} }
let dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=d2b6042cb38f0df63e20797c002208d2710104750c18a1dc84d54106a859a3f0" let dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=d2b6042cb38f0df63e20797c002208d2710104750c18a1dc84d54106a859a3f0"
let username = ""
//IOS等用户直接用NobyDa的jd cookie //IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [], cookie = '', message = '', allMessage = ''; let cookiesArr = [], cookie = '', message = '', allMessage = '';
@@ -116,7 +116,7 @@ const JD_API_HOST = 'https://api.m.jd.com/client.action';
} }
postToDingTalk(message) postToDingTalk(message)
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>摇京豆</font> \n\n" message = "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>摇京豆</font> \n\n"
//开始助力 //开始助力
for (let v = 0; v < cookiesArr.length; v++) { for (let v = 0; v < cookiesArr.length; v++) {