Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
shufflewzc committed Oct 8, 2021
1 parent 1d9faae commit 78cad96
Show file tree
Hide file tree
Showing 3 changed files with 862 additions and 2,307 deletions.
3,078 changes: 785 additions & 2,293 deletions jd_bean_change.js

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions jd_gold_creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ async function main() {
try {
await goldCreatorTab();//获取顶部主题
await getDetail();
await goldCreatorPublish();
await showMsg();
} catch (e) {
$.logErr(e)
Expand Down Expand Up @@ -249,6 +250,33 @@ function goldCreatorDoTask(body) {
})
})
}
function goldCreatorPublish() {
return new Promise(resolve => {
$.get(taskUrl('goldCreatorPublish'), async (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} goldCreatorPublish API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data)
if (data.code === '0') {
if (data.result.subCode === '0') {
console.log(data.result.lotteryResult.lotteryCode === '0' ? `揭榜成功:获得${data.result.lotteryResult.lotteryScore}京豆` : `揭榜成功:获得空气~`)
}
} else {
console.log(`揭榜失败:${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve();
}
})
})
}
function taskUrl(function_id, body = {}) {
return {
url: `${JD_API_HOST}?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=content_ecology&clientVersion=10.0.0&client=wh5&eufv=false&uuid=`,
Expand Down
63 changes: 49 additions & 14 deletions jd_sendBeans.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const $ = new Env('送豆得豆');
const notify = $.isNode() ? require('./sendNotify') : '';
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
//IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [];
let cookiesArr = [], isLoginInfo = {};
if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => {
cookiesArr.push(jdCookieNode[item])
Expand All @@ -29,7 +29,6 @@ if ($.isNode()) {
cookiesArr = [$.getdata("CookieJD"), $.getdata("CookieJD2"), ...$.toObj($.getdata("CookiesJD") || "[]").map((item) => item.cookie)].filter((item) => !!item);
}
!(async () => {
$.isLoginInfo = {};
if (!cookiesArr[0]) {
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
return;
Expand All @@ -42,8 +41,15 @@ if ($.isNode()) {
$.UserName = decodeURIComponent($.cookie.match(/pt_pin=([^; ]+)(?=;?)/) && $.cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
$.isLogin = true;
$.nickName = ''
await TotalBean();
if (!$.isLogin) continue
if (isLoginInfo[$.UserName] === false) {

} else {
if (!isLoginInfo[$.UserName]) {
await TotalBean();
isLoginInfo[$.UserName] = $.isLogin
}
}
if (!isLoginInfo[$.UserName]) continue
await getActivityInfo();
}
if ($.activityId === '') {
Expand All @@ -60,9 +66,16 @@ if ($.isNode()) {
$.index = i + 1;
$.isLogin = true;
$.nickName = '';
await TotalBean();
console.log(`\n*****开始【京东账号${$.index}${$.nickName || $.UserName}*****\n`);
if (!$.isLogin) continue
if (isLoginInfo[$.UserName] === false) {

} else {
if (!isLoginInfo[$.UserName]) {
await TotalBean();
isLoginInfo[$.UserName] = $.isLogin
}
}
if (!isLoginInfo[$.UserName]) continue
await openTuan();
}
console.log('\n开团信息\n'+JSON.stringify($.openTuanList));
Expand All @@ -73,11 +86,18 @@ if ($.isNode()) {
$.UserName = decodeURIComponent($.cookie.match(/pt_pin=([^; ]+)(?=;?)/) && $.cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
$.index = i + 1;
$.isLogin = true;
await TotalBean();
$.isLoginInfo[$.UserName] = $.isLogin;
console.log(`\n*****开始【京东账号${$.index}${$.nickName || $.UserName}*****\n`);
if (!$.isLogin) {
if (isLoginInfo[$.UserName] === false) {

} else {
if (!isLoginInfo[$.UserName]) {
await TotalBean();
isLoginInfo[$.UserName] = $.isLogin
}
}
if (!isLoginInfo[$.UserName]) {
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});

if ($.isNode()) {
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
}
Expand All @@ -91,8 +111,16 @@ if ($.isNode()) {
$.UserName = decodeURIComponent($.cookie.match(/pt_pin=([^; ]+)(?=;?)/) && $.cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
$.index = i + 1;
$.isLogin = true;
console.log(`\n*****开始【京东账号${$.index}${$.UserName}*****\n`);
if (!$.isLoginInfo[$.UserName]) continue
console.log(`\n*****开始【京东账号${$.index}${$.nickName || $.UserName}*****\n`);
if (isLoginInfo[$.UserName] === false) {

} else {
if (!isLoginInfo[$.UserName]) {
await TotalBean();
isLoginInfo[$.UserName] = $.isLogin
}
}
if (!isLoginInfo[$.UserName]) continue
await rewardMain();
}
for (let i = 0; i < cookiesArr.length; i++) {
Expand All @@ -101,9 +129,16 @@ if ($.isNode()) {
$.index = i + 1;
$.isLogin = true;
$.nickName = ''
await TotalBean();
console.log(`\n*****开始【京东账号${$.index}${$.UserName}*****\n`);
if (!$.isLogin) continue
console.log(`\n*****开始【京东账号${$.index}${$.nickName || $.UserName}*****\n`);
if (isLoginInfo[$.UserName] === false) {

} else {
if (!isLoginInfo[$.UserName]) {
await TotalBean();
isLoginInfo[$.UserName] = $.isLogin
}
}
if (!isLoginInfo[$.UserName]) continue
await myReward()
}
})().catch((e) => {$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')}).finally(() => {$.done();});
Expand Down

0 comments on commit 78cad96

Please sign in to comment.