mirror of
https://github.com/shufflewzc/faker2.git
synced 2025-05-07 03:48:44 +08:00
update
This commit is contained in:
parent
b754e4db26
commit
0ef8d3b25f
93
jd_bean_info.js
Executable file → Normal file
93
jd_bean_info.js
Executable file → Normal file
@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
京豆详情统计
|
定时自定义
|
||||||
依次推送 + 全部统计
|
2 20 14 12 * jd_bean_info.js
|
||||||
7 7 7 7 7 jd_bean_info.js
|
*/
|
||||||
*/
|
|
||||||
const $ = new Env('京豆详情统计');
|
const $ = new Env('京豆详情统计');
|
||||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||||
//Node.js用户请在jdCookie.js处填写京东ck;
|
//Node.js用户请在jdCookie.js处填写京东ck;
|
||||||
@ -40,8 +40,9 @@ if ($.isNode()) {
|
|||||||
$.message = '';
|
$.message = '';
|
||||||
$.balance = 0;
|
$.balance = 0;
|
||||||
$.expiredBalance = 0;
|
$.expiredBalance = 0;
|
||||||
await TotalBean();
|
$.UA=require('./USER_AGENTS').UARAM();
|
||||||
console.log(`\n********开始【京东账号${$.index}】${$.nickName || $.UserName}******\n`);
|
//await TotalBean();
|
||||||
|
//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"});
|
||||||
|
|
||||||
@ -52,12 +53,11 @@ if ($.isNode()) {
|
|||||||
}
|
}
|
||||||
await bean();
|
await bean();
|
||||||
await showMsg();
|
await showMsg();
|
||||||
|
await $.wait(2000);
|
||||||
}
|
}
|
||||||
console.log(allMessage)
|
|
||||||
await notify.sendNotify(`${$.name}`, `${allMessage}`, { url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean` })
|
|
||||||
allMessage = ''
|
|
||||||
}
|
}
|
||||||
allMessage += `今日全部账号收入:${allBean}个京豆 🐶\n`
|
allMessage += `\n今日全部账号收入:${allBean}个京豆 🐶\n`
|
||||||
|
console.log(`${allMessage}`)
|
||||||
if ($.isNode() && allMessage) {
|
if ($.isNode() && allMessage) {
|
||||||
await notify.sendNotify(`${$.name}`, `${allMessage}`, { url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean` })
|
await notify.sendNotify(`${$.name}`, `${allMessage}`, { url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean` })
|
||||||
}
|
}
|
||||||
@ -71,10 +71,10 @@ if ($.isNode()) {
|
|||||||
async function showMsg() {
|
async function showMsg() {
|
||||||
if ($.errorMsg) return
|
if ($.errorMsg) return
|
||||||
allMessage += `\n【账号${$.index}:${$.nickName || $.UserName} 京豆详情统计】\n\n`;
|
allMessage += `\n【账号${$.index}:${$.nickName || $.UserName} 京豆详情统计】\n\n`;
|
||||||
allMessage += `今日收入:${$.todayIncomeBean}个京豆 🐶\n`
|
allMessage += `今日收入总计:${$.todayIncomeBean}京豆 🐶\n`
|
||||||
allBean = allBean + parseInt($.todayIncomeBean)
|
allBean = allBean + parseInt($.todayIncomeBean)
|
||||||
for (let key of myMap.keys()) {
|
for (let key of myMap.keys()) {
|
||||||
allMessage += key + ' ---> ' +myMap.get(key)+'京豆 🐶\n'
|
allMessage += "【" +myMap.get(key)+"豆"+"】 "+key+'\n'
|
||||||
}
|
}
|
||||||
myMap = new Map()
|
myMap = new Map()
|
||||||
// if ($.isNode()) {
|
// if ($.isNode()) {
|
||||||
@ -95,13 +95,14 @@ async function bean() {
|
|||||||
do {
|
do {
|
||||||
let response = await getJingBeanBalanceDetail(page);
|
let response = await getJingBeanBalanceDetail(page);
|
||||||
// console.log(`第${page}页: ${JSON.stringify(response)}`);
|
// console.log(`第${page}页: ${JSON.stringify(response)}`);
|
||||||
|
await $.wait(1000);
|
||||||
if (response && response.code === "0") {
|
if (response && response.code === "0") {
|
||||||
page++;
|
page++;
|
||||||
let jingDetailList = response.jingDetailList;
|
let detailList = response.detailList;
|
||||||
if (jingDetailList && jingDetailList.length > 0) {
|
if (detailList && detailList.length > 0) {
|
||||||
for (let item of jingDetailList) {
|
for (let item of detailList) {
|
||||||
const date = item.date.replace(/-/g, '/') + "+08:00";
|
const date = item.date.replace(/-/g, '/') + "+08:00";
|
||||||
if (new Date(date).getTime() >= tm1 && (!item['eventMassage'].includes("退还") && !item['eventMassage'].includes('扣赠'))) {
|
if (new Date(date).getTime() >= tm1 && (!item['eventMassage'].includes("退还") && !item['eventMassage'].includes("物流") && !item['eventMassage'].includes('扣赠'))) {
|
||||||
todayArr.push(item);
|
todayArr.push(item);
|
||||||
} else if (tm <= new Date(date).getTime() && new Date(date).getTime() < tm1 && (!item['eventMassage'].includes("退还") && !item['eventMassage'].includes('扣赠'))) {
|
} else if (tm <= new Date(date).getTime() && new Date(date).getTime() < tm1 && (!item['eventMassage'].includes("退还") && !item['eventMassage'].includes('扣赠'))) {
|
||||||
//昨日的
|
//昨日的
|
||||||
@ -121,8 +122,8 @@ async function bean() {
|
|||||||
// console.log(`cookie已过期,或者填写不规范,跳出`)
|
// console.log(`cookie已过期,或者填写不规范,跳出`)
|
||||||
t = 1;
|
t = 1;
|
||||||
} else {
|
} else {
|
||||||
// console.log(`未知情况:${JSON.stringify(response)}`);
|
console.log(`未知情况:${JSON.stringify(response)}`);
|
||||||
// console.log(`未知情况,跳出`)
|
console.log(`未知情况,跳出`)
|
||||||
t = 1;
|
t = 1;
|
||||||
}
|
}
|
||||||
} while (t === 0);
|
} while (t === 0);
|
||||||
@ -197,10 +198,11 @@ function TotalBean() {
|
|||||||
function getJingBeanBalanceDetail(page) {
|
function getJingBeanBalanceDetail(page) {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
const options = {
|
const options = {
|
||||||
"url": `https://bean.m.jd.com/beanDetail/detail.json?page=${page}`,
|
"url": `https://api.m.jd.com/client.action?functionId=getJingBeanBalanceDetail`,
|
||||||
"body": `body=${escape(JSON.stringify({"pageSize": "20", "page": page.toString()}))}&appid=ld`,
|
"body": `body=${escape(JSON.stringify({"pageSize": "20", "page": page.toString()}))}&appid=ld`,
|
||||||
"headers": {
|
"headers": {
|
||||||
'User-Agent': "Mozilla/5.0 (Linux; Android 12; SM-G9880) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Mobile Safari/537.36 EdgA/106.0.1370.47",
|
'User-Agent': $.UA,
|
||||||
|
'Host': 'api.m.jd.com',
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
'Cookie': cookie,
|
'Cookie': cookie,
|
||||||
}
|
}
|
||||||
@ -208,8 +210,8 @@ function getJingBeanBalanceDetail(page) {
|
|||||||
$.post(options, (err, resp, data) => {
|
$.post(options, (err, resp, data) => {
|
||||||
try {
|
try {
|
||||||
if (err) {
|
if (err) {
|
||||||
// console.log(`${JSON.stringify(err)}`)
|
console.log(`${JSON.stringify(err)}`)
|
||||||
// console.log(`${$.name} API请求失败,请检查网路重试`)
|
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
} else {
|
} else {
|
||||||
if (data) {
|
if (data) {
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
@ -226,6 +228,53 @@ function getJingBeanBalanceDetail(page) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
function queryexpirejingdou() {
|
||||||
|
return new Promise(async resolve => {
|
||||||
|
const options = {
|
||||||
|
"url": `https://wq.jd.com/activep3/singjd/queryexpirejingdou?_=${Date.now()}&g_login_type=1&sceneval=2`,
|
||||||
|
"headers": {
|
||||||
|
"Accept": "*/*",
|
||||||
|
"Accept-Encoding": "gzip, deflate, br",
|
||||||
|
"Accept-Language": "zh-cn",
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Cookie": cookie,
|
||||||
|
"Host": "wq.jd.com",
|
||||||
|
"Referer": "https://wqs.jd.com/promote/201801/bean/mybean.html",
|
||||||
|
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.1 Mobile/15E148 Safari/604.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.expirejingdou = 0;
|
||||||
|
$.get(options, (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
// console.log(`${JSON.stringify(err)}`)
|
||||||
|
// console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (data) {
|
||||||
|
// console.log(data)
|
||||||
|
data = JSON.parse(data.slice(23, -13));
|
||||||
|
// console.log(data)
|
||||||
|
if (data.ret === 0) {
|
||||||
|
data['expirejingdou'].map(item => {
|
||||||
|
// console.log(`${timeFormat(item['time'] * 1000)}日过期京豆:${item['expireamount']}\n`);
|
||||||
|
$.expirejingdou += item['expireamount'];
|
||||||
|
})
|
||||||
|
// if ($.expirejingdou > 0) {
|
||||||
|
// $.message += `\n今日将过期:${$.expirejingdou}京豆 🐶`;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// console.log(`京东服务器返回空数据`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// $.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
function jsonParse(str) {
|
function jsonParse(str) {
|
||||||
if (typeof str == "string") {
|
if (typeof str == "string") {
|
||||||
try {
|
try {
|
||||||
|
@ -152,7 +152,7 @@ async function main(_0x14f2ac) {
|
|||||||
} if (_0x4a424c.assignmentType === 1) {
|
} if (_0x4a424c.assignmentType === 1) {
|
||||||
for (let i = 0; i < (_0x4a424c.assignmentTimesLimit - _0x4a424c.completionCnt); i++) {
|
for (let i = 0; i < (_0x4a424c.assignmentTimesLimit - _0x4a424c.completionCnt); i++) {
|
||||||
console.log('任务:' + _0x4a424c.assignmentName + ',去执行');
|
console.log('任务:' + _0x4a424c.assignmentName + ',去执行');
|
||||||
let _0x3c7f29 = _0x4a424c.ext.shoppingActivity[i].itemId || '';
|
let _0x3c7f29 = _0x4a424c.ext.shoppingActivity && _0x4a424c.ext.shoppingActivity[i].itemId || _0x4a424c.ext.productsInfo[i].itemId ||'';
|
||||||
if (!_0x3c7f29) {
|
if (!_0x3c7f29) {
|
||||||
console.log('任务:' + _0x4a424c.assignmentName + ',信息异常');
|
console.log('任务:' + _0x4a424c.assignmentName + ',信息异常');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user