Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
indextank committed Jan 26, 2022
1 parent a97dc7e commit 3c4c74a
Show file tree
Hide file tree
Showing 53 changed files with 4,162 additions and 2,782 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ __pycache__/
# C extensions
*.so

/node_modules/
/box.dat
/CookieSet.json
/jdCookie.js
/JD_DailyBonus.js

# Distribution / packaging
.Python
build/
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
155 changes: 95 additions & 60 deletions backUp/jd_city.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
城城领现金
首个帐号助力作者池子在最后
其余帐号优先助力池子,请入群上车!
其余帐号优先向前内部互助
有助力码环境变量则助力码在最前
活动时间:2021-05-25到2021-06-03
更新时间:2021-05-24 09:55
Expand All @@ -27,7 +28,7 @@ const notify = $.isNode() ? require('./sendNotify') : '';
//Node.js用户请在jdCookie.js处填写京东ck;
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
//自动抽奖 ,环境变量 JD_CITY_EXCHANGE
let exchangeFlag = $.getdata('jdJxdExchange') || !!0;//是否开启自动抽奖,建议活动快结束开启,默认关闭
let exchangeFlag = false;//是否开启自动抽奖,建议活动快结束开启,默认关闭
//IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [], cookie = '', message;

Expand All @@ -40,27 +41,33 @@ if ($.isNode()) {
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
}
const JD_API_HOST = 'https://api.m.jd.com/client.action';
// euper
const author_codes = ['GIDgweutQQ-jY4KeFdw00h0LUwjTtcXdPH1u0d2X7GT8KLXchhcL', 'RtGKqr7hJE3LBvHkSa5RmkZkfOhGf-0tHT9cjqiljmOeI5uJ', 'QNi0luSjDUbvfs_WW41tkk7lRKAT5wN56ANK', 'RtGKirftHXzyC_rBUaZPmtIAJSpwjsU8A-wgzY-4JoT-8av_', 'RtGKz72sRV72fIOfE9dmhLFQgwCq-RcrVMvbEvdiHldCcbUk6g'].sort(() => 0.5 - Math.random())
let author_codes = [].sort(() => 0.5 - Math.random())
const self_code = []
let pool = []
!(async () => {
console.log('内部互助没奖励了吧应该. 城城现在改为优先助力池子!(作者只吃第一个CK,其余池子!) 请查看群内频道通知!,5s后开始!')
console.log('内部互助没奖励了吧应该. 城城12号晚改为优先助力池子!(作者只有一个码,其余池子!) 还需要内部互助请设置值环境变量 CT_POOL 为 false,5s后开始!')
await $.wait(5000)
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;
}
await requireConfig();
if (process.env.JD_CITY_EXCHANGE) {
exchangeFlag = process.env.JD_CITY_EXCHANGE == 'true';
}
if (exchangeFlag) {
console.log(`脚本自动抽奖`)
} else {
console.log(`脚本不会自动抽奖,建议活动快结束开启,默认关闭`)
console.log(`脚本不会自动抽奖,设置JD_CITY_EXCHANGE为true,默认关闭`)
}
if (process.env.CT_R != 'false') {
cookiesArr = cookiesArr.sort(() => 0.5 - Math.random())
console.log('CK顺序打乱!用来随机内部互助!,如需关闭CT_R为false')
}
let res = await getAuthorShareCode('https://raw.githubusercontent.com/indextank/myJDS/master/shareCodes/city.json')
if (res) {
author_codes = res.sort(() => 0.5 - Math.random())
}
for (let i = 0; i < cookiesArr.length; i++) {
if (cookiesArr[i]) {
cookie = cookiesArr[i];
Expand Down Expand Up @@ -106,10 +113,11 @@ let pool = []
await $.wait(1500)
}
await getInviteInfo();//雇佣
if (exchangeFlag || new Date().getDate() >= 30) {
if (exchangeFlag || new Date().getDate() >= 18) {
console.log('抽奖最多连续抽10次')
const res = await city_lotteryAward();//抽奖
if (res && res > 0) {
for (let i = 0; i < new Array(res).fill('').length; i++) {
for (let i = 0; i < Math.min(new Array(res).fill('').length,10); i++) {
await $.wait(1000)
await city_lotteryAward();//抽奖
}
Expand All @@ -126,6 +134,27 @@ let pool = []
$.done();
})

function getAuthorShareCode(url) {
return new Promise(async resolve => {
const options = {
url: `${url}?${new Date()}`, "timeout": 10000, headers: {
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/87.0.4280.88"
}
};
$.get(options, async (err, resp, data) => {
try {
resolve(JSON.parse(data))
} catch (e) {
// $.logErr(e, resp)
} finally {
resolve();
}
})
await $.wait(10000)
resolve();
})
}

function taskPostUrl(functionId,body) {
return {
url: `${JD_API_HOST}`,
Expand All @@ -142,9 +171,10 @@ function taskPostUrl(functionId,body) {
}
}
function getInfo(inviteId, flag = false) {
let body = {"lbsCity":"19","realLbsCity":"1601","inviteId":inviteId,"headImg":"","userName":""}
let body = {"lbsCity":"16","realLbsCity":"1315","inviteId":inviteId,"headImg":"","userName":"","taskChannel":"1"}
return new Promise((resolve) => {
$.post(taskPostUrl("city_getHomeData",body), async (err, resp, data) => {
$.post(taskPostUrl("city_getHomeDatav1",body), async (err, resp, data) => {
// console.debug(data)
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
Expand All @@ -162,15 +192,25 @@ function getInfo(inviteId, flag = false) {
self_code.push(code)
}
}
if (data.data && data['data']['bizCode'] === 0) {
for(let vo of data.data.result && data.data.result.mainInfos || []){
if (vo && vo.remaingAssistNum === 0 && vo.status === "1") {
console.log(vo.roundNum)
await receiveCash(vo.roundNum)
await $.wait(2*1000)
// if (process.env.CT_RE == 'true') {
if (data.data && data['data']['bizCode'] === 0) {
for(let vo of data.data.result && data.data.result.popWindows || []){
if (vo && vo.type === "dailycash_second") {
await receiveCash()
await $.wait(2*1000)
}
}
for(let vo of data.data.result && data.data.result.mainInfos || []){
if (vo && vo.remaingAssistNum === 0 && vo.status === "1") {
console.log(vo.roundNum)
await receiveCash(vo.roundNum)
await $.wait(2*1000)
}
}
}
}
// }else{
// console.log('请设置CT_RE为true自动开红包,建议手动,未知风险')
// }
}
}
} catch (e) {
Expand All @@ -181,8 +221,10 @@ function getInfo(inviteId, flag = false) {
})
})
}
function receiveCash(roundNum) {
let body = {"cashType":1,"roundNum":roundNum}
function receiveCash(roundNum = '') {
let body = {"cashType":2}
if(roundNum) body = {"cashType":1,"roundNum":roundNum}
if(roundNum == -1) body = {"cashType":4}
return new Promise((resolve) => {
$.post(taskPostUrl("city_receiveCash",body), async (err, resp, data) => {
try {
Expand Down Expand Up @@ -254,41 +296,38 @@ function city_lotteryAward() {
})
})
}
// function readShareCode(num=3) {
// return new Promise(async resolve => {
// $.get({url: `https://api.jdsharecode.xyz/api/city/${num}`, 'timeout': 10000}, (err, resp, data) => {
// try {
// if (err) {
// console.log(`${JSON.stringify(err)}`)
// console.log(`${$.name} API请求失败,请检查网路重试`)
// } else {
// if (data) {
// data = JSON.parse(data);
// }
// }
// } catch (e) {
// $.logErr(e, resp)
// } finally {
// resolve(data);
// }
// })
// await $.wait(10000);
// resolve()
// })
// }
function readShareCode(num=3) {
return new Promise(async resolve => {
$.get({url: `https://api.jdsharecode.xyz/api/city/${num}`, 'timeout': 10000}, (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (data) {
data = JSON.parse(data);
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
await $.wait(10000);
resolve()
})
}
//格式化助力码
function shareCodesFormat() {
return new Promise(async resolve => {
// console.log(`第${$.index}个京东账号的助力码:::${$.shareCodesArr[$.index - 1]}`)
$.newShareCodes = []
// const readShareCodeRes = await readShareCode(3);
// if (readShareCodeRes && readShareCodeRes.code === 200) {
// pool = readShareCodeRes.data || [];
// }
const readShareCodeRes = await readShareCode(3);
if (readShareCodeRes && readShareCodeRes.code === 200) {
pool = readShareCodeRes.data || [];
}
if ($.isNode()) {
if (process.env.JD_CITY_EXCHANGE) {
exchangeFlag = process.env.JD_CITY_EXCHANGE || exchangeFlag;
}
if (process.env.CITY_SHARECODES) {
console.log('检测到助力码,优先. 内部互助0.01了吧,删了吧.')
if (process.env.CITY_SHARECODES.indexOf('\n') > -1) {
Expand All @@ -298,20 +337,19 @@ function shareCodesFormat() {
}
}
}
// if ($.index - 1 == 0) {
// console.log('首个帐号,助力作者和池子')
// $.newShareCodes = [...new Set([...$.newShareCodes,...author_codes, ...pool])];
// } else {
// console.log('非首个个帐号,优先向前助力')
// $.newShareCodes = [...new Set([...$.newShareCodes,...self_code,...author_codes, ...pool])]
// }
if ($.index == 1) {
console.log('首个帐号,助力作者和池子')
$.newShareCodes = [...new Set([...author_codes,...pool,...$.newShareCodes])]
} else{
console.log('非首个帐号,助力池子')
$.newShareCodes = [...new Set([...$.newShareCodes,...pool])]
// if (process.env.CT_POOL != 'false') {
// console.log('默认助力作者和池子,助力码依然优先')
// $.newShareCodes = [...new Set([...$.newShareCodes,...author_codes,...pool,...self_code])]
// }else{
console.log('非首个个帐号,优先向前助力')
$.newShareCodes = [...new Set([...$.newShareCodes,...self_code,...author_codes,...pool])]
// }
}

console.log(`第${$.index}个京东账号将要助力的好友${JSON.stringify($.newShareCodes)}`)
resolve();
})
Expand All @@ -322,9 +360,6 @@ function requireConfig() {
//Node.js用户请在jdCookie.js处填写京东ck;
let shareCodes = [];
if ($.isNode()) {
if (process.env.JD_CITY_EXCHANGE) {
exchangeFlag = process.env.JD_CITY_EXCHANGE || exchangeFlag;
}
if (process.env.CITY_SHARECODES) {
if (process.env.CITY_SHARECODES.indexOf('\n') > -1) {
shareCodes = process.env.CITY_SHARECODES.split('\n');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 3c4c74a

Please sign in to comment.