Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Faker authored and Faker committed Dec 28, 2022
1 parent 6c545cb commit 4118cf3
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 23 deletions.
93 changes: 71 additions & 22 deletions jd_bean_info.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
京豆详情统计
依次推送 + 全部统计
7 7 7 7 7 jd_bean_info.js
*/
定时自定义
2 20 14 12 * jd_bean_info.js
*/

const $ = new Env('京豆详情统计');
const notify = $.isNode() ? require('./sendNotify') : '';
//Node.js用户请在jdCookie.js处填写京东ck;
Expand Down Expand Up @@ -40,8 +40,9 @@ if ($.isNode()) {
$.message = '';
$.balance = 0;
$.expiredBalance = 0;
await TotalBean();
console.log(`\n********开始【京东账号${$.index}${$.nickName || $.UserName}******\n`);
$.UA=require('./USER_AGENTS').UARAM();
//await TotalBean();
//console.log(`\n********开始【京东账号${$.index}】${$.nickName || $.UserName}******\n`);
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"});

Expand All @@ -52,12 +53,11 @@ if ($.isNode()) {
}
await bean();
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) {
await notify.sendNotify(`${$.name}`, `${allMessage}`, { url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean` })
}
Expand All @@ -71,10 +71,10 @@ if ($.isNode()) {
async function showMsg() {
if ($.errorMsg) return
allMessage += `\n【账号${$.index}${$.nickName || $.UserName} 京豆详情统计】\n\n`;
allMessage += `今日收入${$.todayIncomeBean}个京豆 🐶\n`
allMessage += `今日收入总计${$.todayIncomeBean}京豆 🐶\n`
allBean = allBean + parseInt($.todayIncomeBean)
for (let key of myMap.keys()) {
allMessage += key + ' ---> ' +myMap.get(key)+'京豆 🐶\n'
allMessage += "【" +myMap.get(key)+"豆"+"】 "+key+'\n'
}
myMap = new Map()
// if ($.isNode()) {
Expand All @@ -95,13 +95,14 @@ async function bean() {
do {
let response = await getJingBeanBalanceDetail(page);
// console.log(`第${page}页: ${JSON.stringify(response)}`);
await $.wait(1000);
if (response && response.code === "0") {
page++;
let jingDetailList = response.jingDetailList;
if (jingDetailList && jingDetailList.length > 0) {
for (let item of jingDetailList) {
let detailList = response.detailList;
if (detailList && detailList.length > 0) {
for (let item of detailList) {
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);
} else if (tm <= new Date(date).getTime() && new Date(date).getTime() < tm1 && (!item['eventMassage'].includes("退还") && !item['eventMassage'].includes('扣赠'))) {
//昨日的
Expand All @@ -121,8 +122,8 @@ async function bean() {
// console.log(`cookie已过期,或者填写不规范,跳出`)
t = 1;
} else {
// console.log(`未知情况:${JSON.stringify(response)}`);
// console.log(`未知情况,跳出`)
console.log(`未知情况:${JSON.stringify(response)}`);
console.log(`未知情况,跳出`)
t = 1;
}
} while (t === 0);
Expand Down Expand Up @@ -197,19 +198,20 @@ function TotalBean() {
function getJingBeanBalanceDetail(page) {
return new Promise(async resolve => {
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`,
"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',
'Cookie': cookie,
}
}
$.post(options, (err, resp, data) => {
try {
if (err) {
// console.log(`${JSON.stringify(err)}`)
// console.log(`${$.name} API请求失败,请检查网路重试`)
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (data) {
data = JSON.parse(data);
Expand All @@ -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) {
if (typeof str == "string") {
try {
Expand Down
17 changes: 17 additions & 0 deletions jd_teamFLP.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jd_twjk_new.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ async function main(_0x14f2ac) {
} if (_0x4a424c.assignmentType === 1) {
for (let i = 0; i < (_0x4a424c.assignmentTimesLimit - _0x4a424c.completionCnt); i++) {
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) {
console.log('任务:' + _0x4a424c.assignmentName + ',信息异常');
}
Expand Down

0 comments on commit 4118cf3

Please sign in to comment.