初始化代码
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ @(#) log4j2.xml
|
||||
~ log4j的配置文件
|
||||
~ <br> Copyright: Copyright (c) 2018
|
||||
~ <br> Company:黄志军
|
||||
~ <br> @author selfImpr
|
||||
~ <br> 2018-05-21 16:20:42
|
||||
~ <br> @description
|
||||
~
|
||||
~
|
||||
-->
|
||||
|
||||
<Configuration status="WARN">
|
||||
<Properties>
|
||||
|
||||
<Property name="appId" value="Spring"/>
|
||||
|
||||
<Property name="moduleId" value="Spring"/>
|
||||
|
||||
<!--<Property name="logDir" value="/opt/logs/"/>-->
|
||||
<Property name="logDir" value="F:/sunsharing-program-code/运行日志/sunsharing/logs/"/><!-- windows use this-->
|
||||
<Property name="logFilePrefix" value="${logDir}/${appId}/${appId}-${moduleId}"/>
|
||||
<Property name="commonPath" value="${logFilePrefix}.log"/>
|
||||
<Property name="exceptionPath" value="${logFilePrefix}-exception.log"/>
|
||||
<Property name="accessPath" value="${logFilePrefix}-access.log"/>
|
||||
<Property name="commonPattern" value="%d{MM-dd HH:mm:ss.SSS} %p %thread %X{invokeNo} %logger{40} %line %msg%n"/>
|
||||
</Properties>
|
||||
|
||||
<Appenders>
|
||||
|
||||
<Console name="Console" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="${commonPattern}"/>
|
||||
</Console>
|
||||
|
||||
<RollingFile name="fileAppender" fileName="${commonPath}" filePattern="${commonPath}.%d{yyyy-MM-dd}" append="true">
|
||||
<PatternLayout pattern="${commonPattern}"/>
|
||||
<Policies>
|
||||
<TimeBasedTriggeringPolicy modulate="true" interval="1"/>
|
||||
</Policies>
|
||||
</RollingFile>
|
||||
|
||||
<RollingFile name="errorAppender" fileName="${exceptionPath}" filePattern="${exceptionPath}.%d{yyyy-MM-dd}" append="true">
|
||||
<PatternLayout pattern="${commonPattern}"/>
|
||||
<Policies>
|
||||
<TimeBasedTriggeringPolicy modulate="true" interval="1"/>
|
||||
</Policies>
|
||||
<Filters>
|
||||
<ThresholdFilter level="WARN" onMatch="DENY" onMismatch="NEUTRAL"/>
|
||||
</Filters>
|
||||
</RollingFile>
|
||||
|
||||
<RollingFile name="accessAppender" fileName="${accessPath}" filePattern="${accessPath}.%d{yyyy-MM-dd}" append="true">
|
||||
<PatternLayout pattern="${commonPattern}"/>
|
||||
<Policies>
|
||||
<TimeBasedTriggeringPolicy modulate="true" interval="1"/>
|
||||
</Policies>
|
||||
</RollingFile>
|
||||
|
||||
</Appenders>
|
||||
|
||||
<Loggers>
|
||||
<Logger name="com.sunsharing" level="DEBUG"/>
|
||||
<Logger name="jdbc.sqltiming" level="INFO"/>
|
||||
|
||||
<Root level="WARN">
|
||||
<AppenderRef ref="Console"/>
|
||||
<AppenderRef ref="fileAppender"/>
|
||||
<AppenderRef ref="errorAppender"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
|
||||
</Configuration>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,303 @@
|
||||
let cookiesArr = [], cookie = '';
|
||||
const JD_API_HOST = 'https://ms.jr.jd.com/gw/generic/uc/h5/m';
|
||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
let message = ""
|
||||
//Node.js用户请在jdCookie.js处填写动动ck;
|
||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||
if ($.isNode()) {
|
||||
Object.keys(jdCookieNode).forEach((item) => {
|
||||
cookiesArr.push(jdCookieNode[item])
|
||||
})
|
||||
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.log = () => {};
|
||||
} else {
|
||||
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
|
||||
}
|
||||
!(async () => {
|
||||
|
||||
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>天天提鹅</font> \n\n --- \n\n"
|
||||
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;
|
||||
}
|
||||
for (let i = 0; i < cookiesArr.length; i++) {
|
||||
if (cookiesArr[i]) {
|
||||
cookie = cookiesArr[i];
|
||||
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
||||
$.index = i + 1;
|
||||
$.isLogin = true;
|
||||
$.nickName = '';
|
||||
await TotalBean();
|
||||
username = $.UserName
|
||||
if ($.UserName == "jd_66ea783827d30"){
|
||||
username = "跑腿小弟"
|
||||
}
|
||||
if ($.UserName == "jd_4521b375ebb5d"){
|
||||
username = "锟锟"
|
||||
}
|
||||
if ($.UserName == "jd_542c10c0222bc"){
|
||||
username = "康康"
|
||||
}
|
||||
//加上名称
|
||||
message = message + "<font color=\'#778899\' size=2>【羊毛姐妹】<font color=\'#FFA500\' size=3>" + username + " </font> </font> \n\n "
|
||||
that.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"});
|
||||
|
||||
if ($.isNode()) {
|
||||
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `动动账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
|
||||
}
|
||||
continue
|
||||
}
|
||||
await jdDailyEgg();
|
||||
}
|
||||
message = message +"----\n\n"
|
||||
}
|
||||
})()
|
||||
.catch((e) => {
|
||||
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
|
||||
})
|
||||
.finally(() => {
|
||||
that.log(message)
|
||||
postToDingTalk(message)
|
||||
$.done();
|
||||
})
|
||||
async function jdDailyEgg() {
|
||||
await toDailyHome()
|
||||
await toWithdraw()
|
||||
await toGoldExchange();
|
||||
}
|
||||
function toGoldExchange() {
|
||||
return new Promise(async resolve => {
|
||||
const body = {
|
||||
"timeSign": 0,
|
||||
"environment": "jrApp",
|
||||
"riskDeviceInfo": "{}"
|
||||
}
|
||||
$.post(taskUrl('toGoldExchange', body), (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (data) {
|
||||
// that.log(data)
|
||||
data = JSON.parse(data);
|
||||
if (data.resultCode === 0) {
|
||||
if (data.resultData.code === '0000') {
|
||||
that.log(`兑换金币:${data.resultData.data.cnumber}`);
|
||||
message += "<font color=\'#778899\' size=2>" + `兑换金币:${data.resultData.data.cnumber}` + "</font>\n\n"
|
||||
that.log(`当前总金币:${data.resultData.data.goldTotal}`);
|
||||
message += "<font color=\'#778899\' size=2>" + `当前总金币:${data.resultData.data.goldTotal}` +"</font>\n\n"
|
||||
} else if (data.resultData.code !== '0000') {
|
||||
that.log(`兑换金币失败:${data.resultData.msg}`)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
that.log(`动动服务器返回空数据`)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
function toWithdraw() {
|
||||
return new Promise(async resolve => {
|
||||
const body = {
|
||||
"timeSign": 0,
|
||||
"environment": "jrApp",
|
||||
"riskDeviceInfo": "{}"
|
||||
}
|
||||
$.post(taskUrl('toWithdraw', body), (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (data) {
|
||||
// that.log(data)
|
||||
data = JSON.parse(data);
|
||||
if (data.resultCode === 0) {
|
||||
if (data.resultData.code === '0000') {
|
||||
message += "<font color=\'#778899\' size=2>" +`收取鹅蛋:${data.resultData.data.eggTotal}个成功` + "</font>\n\n"
|
||||
message += "<font color=\'#778899\' size=2>" + `当前总鹅蛋数量:${data.resultData.data.userLevelDto.userHaveEggNum}` + "</font>\n\n"
|
||||
that.log(`收取鹅蛋:${data.resultData.data.eggTotal}个成功`);
|
||||
that.log(`当前总鹅蛋数量:${data.resultData.data.userLevelDto.userHaveEggNum}`);
|
||||
} else if (data.resultData.code !== '0000') {
|
||||
that.log(`收取鹅蛋失败:${data.resultData.msg}`)
|
||||
message += "<font color=\'#778899\' size=2>" + `收取鹅蛋失败:${data.resultData.msg}` + "</font>\n\n"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
that.log(`动动服务器返回空数据`)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
function toDailyHome() {
|
||||
return new Promise(async resolve => {
|
||||
const body = {
|
||||
"timeSign": 0,
|
||||
"environment": "jrApp",
|
||||
"riskDeviceInfo": "{}"
|
||||
}
|
||||
$.post(taskUrl('toDailyHome', body), (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (data) {
|
||||
// that.log(data)
|
||||
data = JSON.parse(data);
|
||||
} else {
|
||||
that.log(`动动服务器返回空数据`)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
function TotalBean() {
|
||||
return new Promise(async resolve => {
|
||||
const options = {
|
||||
"url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
|
||||
"headers": {
|
||||
"Accept": "application/json,text/plain, */*",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Accept-Language": "zh-cn",
|
||||
"Connection": "keep-alive",
|
||||
"Cookie": cookie,
|
||||
"Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
|
||||
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1")
|
||||
}
|
||||
}
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
if (data['retcode'] === 13) {
|
||||
$.isLogin = false; //cookie过期
|
||||
return
|
||||
}
|
||||
if (data['retcode'] === 0) {
|
||||
$.nickName = (data['base'] && data['base'].nickname) || $.UserName;
|
||||
} else {
|
||||
$.nickName = $.UserName
|
||||
}
|
||||
} else {
|
||||
that.log(`动动服务器返回空数据`)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
function taskUrl(function_id, body) {
|
||||
return {
|
||||
url: `${JD_API_HOST}/${function_id}`,
|
||||
body: `reqData=${encodeURIComponent(JSON.stringify(body))}`,
|
||||
headers: {
|
||||
'Accept' : `application/json`,
|
||||
'Origin' : `https://uua.jr.jd.com`,
|
||||
'Cookie' : cookie,
|
||||
'Content-Type' : `application/x-www-form-urlencoded;charset=UTF-8`,
|
||||
'Host' : `ms.jr.jd.com`,
|
||||
'Connection' : `keep-alive`,
|
||||
'User-Agent' : $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||
'Referer' : `https://uua.jr.jd.com/uc-fe-wxgrowing/moneytree/index`,
|
||||
'Accept-Language' : `zh-cn`
|
||||
}
|
||||
}
|
||||
}
|
||||
function jsonParse(str) {
|
||||
if (typeof str == "string") {
|
||||
try {
|
||||
return JSON.parse(str);
|
||||
} catch (e) {
|
||||
that.log(e);
|
||||
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//我加的函数
|
||||
function postToDingTalk(messgae) {
|
||||
const dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=18444b555747aad3381bc1d1e3dea72b03158e152a846f818d82a1ca946bd430"
|
||||
|
||||
const message1 = "" + messgae
|
||||
that.log(messgae)
|
||||
|
||||
const body = {
|
||||
"msgtype": "markdown",
|
||||
"markdown": {
|
||||
"title":"天天提鹅",
|
||||
"text": message1
|
||||
},
|
||||
"at": {
|
||||
"atMobiles": [],
|
||||
"isAtAll": false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
|
||||
try {
|
||||
that.log(resp)
|
||||
that.log(data)
|
||||
if (err) {
|
||||
that.log(JSON.stringify(err));
|
||||
$.logErr(err);
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
$.duckRes = JSON.parse(data);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
},"json")
|
||||
}
|
||||
|
||||
|
||||
function toDingtalk(urlmain, bodyMain) {
|
||||
return {
|
||||
url: urlmain,
|
||||
body:bodyMain,
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||
timeout: 10000,
|
||||
}
|
||||
}
|
||||
|
||||
function getPic(){
|
||||
let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
|
||||
let address = "\n\n )
|
||||
address = address + code[pos] + ")"
|
||||
return address
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,386 @@
|
||||
|
||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||
|
||||
const randomCount = $.isNode() ? 20 : 5;
|
||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
let merge = {}
|
||||
let codeList = []
|
||||
//IOS等用户直接用NobyDa的jd cookie
|
||||
let cookiesArr = [],message =- "",timeout,l,
|
||||
cookie = '';
|
||||
if ($.isNode()) {
|
||||
Object.keys(jdCookieNode).forEach((item) => {
|
||||
cookiesArr.push(jdCookieNode[item])
|
||||
})
|
||||
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.log = () => {};
|
||||
} else {
|
||||
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`;
|
||||
|
||||
!(async () => {
|
||||
if (!cookiesArr[0]) {
|
||||
$.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的动动签到获取', 'https://bean.m.jd.com/', {
|
||||
"open-url": "https://bean.m.jd.com/"
|
||||
});
|
||||
return;
|
||||
}
|
||||
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>动动国创</font> \n\n --- \n\n"
|
||||
|
||||
|
||||
for (let i = 0; i < cookiesArr.length; i++) {
|
||||
cookie = cookiesArr[i];
|
||||
if (cookie) {
|
||||
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
||||
$.index = i + 1;
|
||||
$.isLogin = true;
|
||||
$.nickName = '';
|
||||
$.beans = 0
|
||||
$.cando = true
|
||||
username = $.UserName
|
||||
if ($.UserName == "jd_66ea783827d30"){
|
||||
username = "跑腿小弟"
|
||||
}
|
||||
if ($.UserName == "jd_4521b375ebb5d"){
|
||||
username = "锟锟"
|
||||
}
|
||||
if ($.UserName == "jd_542c10c0222bc"){
|
||||
username = "康康"
|
||||
}
|
||||
//加上名称
|
||||
message = message + "<font color=\'#778899\' size=2>【羊毛姐妹】<font color=\'#FFA500\' size=3>" + username + " </font> </font> \n\n "
|
||||
|
||||
that.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"
|
||||
});
|
||||
|
||||
if ($.isNode()) {
|
||||
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `动动账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
|
||||
}
|
||||
continue
|
||||
}
|
||||
let actdata= await getid("superBrandSecondFloorMainPage","secondfloor")
|
||||
if($.cando){
|
||||
$.actid = actdata.actid
|
||||
$.enpid = actdata.enpid
|
||||
//{actid,actname,enpid}
|
||||
// await doTask("44spR7W6XFhQXzMvPva99WYLTscr", "1000000157", "3") //关注
|
||||
// await superBrandTaskLottery()
|
||||
await getCode()
|
||||
|
||||
await doTask("secondfloor",$.enpid,$.taskList[0].encryptAssignmentId,$.taskList[0].ext.followShop[0].itemId,$.taskList[0].assignmentType)
|
||||
await doTask("secondfloor",$.enpid,$.taskList[2].encryptAssignmentId,$.taskList[2].ext.brandMemberList[0].itemId,$.taskList[2].assignmentType)
|
||||
let signdata= await getid("showSecondFloorSignInfo","sign")
|
||||
await doTask("sign",signdata.enpid,signdata.eid,1,5)
|
||||
that.log("开始抽奖")
|
||||
await superBrandTaskLottery()
|
||||
await superBrandTaskLottery()
|
||||
await superBrandTaskLottery()
|
||||
}
|
||||
|
||||
cookie = cookiesArr[i];
|
||||
if (cookie) {
|
||||
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
||||
$.index = i + 1;
|
||||
$.isLogin = true;
|
||||
$.nickName = '';
|
||||
// $.beans = 0
|
||||
// message = ''
|
||||
|
||||
// await shareCodesFormat();
|
||||
that.log(`\n******开始【动动账号${$.index}】\n`);
|
||||
|
||||
for (l = 0; l < codeList.length; l++) {
|
||||
that.log(`为 ${codeList[l]}助力中`)
|
||||
await doTask("secondfloor",$.enpid,$.inviteenaid, codeList[l], 2)
|
||||
}
|
||||
}
|
||||
|
||||
cookie = cookiesArr[i];
|
||||
if (cookie) {
|
||||
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
||||
$.index = i + 1;
|
||||
$.isLogin = true;
|
||||
$.nickName = '';
|
||||
// await shareCodesFormat();
|
||||
that.log(`\n******开始【动动账号${$.index}】抽奖\n`);
|
||||
await superBrandTaskLottery()
|
||||
await superBrandTaskLottery()
|
||||
await superBrandTaskLottery()
|
||||
// that.log(`共获得${$.beans} 京豆`)
|
||||
}
|
||||
message = message + "<font color=\'#778899\' size=2>" + `共获得${$.beans} 京豆\n` + "</font>\n\n"
|
||||
}
|
||||
message = message +"----\n\n"
|
||||
}
|
||||
})()
|
||||
.catch((e) => {
|
||||
$.logErr(e)
|
||||
message = message + "<font color=\'#778899\' size=2>" + e + "</font>\n\n"
|
||||
})
|
||||
.finally(() => {
|
||||
message = message + getPic()
|
||||
that.log(message)
|
||||
// postToDingTalk(message)
|
||||
$.done()
|
||||
})
|
||||
//获取活动信息
|
||||
|
||||
function getid(functionid,source) {
|
||||
return new Promise(async (resolve) => {
|
||||
const options = taskPostUrl(functionid, `{"source":"${source}"}`)
|
||||
// that.log(options)
|
||||
$.post(options, async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`);
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`);
|
||||
} else {
|
||||
data = JSON.parse(data);
|
||||
// that.log(data)
|
||||
if ( data.data && data.code === "0"&&data.data.result) {
|
||||
let json = {}
|
||||
let result =data.data.result
|
||||
json.actid = result.activityBaseInfo.activityId
|
||||
json.actname= result.activityBaseInfo.activityName
|
||||
json.enpid = result.activityBaseInfo.encryptProjectId
|
||||
if(source === "sign"){json.eid=result.activitySign1Info.encryptAssignmentId}
|
||||
resolve(json)
|
||||
that.log(`当前活动:${json.actname} ${json.actid}`)
|
||||
}else{
|
||||
that.log("获取失败")
|
||||
$.cando = false
|
||||
resolve()
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function getsignid() {
|
||||
return new Promise(async (resolve) => {
|
||||
const options = taskPostUrl("superBrandSecondFloorMainPage", `{"source":"secondfloor"}`)
|
||||
// that.log(options)
|
||||
$.post(options, async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`);
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`);
|
||||
} else {
|
||||
data = JSON.parse(data);
|
||||
// that.log(data)
|
||||
if ( data.data && data.code === "0") {
|
||||
$.actid = data.data.result.activityBaseInfo.activityId
|
||||
$.actname=data.data.result.activityBaseInfo.activityName
|
||||
$.enpid = data.data.result.activityBaseInfo.encryptProjectId
|
||||
that.log(`当前活动:${actname} ${$.actid}`)
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getCode() {
|
||||
return new Promise(async (resolve) => {
|
||||
const options = taskPostUrl("superBrandTaskList", `{"source":"secondfloor","activityId":${$.actid},"assistInfoFlag":1}`)
|
||||
// that.log(options)
|
||||
$.post(options, async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`);
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`);
|
||||
} else {
|
||||
data = JSON.parse(data);
|
||||
// that.log(data.data.result)
|
||||
if (data && data.data && data.code === "0") {
|
||||
if (data.data.result && data.data.result.taskList && data.data.result.taskList[3]) {
|
||||
$.taskList = data.data.result.taskList
|
||||
let result = data.data.result.taskList[3]
|
||||
let encryptAssignmentId = result.encryptAssignmentId
|
||||
let itemid = result.ext.assistTaskDetail.itemId
|
||||
$.inviteenaid=result.encryptAssignmentId
|
||||
codeList[codeList.length] = itemid
|
||||
that.log(`获取邀请码成功 ${itemid}`);
|
||||
} else {
|
||||
that.log(data)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function doTask(source,pid,encryptAssignmentId, id, type) {
|
||||
return new Promise(async (resolve) => {
|
||||
const options = taskPostUrl(`superBrandDoTask`, `{"source":"${source}","activityId":${$.actid},"encryptProjectId":"${pid}","encryptAssignmentId":"${encryptAssignmentId}","assignmentType":${type},"itemId":"${id}","actionType":0}`)
|
||||
// that.log(options)
|
||||
$.post(options, async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`);
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`);
|
||||
} else {
|
||||
// that.log(data)
|
||||
data = JSON.parse(data);
|
||||
if (data && data.code === "0") {
|
||||
if (data.data.bizCode === "0") {
|
||||
that.log("任务成功啦~")
|
||||
} else {
|
||||
that.log(data.data.bizMsg)
|
||||
}
|
||||
resolve(data.data.bizCode)
|
||||
} else {
|
||||
that.log(data)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function superBrandTaskLottery() {
|
||||
return new Promise(async (resolve) => {
|
||||
const options = taskPostUrl("superBrandTaskLottery", `{"source":"secondfloor","activityId":${$.actid}}`)
|
||||
$.post(options, async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`);
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`);
|
||||
} else {
|
||||
data = JSON.parse(data);
|
||||
// that.log(data)
|
||||
if (data && data.code === "0") {
|
||||
if (data.data.bizCode === "TK000") {
|
||||
that.log(`获得 你猜获得了啥🐶 ${data.data.bizMsg}`)
|
||||
message += "<font color=\'#778899\' size=2>" + `获得 你猜获得了啥🐶 ${data.data.bizMsg}` + "</font>\n\n"
|
||||
} else {
|
||||
that.log(data.data.bizMsg)
|
||||
}
|
||||
} else {
|
||||
that.log(data)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
function taskPostUrl(functionid, body) {
|
||||
const time = Date.now();
|
||||
return {
|
||||
url: `https://api.m.jd.com/api?functionId=${functionid}&appid=ProductZ4Brand&client=wh5&t=${time}&body=${encodeURIComponent(body)}`,
|
||||
body: "",
|
||||
headers: {
|
||||
Accept: "application/json,text/plain, */*",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Accept-Language": "zh-cn",
|
||||
Connection: "keep-alive",
|
||||
Cookie: cookie,
|
||||
Host: "api.m.jd.com",
|
||||
Referer: "https://prodev.m.jd.com/mall/active/NrHM6Egy96gxeG4eb7vFX7fYXf3/index.html?activityId=1000007&encryptProjectId=cUNnf3E6aMLQcEQbTVxn8AyhjXb&assistEncryptAssignmentId=2jpJFvC9MBNC7Qsqrt8WzEEcVoiT&assistItemId=S5ijz_8ukVww&tttparams=GgS7lUeyJnTGF0IjoiMzMuMjUyNzYyIiwiZ0xuZyI6IjEwNy4xNjA1MDcifQ6%3D%3D&lng=107.147022&lat=33.255229&sid=e5150a3fdd017952350b4b41294b145w&un_area=27_2442_2444_31912",
|
||||
"User-Agent": "jdapp;android;9.4.4;10;3b78ecc3f490c7ba;network/UNKNOWN;model/M2006J10C;addressid/138543439;aid/3b78ecc3f490c7ba;oaid/7d5870c5a1696881;osVer/29;appBuild/85576;psn/3b78ecc3f490c7ba|541;psq/2;uid/3b78ecc3f490c7ba;adk/;ads/;pap/JA2015_311210|9.2.4|ANDROID 10;osv/10;pv/548.2;jdv/0|iosapp|t_335139774|appshare|CopyURL|1606277982178|1606277986;ref/com.jd.lib.personal.view.fragment.JDPersonalFragment;partner/xiaomi001;apprpd/MyJD_Main;Mozilla/5.0 (Linux; Android 10; M2006J10C Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function jsonParse(str) {
|
||||
if (typeof str == "string") {
|
||||
try {
|
||||
return JSON.parse(str);
|
||||
} catch (e) {
|
||||
that.log(e);
|
||||
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//我加的函数
|
||||
function postToDingTalk(messgae) {
|
||||
const dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=fa87e34729eaa6113fddfa857efebb477dea0a433d6eecfe93b1d3f5e24847b9"
|
||||
|
||||
const message1 = "" + messgae
|
||||
that.log(messgae)
|
||||
|
||||
const body = {
|
||||
"msgtype": "markdown",
|
||||
"markdown": {
|
||||
"title":"动动国创",
|
||||
"text": message1
|
||||
},
|
||||
"at": {
|
||||
"atMobiles": [],
|
||||
"isAtAll": false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
|
||||
try {
|
||||
that.log(resp)
|
||||
that.log(data)
|
||||
if (err) {
|
||||
that.log(JSON.stringify(err));
|
||||
$.logErr(err);
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
$.duckRes = JSON.parse(data);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
},"json")
|
||||
}
|
||||
|
||||
|
||||
function toDingtalk(urlmain, bodyMain) {
|
||||
return {
|
||||
url: urlmain,
|
||||
body:bodyMain,
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||
timeout: 10000,
|
||||
}
|
||||
}
|
||||
function getPic(){
|
||||
let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
|
||||
let address = "\n\n )
|
||||
address = address + code[pos] + ")"
|
||||
return address
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,710 @@
|
||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
//Node.js用户请在jdCookie.js处填写动动ck;
|
||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||
let helpAuthor=true; // 帮助作者
|
||||
const randomCount = $.isNode() ? 0 : 5;
|
||||
let jdNotify = true; // 是否关闭通知,false打开通知推送,true关闭通知推送
|
||||
//IOS等用户直接用NobyDa的jd cookie
|
||||
let cookiesArr = [], cookie = '', message = "";
|
||||
if ($.isNode()) {
|
||||
Object.keys(jdCookieNode).forEach((item) => {
|
||||
cookiesArr.push(jdCookieNode[item])
|
||||
})
|
||||
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.log = () => {
|
||||
};
|
||||
} else {
|
||||
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';
|
||||
const inviteCodes = [
|
||||
]
|
||||
!(async () => {
|
||||
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>动动赚赚</font> \n\n --- \n\n"
|
||||
$.tuanList = []
|
||||
await requireConfig();
|
||||
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;
|
||||
}
|
||||
for (let i = 0; i < cookiesArr.length; i++) {
|
||||
if (cookiesArr[i]) {
|
||||
cookie = cookiesArr[i];
|
||||
$.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
|
||||
$.index = i + 1;
|
||||
$.isLogin = true;
|
||||
$.nickName = '';
|
||||
await TotalBean();
|
||||
|
||||
username = $.UserName
|
||||
if ($.UserName == "jd_66ea783827d30"){
|
||||
username = "跑腿小弟"
|
||||
}
|
||||
if ($.UserName == "jd_4521b375ebb5d"){
|
||||
username = "锟锟"
|
||||
}
|
||||
if ($.UserName == "jd_542c10c0222bc"){
|
||||
username = "康康"
|
||||
}
|
||||
//加上名称
|
||||
message = message + "<font color=\'#778899\' size=2>【羊毛姐妹】<font color=\'#FFA500\' size=3>" + username + " </font> </font> \n\n "
|
||||
|
||||
that.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"});
|
||||
|
||||
if ($.isNode()) {
|
||||
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `动动账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
|
||||
}
|
||||
continue
|
||||
}
|
||||
await shareCodesFormat()
|
||||
await jdWish()
|
||||
}
|
||||
message += "----\n\n"
|
||||
}
|
||||
|
||||
for (let i = 0; i < cookiesArr.length; i++) {
|
||||
$.canHelp = true
|
||||
if (cookiesArr[i]) {
|
||||
cookie = cookiesArr[i];
|
||||
await getUserTuanInfo()
|
||||
await getHelpTuan();
|
||||
for (let j = 0; j < $.tuanList.length; ++j) {
|
||||
await helpFriendTuan($.tuanList[j])
|
||||
if(!$.canHelp) break
|
||||
}
|
||||
await setHelpTuan();
|
||||
}
|
||||
}
|
||||
})()
|
||||
.catch((e) => {
|
||||
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
|
||||
})
|
||||
.finally(() => {
|
||||
message = message + getPic()
|
||||
that.log(message)
|
||||
postToDingTalk(message)
|
||||
$.done();
|
||||
})
|
||||
|
||||
async function jdWish() {
|
||||
$.bean = 0
|
||||
$.tuan = null
|
||||
$.hasOpen = false
|
||||
await getTaskList(true)
|
||||
await getUserTuanInfo()
|
||||
if (!$.tuan) {
|
||||
await openTuan()
|
||||
if ($.hasOpen) await getUserTuanInfo()
|
||||
}
|
||||
if ($.tuan) $.tuanList.push($.tuan)
|
||||
await helpFriends()
|
||||
await getUserInfo()
|
||||
$.nowBean = parseInt($.totalBeanNum)
|
||||
$.nowNum = parseInt($.totalNum)
|
||||
for (let i = 0; i < $.taskList.length; ++i) {
|
||||
let task = $.taskList[i]
|
||||
if (task['taskId'] === 1 && task['status'] !== 2) {
|
||||
that.log(`去做任务:${task.taskName}`)
|
||||
await doTask({"taskId": task['taskId'],"mpVersion":"3.4.0"})
|
||||
} else if (task['taskId'] !== 3 && task['status'] !== 2) {
|
||||
that.log(`去做任务:${task.taskName}`)
|
||||
if(task['itemId'])
|
||||
await doTask({"itemId":task['itemId'],"taskId":task['taskId'],"mpVersion":"3.4.0"})
|
||||
else
|
||||
await doTask({"taskId": task['taskId'],"mpVersion":"3.4.0"})
|
||||
await $.wait(3000)
|
||||
}
|
||||
}
|
||||
await getTaskList();
|
||||
await showMsg();
|
||||
}
|
||||
|
||||
function showMsg() {
|
||||
return new Promise(async resolve => {
|
||||
message += "<font color=\'#778899\' size=2>" + `本次获得${parseInt($.totalBeanNum) - $.nowBean}京豆,${parseInt($.totalNum) - $.nowNum}金币\n` + "</font>\n\n"
|
||||
message += "<font color=\'#778899\' size=2>" + `累计获得${$.totalBeanNum}京豆,${$.totalNum}金币\n可兑换${$.totalNum / 10000}元无门槛红包` + "</font>\n\n"
|
||||
if (parseInt($.totalBeanNum) - $.nowBean > 0) {
|
||||
$.msg($.name, '', `动动账号${$.index} ${$.nickName}\n${message}`);
|
||||
} else {
|
||||
$.log(message)
|
||||
}
|
||||
// 云端大于10元无门槛红包时进行通知推送
|
||||
if ($.isNode() && $.totalNum >= 1000000) await notify.sendNotify(`${$.name} - 动动账号${$.index} - ${$.nickName}`, `动动账号${$.index} ${$.nickName}\n当前金币:${$.totalNum}个\n可兑换无门槛红包:${parseInt($.totalNum) / 10000}元\n`,)
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
// function getAuthorShareCode(url) {
|
||||
// return new Promise(resolve => {
|
||||
// $.get({url: `${url}?${new Date()}`,
|
||||
// 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"
|
||||
// }}, async (err, resp, data) => {
|
||||
// try {
|
||||
// if (err) {
|
||||
// } else {
|
||||
// $.tuanList = $.tuanList.concat(JSON.parse(data))
|
||||
// that.log(`作者助力码获取成功`)
|
||||
// }
|
||||
// } catch (e) {
|
||||
// $.logErr(e, resp)
|
||||
// } finally {
|
||||
// resolve();
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
function helpFriendTuan(body) {
|
||||
return new Promise(resolve => {
|
||||
$.get(taskTuanUrl("vvipclub_distributeBean_assist", body), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if (data.success) {
|
||||
that.log('助力成功')
|
||||
} else {
|
||||
if (data.resultCode === '9200008') that.log('不能助力自己')
|
||||
else if (data.resultCode === '9200011') that.log('已经助力过')
|
||||
else if (data.resultCode === '2400205') that.log('团已满')
|
||||
else if (data.resultCode === '2400203') {that.log('助力次数已耗尽');$.canHelp = false}
|
||||
else that.log(`未知错误`)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function getUserTuanInfo() {
|
||||
let body = {"paramData": {"channel": "FISSION_BEAN"}}
|
||||
return new Promise(resolve => {
|
||||
$.get(taskTuanUrl("distributeBeanActivityInfo", body), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if (data.data && !data.data.canStartNewAssist) {
|
||||
$.tuan = {
|
||||
"activityIdEncrypted": data.data.id,
|
||||
"assistStartRecordId": data.data.assistStartRecordId,
|
||||
"assistedPinEncrypted": data.data.encPin,
|
||||
"channel": "FISSION_BEAN"
|
||||
}
|
||||
$.tuanActId = data.data.id
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function openTuan() {
|
||||
let body = {"activityIdEncrypted": $.tuanActId, "channel": "FISSION_BEAN"}
|
||||
return new Promise(resolve => {
|
||||
$.get(taskTuanUrl("vvipclub_distributeBean_startAssist", body), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if (data['success']) {
|
||||
$.hasOpen = true
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function getUserInfo() {
|
||||
return new Promise(resolve => {
|
||||
$.get(taskUrl("interactIndex"), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
// if (data.data.shareTaskRes) {
|
||||
// that.log(`\n【动动账号${$.index}(${$.nickName || $.UserName})的${$.name}好友互助码】${data.data.shareTaskRes.itemId}\n`);
|
||||
// } else {
|
||||
// that.log(`\n\n已满5人助力或助力功能已下线,故暂时无${$.name}好友助力码\n\n`)
|
||||
// }
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function getTaskList(flag = false) {
|
||||
return new Promise(resolve => {
|
||||
$.get(taskUrl("interactTaskIndex"), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
$.taskList = data.data.taskDetailResList
|
||||
$.totalNum = data.data.totalNum
|
||||
$.totalBeanNum = data.data.totalBeanNum
|
||||
if (flag && $.taskList.filter(item => !!item && item['taskId']=== 3) && $.taskList.filter(item => !!item && item['taskId']=== 3).length) {
|
||||
$.shareId=$.taskList.filter(item => !!item && item['taskId']=== 3)[0]['itemId'];
|
||||
that.log(`\n【动动账号${$.index}(${$.nickName || $.UserName})的${$.name}好友互助码】${$.taskList.filter(item => !!item && item['taskId']=== 3)[0]['itemId']}\n`);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 完成
|
||||
function doTask(body, func = "doInteractTask") {
|
||||
// that.log(taskUrl("doInteractTask", body))
|
||||
return new Promise(resolve => {
|
||||
$.get(taskUrl(func, body), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
// that.log(data)
|
||||
if (func === "doInteractTask") {
|
||||
if (data.subCode === "S000") {
|
||||
that.log(`任务完成,获得 ${data.data.taskDetailResList[0].incomeAmountConf} 金币,${data.data.taskDetailResList[0].beanNum} 京豆`)
|
||||
$.bean += parseInt(data.data.taskDetailResList[0].beanNum)
|
||||
} else {
|
||||
that.log(`任务失败,错误信息:${data.message}`)
|
||||
}
|
||||
} else {
|
||||
that.log(`${data.data.helpResDesc}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async function helpFriends() {
|
||||
await getHelp();
|
||||
for (let code of $.newShareCodes) {
|
||||
if (!code) continue
|
||||
await doTask({"itemId": code, "taskId": "3", "mpVersion": "3.4.0"}, "doHelpTask")
|
||||
}
|
||||
await setHelp();
|
||||
}
|
||||
// function readShareCode() {
|
||||
// that.log(`开始`)
|
||||
// return new Promise(async resolve => {
|
||||
// $.get({url: `https://code.chiang.fun/api/v1/jd/jdzz/read/${randomCount}/`, 'timeout': 10000}, (err, resp, data) => {
|
||||
// try {
|
||||
// if (err) {
|
||||
// that.log(`${JSON.stringify(err)}`)
|
||||
// that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
// } else {
|
||||
// if (data) {
|
||||
// that.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`)
|
||||
// data = JSON.parse(data);
|
||||
// }
|
||||
// }
|
||||
// } catch (e) {
|
||||
// $.logErr(e, resp)
|
||||
// } finally {
|
||||
// resolve(data);
|
||||
// }
|
||||
// })
|
||||
// await $.wait(10000);
|
||||
// resolve()
|
||||
// })
|
||||
// }
|
||||
function getHelp() {
|
||||
$.newShareCodes = [];
|
||||
return new Promise(resolve => {
|
||||
$.get({
|
||||
url: "http://api.tyh52.com/act/get/jdzz/3"
|
||||
}, (err, resp, data) => {
|
||||
try {
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
if (data.code == 1) {
|
||||
let list = data.data;
|
||||
if (!(list instanceof Array)) {
|
||||
list = JSON.parse(list);
|
||||
}
|
||||
if (list.length > 0) {
|
||||
for (var i in list) {
|
||||
$.newShareCodes.push(list[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function setHelp() {
|
||||
return new Promise(resolve => {
|
||||
if ($.shareId) {
|
||||
$.get({
|
||||
url: "http://api.tyh52.com/act/set/jdzz/" + $.shareId
|
||||
}, (err, resp, data) => {
|
||||
try {
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
if (data.code == 1) {
|
||||
that.log("提交自己的邀請碼成功");
|
||||
} else {
|
||||
that.log("提交邀请码失败," + data.message);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function getHelpTuan() {
|
||||
$.tuanList = [];
|
||||
return new Promise(resolve => {
|
||||
$.get({
|
||||
url: "http://api.tyh52.com/act/get/jdzzTuan/3"
|
||||
}, (err, resp, data) => {
|
||||
try {
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
if (data.code == 1) {
|
||||
let list = data.data;
|
||||
if (!(list instanceof Array)) {
|
||||
list = JSON.parse(list);
|
||||
}
|
||||
if (list.length > 0) {
|
||||
for (var item of list) {
|
||||
let its=item.split('@');
|
||||
if(its.length==2){
|
||||
let tuan={
|
||||
"activityIdEncrypted": $.tuanActId,
|
||||
"assistStartRecordId": its[0],
|
||||
"assistedPinEncrypted": its[1],
|
||||
"channel": "FISSION_BEAN"
|
||||
}
|
||||
$.tuanList.push(tuan);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function setHelpTuan() {
|
||||
return new Promise(resolve => {
|
||||
if ($.tuan) {
|
||||
$.get({
|
||||
url: "http://api.tyh52.com/act/set/jdzzTuan/" + $.tuan.assistStartRecordId+'@'+$.tuan.assistedPinEncrypted
|
||||
}, (err, resp, data) => {
|
||||
try {
|
||||
if (data) {
|
||||
that.log(data);
|
||||
data = JSON.parse(data);
|
||||
if (data.code == 1) {
|
||||
that.log("提交自己的开团碼成功");
|
||||
}else{
|
||||
that.log("提交开团码失败," + data.message);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
//格式化助力码
|
||||
function shareCodesFormat() {
|
||||
return new Promise(async resolve => {
|
||||
// that.log(`第${$.index}个动动账号的助力码:::${$.shareCodesArr[$.index - 1]}`)
|
||||
$.newShareCodes = [];
|
||||
// if ($.shareCodesArr[$.index - 1]) {
|
||||
// $.newShareCodes = $.shareCodesArr[$.index - 1].split('@');
|
||||
// } else {
|
||||
// that.log(`由于您第${$.index}个动动账号未提供shareCode,将采纳本脚本自带的助力码\n`)
|
||||
// const tempIndex = $.index > inviteCodes.length ? (inviteCodes.length - 1) : ($.index - 1);
|
||||
// $.newShareCodes = inviteCodes[tempIndex].split('@');
|
||||
// }
|
||||
// const readShareCodeRes = await readShareCode();
|
||||
// if (readShareCodeRes && readShareCodeRes.code === 200) {
|
||||
// $.newShareCodes = [...new Set([...$.newShareCodes, ...(readShareCodeRes.data || [])])];
|
||||
// }
|
||||
// that.log(`第${$.index}个动动账号将要助力的好友${JSON.stringify($.newShareCodes)}`)
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
||||
function requireConfig() {
|
||||
return new Promise(resolve => {
|
||||
that.log(`开始获取${$.name}配置文件\n`);
|
||||
//Node.js用户请在jdCookie.js处填写动动ck;
|
||||
let shareCodes = [];
|
||||
if ($.isNode()) {
|
||||
if (process.env.JDZZ_SHARECODES) {
|
||||
if (process.env.JDZZ_SHARECODES.indexOf('\n') > -1) {
|
||||
shareCodes = process.env.JDZZ_SHARECODES.split('\n');
|
||||
} else {
|
||||
shareCodes = process.env.JDZZ_SHARECODES.split('&');
|
||||
}
|
||||
}
|
||||
}
|
||||
that.log(`共${cookiesArr.length}个动动账号\n`);
|
||||
$.shareCodesArr = [];
|
||||
if ($.isNode()) {
|
||||
Object.keys(shareCodes).forEach((item) => {
|
||||
if (shareCodes[item]) {
|
||||
$.shareCodesArr.push(shareCodes[item])
|
||||
}
|
||||
})
|
||||
}
|
||||
that.log(`您提供了${$.shareCodesArr.length}个账号的${$.name}助力码\n`);
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
|
||||
function taskUrl(functionId, body = {}) {
|
||||
return {
|
||||
url: `${JD_API_HOST}?functionId=${functionId}&body=${escape(JSON.stringify(body))}&client=wh5&clientVersion=9.1.0`,
|
||||
headers: {
|
||||
'Cookie': cookie,
|
||||
'Host': 'api.m.jd.com',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'application/json',
|
||||
'Referer': 'http://wq.jd.com/wxapp/pages/hd-interaction/index/index',
|
||||
'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
|
||||
'Accept-Language': 'zh-cn',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function taskTuanUrl(function_id, body = {}) {
|
||||
return {
|
||||
url: `${JD_API_HOST}?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=swat_miniprogram&osVersion=5.0.0&clientVersion=3.1.3&fromType=wxapp×tamp=${new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000}`,
|
||||
headers: {
|
||||
"Accept": "*/*",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Accept-Language": "zh-cn",
|
||||
"Connection": "keep-alive",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Host": "api.m.jd.com",
|
||||
"Referer": "https://servicewechat.com/wxa5bf5ee667d91626/108/page-frame.html",
|
||||
"Cookie": cookie,
|
||||
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function taskPostUrl(function_id, body = {}) {
|
||||
return {
|
||||
url: `${JD_API_HOST}?functionId=${function_id}`,
|
||||
body: body,
|
||||
headers: {
|
||||
"Cookie": cookie,
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function TotalBean() {
|
||||
return new Promise(async resolve => {
|
||||
const options = {
|
||||
"url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
|
||||
"headers": {
|
||||
"Accept": "application/json,text/plain, */*",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Accept-Language": "zh-cn",
|
||||
"Connection": "keep-alive",
|
||||
"Cookie": cookie,
|
||||
"Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
|
||||
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0")
|
||||
}
|
||||
}
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
if (data['retcode'] === 13) {
|
||||
$.isLogin = false; //cookie过期
|
||||
return
|
||||
}
|
||||
if (data['retcode'] === 0) {
|
||||
$.nickName = (data['base'] && data['base'].nickname) || $.UserName;
|
||||
} else {
|
||||
$.nickName = $.UserName
|
||||
}
|
||||
} else {
|
||||
that.log(`动动服务器返回空数据`)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function safeGet(data) {
|
||||
try {
|
||||
if (typeof JSON.parse(data) == "object") {
|
||||
return true;
|
||||
}
|
||||
} catch (e) {
|
||||
that.log(e);
|
||||
that.log(`动动服务器访问数据为空,请检查自身设备网络情况`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function jsonParse(str) {
|
||||
if (typeof str == "string") {
|
||||
try {
|
||||
return JSON.parse(str);
|
||||
} catch (e) {
|
||||
that.log(e);
|
||||
$.msg($.name, '', '不要在BoxJS手动复制粘贴修改cookie')
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//我加的函数
|
||||
function postToDingTalk(messgae) {
|
||||
const dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=18444b555747aad3381bc1d1e3dea72b03158e152a846f818d82a1ca946bd430"
|
||||
|
||||
const message1 = "" + messgae
|
||||
that.log(messgae)
|
||||
|
||||
const body = {
|
||||
"msgtype": "markdown",
|
||||
"markdown": {
|
||||
"title":"动动赚赚",
|
||||
"text": message1
|
||||
},
|
||||
"at": {
|
||||
"atMobiles": [],
|
||||
"isAtAll": false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
|
||||
try {
|
||||
that.log(resp)
|
||||
that.log(data)
|
||||
if (err) {
|
||||
that.log(JSON.stringify(err));
|
||||
$.logErr(err);
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
$.duckRes = JSON.parse(data);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
},"json")
|
||||
}
|
||||
|
||||
|
||||
function toDingtalk(urlmain, bodyMain) {
|
||||
return {
|
||||
url: urlmain,
|
||||
body:bodyMain,
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||
timeout: 10000,
|
||||
}
|
||||
}
|
||||
|
||||
function getPic(){
|
||||
let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
|
||||
let address = "\n\n )
|
||||
address = address + code[pos] + ")"
|
||||
return address
|
||||
}
|
||||
@@ -0,0 +1,937 @@
|
||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
//Node.js用户请在jdCookie.js处填写京东ck;
|
||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||
|
||||
//IOS等用户直接用NobyDa的jd cookie
|
||||
let cookiesArr = [], cookie = '', allMsg = ``;
|
||||
if ($.isNode()) {
|
||||
Object.keys(jdCookieNode).forEach((item) => {
|
||||
cookiesArr.push(jdCookieNode[item])
|
||||
})
|
||||
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.log = () => {};
|
||||
} else {
|
||||
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
|
||||
}
|
||||
|
||||
let jdNotify = true;//是否开启静默运行,默认true
|
||||
let sellFruit = true;//是否卖出金果得到金币,默认'false'
|
||||
const JD_API_HOST = 'https://ms.jr.jd.com/gw/generic/uc/h5/m';
|
||||
let userInfo = null, taskInfo = [], message = "", subTitle = '', fruitTotal = 0;
|
||||
!(async () => {
|
||||
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"});
|
||||
}
|
||||
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>动动摇钱树</font> \n\n --- \n\n"
|
||||
for (let i = 0; i < cookiesArr.length; i++) {
|
||||
if (cookiesArr[i]) {
|
||||
cookie = cookiesArr[i];
|
||||
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
||||
$.index = i + 1;
|
||||
$.isLogin = true;
|
||||
$.nickName = '';
|
||||
|
||||
|
||||
username = $.UserName
|
||||
if ($.UserName == "jd_66ea783827d30"){
|
||||
username = "跑腿小弟"
|
||||
}
|
||||
if ($.UserName == "jd_4521b375ebb5d"){
|
||||
username = "锟锟"
|
||||
}
|
||||
if ($.UserName == "jd_542c10c0222bc"){
|
||||
username = "康康"
|
||||
}
|
||||
//加上名称
|
||||
message = message + "<font color=\'#778899\' size=2>【羊毛姐妹】<font color=\'#FFA500\' size=3>" + username + " </font> </font> \n\n "
|
||||
|
||||
|
||||
await TotalBean();
|
||||
that.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"});
|
||||
|
||||
if ($.isNode()) {
|
||||
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
|
||||
}
|
||||
continue
|
||||
}
|
||||
subTitle = '';
|
||||
await jd_moneyTree();
|
||||
}
|
||||
}
|
||||
if (allMsg) {
|
||||
jdNotify = $.isNode() ? (process.env.MONEYTREE_NOTIFY_CONTROL ? process.env.MONEYTREE_NOTIFY_CONTROL : jdNotify) : ($.getdata('jdMoneyTreeNotify') ? $.getdata('jdMoneyTreeNotify') : jdNotify);
|
||||
if (!jdNotify || jdNotify === 'false') {
|
||||
if ($.isNode()) await notify.sendNotify($.name, allMsg);
|
||||
$.msg($.name, '', allMsg)
|
||||
}
|
||||
}
|
||||
})()
|
||||
.catch((e) => {
|
||||
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
|
||||
})
|
||||
.finally(() => {
|
||||
message += getPic()
|
||||
taht.log(message)
|
||||
postToDingTalk(message)
|
||||
$.done();
|
||||
})
|
||||
|
||||
async function jd_moneyTree() {
|
||||
try {
|
||||
const userRes = await user_info();
|
||||
if (!userRes || !userRes.realName) return
|
||||
await signEveryDay();
|
||||
await dayWork();
|
||||
await harvest();
|
||||
await sell();
|
||||
await myWealth();
|
||||
await stealFriendFruit()
|
||||
|
||||
$.log(`\n${message}\n`);
|
||||
} catch (e) {
|
||||
$.logErr(e)
|
||||
}
|
||||
}
|
||||
|
||||
function user_info() {
|
||||
that.log('初始化摇钱树个人信息');
|
||||
const params = {
|
||||
"sharePin": "",
|
||||
"shareType": 1,
|
||||
"channelLV": "",
|
||||
"source": 2,
|
||||
"riskDeviceParam": {
|
||||
"eid": "",
|
||||
"fp": "",
|
||||
"sdkToken": "",
|
||||
"token": "",
|
||||
"jstub": "",
|
||||
"appType": "2",
|
||||
}
|
||||
}
|
||||
params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);
|
||||
await $.wait(5000); //歇口气儿, 不然会报操作频繁
|
||||
return new Promise((resolve, reject) => {
|
||||
$.post(taskurl('login', params), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log("\n摇钱树京东API请求失败 ‼️‼️")
|
||||
that.log(JSON.stringify(err));
|
||||
} else {
|
||||
if (data) {
|
||||
const res = JSON.parse(data);
|
||||
if (res && res.resultCode === 0) {
|
||||
$.isLogin = true;
|
||||
that.log('resultCode为0')
|
||||
if (res.resultData.data) {
|
||||
userInfo = res.resultData.data;
|
||||
// userInfo.realName = null;
|
||||
if (userInfo.realName) {
|
||||
// that.log(`助力码sharePin为::${userInfo.sharePin}`);
|
||||
$.treeMsgTime = userInfo.sharePin;
|
||||
subTitle = `【${userInfo.nick}】${userInfo.treeInfo.treeName}`;
|
||||
message += "<font color=\'#778899\' size=2>" + `【我的金果数量】${userInfo.treeInfo.fruit}\n` + "</font>\n\n";
|
||||
message += "<font color=\'#778899\' size=2>" + `【我的金币数量】${userInfo.treeInfo.coin}\n` + "</font>\n\n";
|
||||
message += "<font color=\'#778899\' size=2>" + `【距离${userInfo.treeInfo.level + 1}级摇钱树还差】${userInfo.treeInfo.progressLeft}\n` + "</font>\n\n";
|
||||
} else {
|
||||
$.log(`京东账号${$.index}${$.UserName}运行失败\n此账号未实名认证或者未参与过此活动\n①如未参与活动,请先去京东app参加摇钱树活动\n入口:我的->游戏与互动->查看更多\n②如未实名认证,请进行实名认证`)
|
||||
// $.msg($.name, `【提示】京东账号${$.index}${$.UserName}运行失败`, '此账号未实名认证或者未参与过此活动\n①如未参与活动,请先去京东app参加摇钱树活动\n入口:我的->游戏与互动->查看更多\n②如未实名认证,请进行实名认证', {"open-url": "openApp.jdMobile://"});
|
||||
message += "<font color=\'#778899\' size=2>" + `运行失败\n此账号未实名认证或者未参与过此活动\n①如未参与活动,请先去京东app参加摇钱树活动\n入口:我的->游戏与互动->查看更多\n②如未实名认证,请进行实名认证` + "</font>\n\n"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
that.log(`其他情况::${JSON.stringify(res)}`);
|
||||
}
|
||||
} else {
|
||||
that.log(`京豆api返回数据为空,请检查自身原因`)
|
||||
}
|
||||
}
|
||||
} catch (eor) {
|
||||
$.logErr(eor, err)
|
||||
} finally {
|
||||
resolve(userInfo)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async function dayWork() {
|
||||
that.log(`开始做任务userInfo了\n`)
|
||||
return new Promise(async resolve => {
|
||||
const data = {
|
||||
"source": 0,
|
||||
"linkMissionIds": ["666", "667"],
|
||||
"LinkMissionIdValues": [7, 7],
|
||||
"riskDeviceParam": {
|
||||
"eid": "",
|
||||
"dt": "",
|
||||
"ma": "",
|
||||
"im": "",
|
||||
"os": "",
|
||||
"osv": "",
|
||||
"ip": "",
|
||||
"apid": "",
|
||||
"ia": "",
|
||||
"uu": "",
|
||||
"cv": "",
|
||||
"nt": "",
|
||||
"at": "1",
|
||||
"fp": "",
|
||||
"token": ""
|
||||
}
|
||||
};
|
||||
let response = await request('dayWork', data);
|
||||
// that.log(`获取任务的信息:${JSON.stringify(response)}\n`)
|
||||
let canTask = [];
|
||||
taskInfo = [];
|
||||
if (response && response.resultCode === 0) {
|
||||
if (response.resultData.code === '200') {
|
||||
response.resultData.data.map((item) => {
|
||||
if (item.prizeType === 2) {
|
||||
canTask.push(item);
|
||||
}
|
||||
if (item.workType === 7 && item.prizeType === 0) {
|
||||
// missionId.push(item.mid);
|
||||
taskInfo.push(item);
|
||||
}
|
||||
// if (item.workType === 7 && item.prizeType === 0) {
|
||||
// missionId2 = item.mid;
|
||||
// }
|
||||
})
|
||||
}
|
||||
}
|
||||
that.log(`canTask::${JSON.stringify(canTask)}\n`)
|
||||
that.log(`浏览任务列表taskInfo::${JSON.stringify(taskInfo)}\n`)
|
||||
for (let item of canTask) {
|
||||
if (item.workType === 1) {
|
||||
// 签到任务
|
||||
// let signRes = await sign();
|
||||
// that.log(`签到结果:${JSON.stringify(signRes)}`);
|
||||
if (item.workStatus === 0) {
|
||||
// const data = {"source":2,"workType":1,"opType":2};
|
||||
// let signRes = await request('doWork', data);
|
||||
let signRes = await sign();
|
||||
that.log(`三餐签到结果:${JSON.stringify(signRes)}`);
|
||||
} else if (item.workStatus === 2) {
|
||||
that.log(`三餐签到任务已经做过`)
|
||||
} else if (item.workStatus === -1) {
|
||||
that.log(`三餐签到任务不在时间范围内`)
|
||||
}
|
||||
} else if (item.workType === 2) {
|
||||
// 分享任务
|
||||
if (item.workStatus === 0) {
|
||||
// share();
|
||||
const data = {"source": 0, "workType": 2, "opType": 1};
|
||||
//开始分享
|
||||
// let shareRes = await request('doWork', data);
|
||||
let shareRes = await share(data);
|
||||
that.log(`开始分享的动作:${JSON.stringify(shareRes)}`);
|
||||
const b = {"source": 0, "workType": 2, "opType": 2};
|
||||
// let shareResJL = await request('doWork', b);
|
||||
let shareResJL = await share(b);
|
||||
that.log(`领取分享后的奖励:${JSON.stringify(shareResJL)}`)
|
||||
} else if (item.workStatus === 2) {
|
||||
that.log(`分享任务已经做过`)
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let task of taskInfo) {
|
||||
if (task.mid && task.workStatus === 0) {
|
||||
that.log('开始做浏览任务');
|
||||
// yield setUserLinkStatus(task.mid);
|
||||
let aa = await setUserLinkStatus(task.mid);
|
||||
that.log(`aaa${JSON.stringify(aa)}`);
|
||||
} else if (task.mid && task.workStatus === 1) {
|
||||
that.log(`workStatus === 1开始领取浏览后的奖励:mid:${task.mid}`);
|
||||
let receiveAwardRes = await receiveAward(task.mid);
|
||||
that.log(`领取浏览任务奖励成功:${JSON.stringify(receiveAwardRes)}`)
|
||||
} else if (task.mid && task.workStatus === 2) {
|
||||
that.log('所有的浏览任务都做完了')
|
||||
}
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
|
||||
function harvest() {
|
||||
if (!userInfo) return
|
||||
const data = {
|
||||
"source": 2,
|
||||
"sharePin": "",
|
||||
"userId": userInfo.userInfo,
|
||||
"userToken": userInfo.userToken,
|
||||
"shareType": 1,
|
||||
"channel": "",
|
||||
"riskDeviceParam": {
|
||||
"eid": "",
|
||||
"appType": 2,
|
||||
"fp": "",
|
||||
"jstub": "",
|
||||
"sdkToken": "",
|
||||
"token": ""
|
||||
}
|
||||
}
|
||||
data.riskDeviceParam = JSON.stringify(data.riskDeviceParam);
|
||||
return new Promise((rs, rj) => {
|
||||
request('harvest', data).then((harvestRes) => {
|
||||
if (harvestRes && harvestRes.resultCode === 0 && harvestRes.resultData.code === '200') {
|
||||
that.log(`\n收获金果成功:${JSON.stringify(harvestRes)}\n`)
|
||||
let data = harvestRes.resultData.data;
|
||||
message +="<font color=\'#778899\' size=2>" + `【距离${data.treeInfo.level + 1}级摇钱树还差】${data.treeInfo.progressLeft}\n` + "</font>\n\n";
|
||||
fruitTotal = data.treeInfo.fruit;
|
||||
} else {
|
||||
that.log(`\n收获金果异常:${JSON.stringify(harvestRes)}`)
|
||||
}
|
||||
rs()
|
||||
// gen.next();
|
||||
})
|
||||
})
|
||||
// request('harvest', data).then((harvestRes) => {
|
||||
// if (harvestRes.resultCode === 0 && harvestRes.resultData.code === '200') {
|
||||
// let data = harvestRes.resultData.data;
|
||||
// message += `【距离${data.treeInfo.level + 1}级摇钱树还差】${data.treeInfo.progressLeft}\n`;
|
||||
// fruitTotal = data.treeInfo.fruit;
|
||||
// gen.next();
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
//卖出金果,得到金币
|
||||
function sell() {
|
||||
return new Promise((rs, rj) => {
|
||||
const params = {
|
||||
"source": 2,
|
||||
"jtCount": 7.000000000000001,
|
||||
"riskDeviceParam": {
|
||||
"eid": "",
|
||||
"fp": "",
|
||||
"sdkToken": "",
|
||||
"token": "",
|
||||
"jstub": "",
|
||||
"appType": 2,
|
||||
}
|
||||
}
|
||||
params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);//这一步,不可省略,否则提交会报错(和login接口一样)
|
||||
that.log(`目前金果数量${fruitTotal}`)
|
||||
sellFruit = $.isNode() ? (process.env.MONEY_TREE_SELL_FRUIT ? process.env.MONEY_TREE_SELL_FRUIT : `${sellFruit}`) : ($.getdata('MONEY_TREE_SELL_FRUIT') ? $.getdata('MONEY_TREE_SELL_FRUIT') : `${sellFruit}`);
|
||||
if (sellFruit && sellFruit === 'false') {
|
||||
that.log(`\n设置的不卖出金果\n`)
|
||||
rs()
|
||||
return
|
||||
}
|
||||
if (fruitTotal >= 8000 * 7) {
|
||||
if (userInfo['jtRest'] === 0) {
|
||||
that.log(`\n今日已卖出5.6万金果(已达上限),获得0.07金贴\n`)
|
||||
rs()
|
||||
return
|
||||
}
|
||||
request('sell', params).then((sellRes) => {
|
||||
if (sellRes && sellRes['resultCode'] === 0) {
|
||||
if (sellRes['resultData']['code'] === '200') {
|
||||
if (sellRes['resultData']['data']['sell'] === 0) {
|
||||
that.log(`卖出金果成功,获得0.07金贴\n`);
|
||||
allMsg += `账号${$.index}:${$.nickName || $.UserName}\n今日成功卖出5.6万金果,获得0.07金贴${$.index !== cookiesArr.length ? '\n\n' : ''}`
|
||||
} else {
|
||||
that.log(`卖出金果失败:${JSON.stringify(sellRes)}\n`)
|
||||
}
|
||||
}
|
||||
}
|
||||
rs()
|
||||
})
|
||||
} else {
|
||||
that.log(`当前金果数量不够兑换 0.07金贴\n`);
|
||||
rs()
|
||||
}
|
||||
// request('sell', params).then(response => {
|
||||
// rs(response);
|
||||
// })
|
||||
})
|
||||
// request('sell', params).then((sellRes) => {
|
||||
// that.log(`卖出金果结果:${JSON.stringify(sellRes)}\n`)
|
||||
// gen.next();
|
||||
// })
|
||||
}
|
||||
|
||||
//获取金币和金果数量
|
||||
function myWealth() {
|
||||
return new Promise((resolve) => {
|
||||
const params = {
|
||||
"source": 2,
|
||||
"riskDeviceParam": {
|
||||
"eid": "",
|
||||
"dt": "",
|
||||
"ma": "",
|
||||
"im": "",
|
||||
"os": "",
|
||||
"osv": "",
|
||||
"ip": "",
|
||||
"apid": "",
|
||||
"ia": "",
|
||||
"uu": "",
|
||||
"cv": "",
|
||||
"nt": "",
|
||||
"at": "1",
|
||||
"fp": "",
|
||||
"token": ""
|
||||
}
|
||||
}
|
||||
params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);//这一步,不可省略,否则提交会报错(和login接口一样)
|
||||
request('myWealth', params).then(res => {
|
||||
if (res && res.resultCode === 0 && res.resultData.code === '200') {
|
||||
that.log(`金贴和金果数量::${JSON.stringify(res)}`);
|
||||
message += "<font color=\'#778899\' size=2>" + `【我的金果数量】${res.resultData.data.gaAmount}\n` + "</font>\n\n";
|
||||
message += "<font color=\'#778899\' size=2>" + `【我的金贴数量】${res.resultData.data.gcAmount / 100}\n` + "</font>\n\n";
|
||||
}
|
||||
resolve();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function sign() {
|
||||
that.log('开始三餐签到')
|
||||
const data = {"source": 2, "workType": 1, "opType": 2};
|
||||
return new Promise((rs, rj) => {
|
||||
request('doWork', data).then(response => {
|
||||
rs(response);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function signIndex() {
|
||||
const params = {
|
||||
"source": 0,
|
||||
"riskDeviceParam": {
|
||||
"eid": "",
|
||||
"dt": "",
|
||||
"ma": "",
|
||||
"im": "",
|
||||
"os": "",
|
||||
"osv": "",
|
||||
"ip": "",
|
||||
"apid": "",
|
||||
"ia": "",
|
||||
"uu": "",
|
||||
"cv": "",
|
||||
"nt": "",
|
||||
"at": "1",
|
||||
"fp": "",
|
||||
"token": ""
|
||||
}
|
||||
}
|
||||
return new Promise((rs, rj) => {
|
||||
request('signIndex', params).then(response => {
|
||||
rs(response);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async function signEveryDay() {
|
||||
return new Promise(async (resolve) => {
|
||||
try {
|
||||
let signIndexRes = await signIndex();
|
||||
if (signIndexRes.resultCode === 0) {
|
||||
that.log(`每日签到条件查询:${signIndexRes.resultData.data.canSign === 2 ? '可以签到' : '已经签到过了'}`);
|
||||
if (signIndexRes.resultData && signIndexRes.resultData.data.canSign == 2) {
|
||||
that.log('准备每日签到')
|
||||
let signOneRes = await signOne(signIndexRes.resultData.data.signDay);
|
||||
that.log(`第${signIndexRes.resultData.data.signDay}日签到结果:${JSON.stringify(signOneRes)}`);
|
||||
if (signIndexRes.resultData.data.signDay === 7) {
|
||||
let getSignAwardRes = await getSignAward();
|
||||
that.log(`店铺券(49-10)领取结果:${JSON.stringify(getSignAwardRes)}`)
|
||||
if (getSignAwardRes.resultCode === 0 && getSignAwardRes.data.code === 0) {
|
||||
message += "<font color=\'#778899\' size=2>" + `【7日签到奖励领取】${getSignAwardRes.datamessage}\n` + "</font>\n\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e);
|
||||
} finally {
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function signOne(signDay) {
|
||||
const params = {
|
||||
"source": 0,
|
||||
"signDay": signDay,
|
||||
"riskDeviceParam": {
|
||||
"eid": "",
|
||||
"dt": "",
|
||||
"ma": "",
|
||||
"im": "",
|
||||
"os": "",
|
||||
"osv": "",
|
||||
"ip": "",
|
||||
"apid": "",
|
||||
"ia": "",
|
||||
"uu": "",
|
||||
"cv": "",
|
||||
"nt": "",
|
||||
"at": "1",
|
||||
"fp": "",
|
||||
"token": ""
|
||||
}
|
||||
}
|
||||
return new Promise((rs, rj) => {
|
||||
request('signOne', params).then(response => {
|
||||
rs(response);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 领取七日签到后的奖励(店铺优惠券)
|
||||
function getSignAward() {
|
||||
const params = {
|
||||
"source": 2,
|
||||
"awardType": 2,
|
||||
"deviceRiskParam": 1,
|
||||
"riskDeviceParam": {
|
||||
"eid": "",
|
||||
"dt": "",
|
||||
"ma": "",
|
||||
"im": "",
|
||||
"os": "",
|
||||
"osv": "",
|
||||
"ip": "",
|
||||
"apid": "",
|
||||
"ia": "",
|
||||
"uu": "",
|
||||
"cv": "",
|
||||
"nt": "",
|
||||
"at": "1",
|
||||
"fp": "",
|
||||
"token": ""
|
||||
}
|
||||
}
|
||||
return new Promise((rs, rj) => {
|
||||
request('getSignAward', params).then(response => {
|
||||
rs(response);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 浏览任务
|
||||
async function setUserLinkStatus(missionId) {
|
||||
let index = 0;
|
||||
do {
|
||||
const params = {
|
||||
"missionId": missionId,
|
||||
"pushStatus": 1,
|
||||
"keyValue": index,
|
||||
"riskDeviceParam": {
|
||||
"eid": "",
|
||||
"dt": "",
|
||||
"ma": "",
|
||||
"im": "",
|
||||
"os": "",
|
||||
"osv": "",
|
||||
"ip": "",
|
||||
"apid": "",
|
||||
"ia": "",
|
||||
"uu": "",
|
||||
"cv": "",
|
||||
"nt": "",
|
||||
"at": "1",
|
||||
"fp": "",
|
||||
"token": ""
|
||||
}
|
||||
}
|
||||
let response = await request('setUserLinkStatus', params)
|
||||
that.log(`missionId为${missionId}::第${index + 1}次浏览活动完成: ${JSON.stringify(response)}`);
|
||||
// if (resultCode === 0) {
|
||||
// let sportRevardResult = await getSportReward();
|
||||
// that.log(`领取遛狗奖励完成: ${JSON.stringify(sportRevardResult)}`);
|
||||
// }
|
||||
index++;
|
||||
} while (index < 7) //不知道结束的条件,目前写死循环7次吧
|
||||
that.log('浏览店铺任务结束');
|
||||
that.log('开始领取浏览后的奖励');
|
||||
let receiveAwardRes = await receiveAward(missionId);
|
||||
that.log(`领取浏览任务奖励成功:${JSON.stringify(receiveAwardRes)}`)
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(receiveAwardRes);
|
||||
})
|
||||
// gen.next();
|
||||
}
|
||||
|
||||
// 领取浏览后的奖励
|
||||
function receiveAward(mid) {
|
||||
if (!mid) return
|
||||
mid = mid + "";
|
||||
const params = {
|
||||
"source": 0,
|
||||
"workType": 7,
|
||||
"opType": 2,
|
||||
"mid": mid,
|
||||
"riskDeviceParam": {
|
||||
"eid": "",
|
||||
"dt": "",
|
||||
"ma": "",
|
||||
"im": "",
|
||||
"os": "",
|
||||
"osv": "",
|
||||
"ip": "",
|
||||
"apid": "",
|
||||
"ia": "",
|
||||
"uu": "",
|
||||
"cv": "",
|
||||
"nt": "",
|
||||
"at": "1",
|
||||
"fp": "",
|
||||
"token": ""
|
||||
}
|
||||
}
|
||||
return new Promise((rs, rj) => {
|
||||
request('doWork', params).then(response => {
|
||||
rs(response);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function share(data) {
|
||||
if (data.opType === 1) {
|
||||
that.log(`开始做分享任务\n`)
|
||||
} else {
|
||||
that.log(`开始做领取分享后的奖励\n`)
|
||||
}
|
||||
return new Promise((rs, rj) => {
|
||||
request('doWork', data).then(response => {
|
||||
rs(response);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async function stealFriendFruit() {
|
||||
await friendRank();
|
||||
if ($.friendRankList && $.friendRankList.length > 0) {
|
||||
const canSteal = $.friendRankList.some((item) => {
|
||||
const boxShareCode = item.steal
|
||||
return (boxShareCode === true);
|
||||
});
|
||||
if (canSteal) {
|
||||
$.amount = 0;
|
||||
for (let item of $.friendRankList) {
|
||||
if (!item.self && item.steal) {
|
||||
await friendTreeRoom(item.encryPin);
|
||||
const stealFruitRes = await stealFruit(item.encryPin, $.friendTree.stoleInfo);
|
||||
if (stealFruitRes && stealFruitRes.resultCode === 0 && stealFruitRes.resultData.code === '200') {
|
||||
$.amount += stealFruitRes.resultData.data.amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
message +="<font color=\'#778899\' size=2>" + `【偷取好友金果】共${$.amount}个\n` + "</font>\n\n";
|
||||
} else {
|
||||
that.log(`今日已偷过好友的金果了,暂无好友可偷,请明天再来\n`)
|
||||
}
|
||||
} else {
|
||||
that.log(`您暂无好友,故跳过`);
|
||||
}
|
||||
}
|
||||
|
||||
//获取好友列表API
|
||||
async function friendRank() {
|
||||
await $.wait(1000); //歇口气儿, 不然会报操作频繁
|
||||
const params = {
|
||||
"source": 2,
|
||||
"riskDeviceParam": {
|
||||
"eid": "",
|
||||
"dt": "",
|
||||
"ma": "",
|
||||
"im": "",
|
||||
"os": "",
|
||||
"osv": "",
|
||||
"ip": "",
|
||||
"apid": "",
|
||||
"ia": "",
|
||||
"uu": "",
|
||||
"cv": "",
|
||||
"nt": "",
|
||||
"at": "1",
|
||||
"fp": "",
|
||||
"token": ""
|
||||
}
|
||||
}
|
||||
params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);//这一步,不可省略,否则提交会报错(和login接口一样)
|
||||
return new Promise((resolve, reject) => {
|
||||
$.post(taskurl('friendRank', params), (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log("\n摇钱树京东API请求失败 ‼️‼️");
|
||||
that.log(JSON.stringify(err));
|
||||
$.logErr(err);
|
||||
} else {
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
$.friendRankList = data.resultData.data;
|
||||
} else {
|
||||
that.log(`京豆api返回数据为空,请检查自身原因`)
|
||||
}
|
||||
}
|
||||
} catch (eor) {
|
||||
$.logErr(eor, err)
|
||||
} finally {
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 进入好友房间API
|
||||
async function friendTreeRoom(friendPin) {
|
||||
await $.wait(1000); //歇口气儿, 不然会报操作频繁
|
||||
const params = {
|
||||
"source": 2,
|
||||
"friendPin": friendPin,
|
||||
"riskDeviceParam": {
|
||||
"eid": "",
|
||||
"dt": "",
|
||||
"ma": "",
|
||||
"im": "",
|
||||
"os": "",
|
||||
"osv": "",
|
||||
"ip": "",
|
||||
"apid": "",
|
||||
"ia": "",
|
||||
"uu": "",
|
||||
"cv": "",
|
||||
"nt": "",
|
||||
"at": "1",
|
||||
"fp": "",
|
||||
"token": ""
|
||||
}
|
||||
}
|
||||
params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);//这一步,不可省略,否则提交会报错(和login接口一样)
|
||||
return new Promise((resolve, reject) => {
|
||||
$.post(taskurl('friendTree', params), (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log("\n摇钱树京东API请求失败 ‼️‼️");
|
||||
that.log(JSON.stringify(err));
|
||||
$.logErr(err);
|
||||
} else {
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
$.friendTree = data.resultData.data;
|
||||
} else {
|
||||
that.log(`京豆api返回数据为空,请检查自身原因`)
|
||||
}
|
||||
}
|
||||
} catch (eor) {
|
||||
$.logErr(eor, err)
|
||||
} finally {
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
//偷好友金果API
|
||||
async function stealFruit(friendPin, stoleId) {
|
||||
await $.wait(1000); //歇口气儿, 不然会报操作频繁
|
||||
const params = {
|
||||
"source": 2,
|
||||
"friendPin": friendPin,
|
||||
"stoleId": stoleId,
|
||||
"riskDeviceParam": {
|
||||
"eid": "",
|
||||
"dt": "",
|
||||
"ma": "",
|
||||
"im": "",
|
||||
"os": "",
|
||||
"osv": "",
|
||||
"ip": "",
|
||||
"apid": "",
|
||||
"ia": "",
|
||||
"uu": "",
|
||||
"cv": "",
|
||||
"nt": "",
|
||||
"at": "1",
|
||||
"fp": "",
|
||||
"token": ""
|
||||
}
|
||||
}
|
||||
params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);//这一步,不可省略,否则提交会报错(和login接口一样)
|
||||
return new Promise((resolve, reject) => {
|
||||
$.post(taskurl('stealFruit', params), (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log("\n摇钱树京东API请求失败 ‼️‼️");
|
||||
that.log(JSON.stringify(err));
|
||||
$.logErr(err);
|
||||
} else {
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
} else {
|
||||
that.log(`京豆api返回数据为空,请检查自身原因`)
|
||||
}
|
||||
}
|
||||
} catch (eor) {
|
||||
$.logErr(eor, err)
|
||||
} finally {
|
||||
resolve(data)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
async function request(function_id, body = {}) {
|
||||
await $.wait(1000); //歇口气儿, 不然会报操作频繁
|
||||
return new Promise((resolve, reject) => {
|
||||
$.post(taskurl(function_id, body), (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log("\n摇钱树京东API请求失败 ‼️‼️");
|
||||
that.log(JSON.stringify(err));
|
||||
$.logErr(err);
|
||||
} else {
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
} else {
|
||||
that.log(`京豆api返回数据为空,请检查自身原因`)
|
||||
}
|
||||
}
|
||||
} catch (eor) {
|
||||
$.msg("摇钱树-初始化个人信息" + eor.name + "‼️", JSON.stringify(eor), eor.message)
|
||||
} finally {
|
||||
resolve(data)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function taskurl(function_id, body) {
|
||||
return {
|
||||
url: JD_API_HOST + '/' + function_id + '?_=' + new Date().getTime() * 1000,
|
||||
body: `reqData=${function_id === 'harvest' || function_id === 'login' || function_id === 'signIndex' || function_id === 'signOne' || function_id === 'setUserLinkStatus' || function_id === 'dayWork' || function_id === 'getSignAward' || function_id === 'sell' || function_id === 'friendRank' || function_id === 'friendTree' || function_id === 'stealFruit' ? encodeURIComponent(JSON.stringify(body)) : JSON.stringify(body)}`,
|
||||
headers: {
|
||||
'Accept': `application/json`,
|
||||
'Origin': `https://uua.jr.jd.com`,
|
||||
'Accept-Encoding': `gzip, deflate, br`,
|
||||
'Cookie': cookie,
|
||||
'Content-Type': `application/x-www-form-urlencoded;charset=UTF-8`,
|
||||
'Host': `ms.jr.jd.com`,
|
||||
'Connection': `keep-alive`,
|
||||
'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||
'Referer': `https://uua.jr.jd.com/uc-fe-wxgrowing/moneytree/index`,
|
||||
'Accept-Language': `zh-cn`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function TotalBean() {
|
||||
return new Promise(async resolve => {
|
||||
const options = {
|
||||
url: "https://me-api.jd.com/user_new/info/GetJDUserInfoUnion",
|
||||
headers: {
|
||||
Host: "me-api.jd.com",
|
||||
Accept: "*/*",
|
||||
Connection: "keep-alive",
|
||||
Cookie: cookie,
|
||||
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||
"Accept-Language": "zh-cn",
|
||||
"Referer": "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&",
|
||||
"Accept-Encoding": "gzip, deflate, br"
|
||||
}
|
||||
}
|
||||
$.get(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
$.logErr(err)
|
||||
} else {
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
if (data['retcode'] === "1001") {
|
||||
$.isLogin = false; //cookie过期
|
||||
return;
|
||||
}
|
||||
if (data['retcode'] === "0" && data.data && data.data.hasOwnProperty("userInfo")) {
|
||||
$.nickName = data.data.userInfo.baseInfo.nickname;
|
||||
}
|
||||
} else {
|
||||
$.log('京东服务器返回空数据');
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e)
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function jsonParse(str) {
|
||||
if (typeof str == "string") {
|
||||
try {
|
||||
return JSON.parse(str);
|
||||
} catch (e) {
|
||||
that.log(e);
|
||||
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//我加的函数
|
||||
function postToDingTalk(messgae) {
|
||||
const dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=18444b555747aad3381bc1d1e3dea72b03158e152a846f818d82a1ca946bd430"
|
||||
|
||||
const message1 = "" + messgae
|
||||
that.log(messgae)
|
||||
|
||||
const body = {
|
||||
"msgtype": "markdown",
|
||||
"markdown": {
|
||||
"title":"动动摇钱树",
|
||||
"text": message1
|
||||
},
|
||||
"at": {
|
||||
"atMobiles": [],
|
||||
"isAtAll": false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
|
||||
try {
|
||||
that.log(resp)
|
||||
that.log(data)
|
||||
if (err) {
|
||||
that.log(JSON.stringify(err));
|
||||
$.logErr(err);
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
$.duckRes = JSON.parse(data);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
},"json")
|
||||
}
|
||||
|
||||
|
||||
function toDingtalk(urlmain, bodyMain) {
|
||||
return {
|
||||
url: urlmain,
|
||||
body:bodyMain,
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||
timeout: 10000,
|
||||
}
|
||||
}
|
||||
function getPic(){
|
||||
let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
|
||||
let address = "\n\n )
|
||||
address = address + code[pos] + ")"
|
||||
return address
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,709 @@
|
||||
let cookiesArr = [], cookie = '', jdPetShareArr = [], isBox = false, notify, newShareCodes, allMessage = '';
|
||||
//助力好友分享码(最多5个,否则后面的助力失败),原因:动动农场每人每天只有四次助力机会
|
||||
//此此内容是IOS用户下载脚本到本地使用,填写互助码的地方,同一动动账号的好友互助码请使用@符号隔开。
|
||||
//下面给出两个账号的填写示例(iOS只支持2个动动账号)
|
||||
let shareCodes = [ // IOS本地脚本用户这个列表填入你要助力的好友的shareCode
|
||||
]
|
||||
let message = "", subTitle = '', option = {};
|
||||
let jdNotify = false;//是否关闭通知,false打开通知推送,true关闭通知推送
|
||||
const JD_API_HOST = 'https://api.m.jd.com/client.action';
|
||||
let goodsUrl = '', taskInfoKey = [];
|
||||
let randomCount = $.isNode() ? 20 : 5;
|
||||
!(async () => {
|
||||
await requireConfig();
|
||||
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;
|
||||
}
|
||||
|
||||
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>动动萌宠</font> \n\n --- \n\n"
|
||||
for (let i = 0; i < cookiesArr.length; i++) {
|
||||
if (cookiesArr[i]) {
|
||||
cookie = cookiesArr[i];
|
||||
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
||||
$.index = i + 1;
|
||||
$.isLogin = true;
|
||||
$.nickName = '';
|
||||
|
||||
|
||||
username = $.UserName
|
||||
if ($.UserName == "jd_66ea783827d30"){
|
||||
username = "跑腿小弟"
|
||||
}
|
||||
if ($.UserName == "jd_4521b375ebb5d"){
|
||||
username = "锟锟"
|
||||
}
|
||||
if ($.UserName == "jd_542c10c0222bc"){
|
||||
username = "康康"
|
||||
}
|
||||
//加上名称
|
||||
message = message + "<font color=\'#778899\' size=2>【羊毛姐妹】<font color=\'#FFA500\' size=3>" + username + " </font> </font> \n\n "
|
||||
await TotalBean();
|
||||
that.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"});
|
||||
|
||||
if ($.isNode()) {
|
||||
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `动动账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
|
||||
}
|
||||
continue
|
||||
}
|
||||
subTitle = '';
|
||||
goodsUrl = '';
|
||||
taskInfoKey = [];
|
||||
option = {};
|
||||
await shareCodesFormat();
|
||||
await jdPet();
|
||||
}
|
||||
message += "----\n\n"
|
||||
}
|
||||
if ($.isNode() && allMessage && $.ctrTemp) {
|
||||
await notify.sendNotify(`${$.name}`, `${allMessage}`)
|
||||
}
|
||||
})()
|
||||
.catch((e) => {
|
||||
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
|
||||
})
|
||||
.finally(() => {
|
||||
message += getPic()
|
||||
postToDingTalk(message)
|
||||
taht.log(message)
|
||||
$.done();
|
||||
})
|
||||
async function jdPet() {
|
||||
try {
|
||||
//查询jd宠物信息
|
||||
const initPetTownRes = await request('initPetTown');
|
||||
if (initPetTownRes.code === '0' && initPetTownRes.resultCode === '0' && initPetTownRes.message === 'success') {
|
||||
$.petInfo = initPetTownRes.result;
|
||||
if ($.petInfo.userStatus === 0) {
|
||||
// $.msg($.name, '', `【提示】动动账号${$.index}${$.nickName}\n萌宠活动未开启\n请手动去动动APP开启活动\n入口:我的->游戏与互动->查看更多开启`, { "open-url": "openapp.jdmoble://" });
|
||||
await slaveHelp();//助力好友
|
||||
message = message + "<font color=\'#778899\' size=2>"+ "动动萌宠未开启\n请手动去动动APP开启活动\n入口:我的->游戏与互动->查看更多开启</font>\n\n"
|
||||
$.log($.name, '', `【提示】动动账号${$.index}${$.nickName}\n萌宠活动未开启\n请手动去动动APP开启活动\n入口:我的->游戏与互动->查看更多开启`);
|
||||
return
|
||||
}
|
||||
if (!$.petInfo.goodsInfo) {
|
||||
message = message + "<font color=\'#778899\' size=2>"+ "暂未选购新的商品</font>\n\n"
|
||||
$.msg($.name, '', `【提示】动动账号${$.index}${$.nickName}\n暂未选购新的商品`, { "open-url": "openapp.jdmoble://" });
|
||||
if ($.isNode()) await notify.sendNotify(`${$.name} - ${$.index} - ${$.nickName}`, `【提示】动动账号${$.index}${$.nickName}\n暂未选购新的商品`);
|
||||
return
|
||||
}
|
||||
goodsUrl = $.petInfo.goodsInfo && $.petInfo.goodsInfo.goodsUrl;
|
||||
// option['media-url'] = goodsUrl;
|
||||
// that.log(`初始化萌宠信息完成: ${JSON.stringify(petInfo)}`);
|
||||
if ($.petInfo.petStatus === 5) {
|
||||
await slaveHelp();//可以兑换而没有去兑换,也能继续助力好友
|
||||
option['open-url'] = "openApp.jdMobile://";
|
||||
message = message + "<font color=\'#778899\' size=2>"+ `【提醒⏰】${$.petInfo.goodsInfo.goodsName}已可领取`, '请去动动APP或微信小程序查看' +"</font>\n\n"
|
||||
$.msg($.name, `【提醒⏰】${$.petInfo.goodsInfo.goodsName}已可领取`, '请去动动APP或微信小程序查看', option);
|
||||
if ($.isNode()) {
|
||||
await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}奖品已可领取`, `动动账号${$.index} ${$.nickName}\n${$.petInfo.goodsInfo.goodsName}已可领取`);
|
||||
}
|
||||
return
|
||||
} else if ($.petInfo.petStatus === 6) {
|
||||
await slaveHelp();//已领取红包,但未领养新的,也能继续助力好友
|
||||
option['open-url'] = "openApp.jdMobile://";
|
||||
message = message + "<font color=\'#778899\' size=2>"+ `【提醒⏰】已领取红包,但未继续领养新的物品`, '请去动动APP或微信小程序继续领养' + "</font>\n\n"
|
||||
$.msg($.name, `【提醒⏰】已领取红包,但未继续领养新的物品`, '请去动动APP或微信小程序继续领养', option);
|
||||
if ($.isNode()) {
|
||||
await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}奖品已可领取`, `动动账号${$.index} ${$.nickName}\n已领取红包,但未继续领养新的物品`);
|
||||
}
|
||||
return
|
||||
}
|
||||
that.log(`\n【动动账号${$.index}(${$.UserName})的${$.name}好友互助码】${$.petInfo.shareCode}\n`);
|
||||
await taskInit();
|
||||
if ($.taskInit.resultCode === '9999' || !$.taskInit.result) {
|
||||
that.log('初始化任务异常, 请稍后再试');
|
||||
return
|
||||
}
|
||||
$.taskInfo = $.taskInit.result;
|
||||
|
||||
await petSport();//遛弯
|
||||
await slaveHelp();//助力好友
|
||||
await masterHelpInit();//获取助力的信息
|
||||
await doTask();//做日常任务
|
||||
await feedPetsAgain();//再次投食
|
||||
await energyCollect();//收集好感度
|
||||
await showMsg();
|
||||
that.log('全部任务完成, 如果帮助到您可以点下🌟STAR鼓励我一下, 明天见~');
|
||||
} else if (initPetTownRes.code === '0'){
|
||||
that.log(`初始化萌宠失败: ${initPetTownRes.message}`);
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e)
|
||||
const errMsg = `动动账号${$.index} ${$.nickName || $.UserName}\n任务执行异常,请检查执行日志 ‼️‼️`;
|
||||
if ($.isNode()) await notify.sendNotify(`${$.name}`, errMsg);
|
||||
$.msg($.name, '', `动动账号${$.index} ${$.nickName || $.UserName}\n${errMsg}`)
|
||||
}
|
||||
}
|
||||
// 收取所有好感度
|
||||
async function energyCollect() {
|
||||
that.log('开始收取任务奖励好感度');
|
||||
let function_id = 'energyCollect';
|
||||
const response = await request(function_id);
|
||||
// that.log(`收取任务奖励好感度完成:${JSON.stringify(response)}`);
|
||||
if (response.resultCode === '0') {
|
||||
message = message + "<font color=\'#778899\' size=2>"+ `【第${response.result.medalNum + 1}块勋章完成进度】${response.result.medalPercent}%,还需收集${response.result.needCollectEnergy}好感\n` + "</font>\n\n";
|
||||
message = message + "<font color=\'#778899\' size=2>"+ `【已获得勋章】${response.result.medalNum}块,还需收集${response.result.needCollectMedalNum}块即可兑换奖品“${$.petInfo.goodsInfo.goodsName}”\n` + "</font>\n\n";
|
||||
}
|
||||
}
|
||||
//再次投食
|
||||
async function feedPetsAgain() {
|
||||
const response = await request('initPetTown');//再次初始化萌宠
|
||||
if (response.code === '0' && response.resultCode === '0' && response.message === 'success') {
|
||||
$.petInfo = response.result;
|
||||
let foodAmount = $.petInfo.foodAmount; //剩余狗粮
|
||||
if (foodAmount - 100 >= 10) {
|
||||
for (let i = 0; i < parseInt((foodAmount - 100) / 10); i++) {
|
||||
const feedPetRes = await request('feedPets');
|
||||
that.log(`投食feedPetRes`);
|
||||
if (feedPetRes.resultCode == 0 && feedPetRes.code == 0) {
|
||||
that.log('投食成功')
|
||||
}
|
||||
}
|
||||
const response2 = await request('initPetTown');
|
||||
$.petInfo = response2.result;
|
||||
subTitle = $.petInfo.goodsInfo.goodsName;
|
||||
// message += `【与爱宠相识】${$.petInfo.meetDays}天\n`;
|
||||
// message += `【剩余狗粮】${$.petInfo.foodAmount}g\n`;
|
||||
} else {
|
||||
that.log("目前剩余狗粮:【" + foodAmount + "】g,不再继续投食,保留部分狗粮用于完成第二天任务");
|
||||
subTitle = $.petInfo.goodsInfo && $.petInfo.goodsInfo.goodsName;
|
||||
// message += `【与爱宠相识】${$.petInfo.meetDays}天\n`;
|
||||
// message += `【剩余狗粮】${$.petInfo.foodAmount}g\n`;
|
||||
}
|
||||
} else {
|
||||
that.log(`初始化萌宠失败: ${JSON.stringify($.petInfo)}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function doTask() {
|
||||
const { signInit, threeMealInit, firstFeedInit, feedReachInit, inviteFriendsInit, browseShopsInit, taskList } = $.taskInfo;
|
||||
for (let item of taskList) {
|
||||
if ($.taskInfo[item].finished) {
|
||||
that.log(`任务 ${item} 已完成`)
|
||||
}
|
||||
}
|
||||
//每日签到
|
||||
if (signInit && !signInit.finished) {
|
||||
await signInitFun();
|
||||
}
|
||||
// 首次喂食
|
||||
if (firstFeedInit && !firstFeedInit.finished) {
|
||||
await firstFeedInitFun();
|
||||
}
|
||||
// 三餐
|
||||
if (threeMealInit && !threeMealInit.finished) {
|
||||
if (threeMealInit.timeRange === -1) {
|
||||
that.log(`未到三餐时间`);
|
||||
} else {
|
||||
await threeMealInitFun();
|
||||
}
|
||||
}
|
||||
if (browseShopsInit && !browseShopsInit.finished) {
|
||||
await browseShopsInitFun();
|
||||
}
|
||||
let browseSingleShopInitList = [];
|
||||
taskList.map((item) => {
|
||||
if (item.indexOf('browseSingleShopInit') > -1) {
|
||||
browseSingleShopInitList.push(item);
|
||||
}
|
||||
});
|
||||
// 去逛逛好货会场
|
||||
for (let item of browseSingleShopInitList) {
|
||||
const browseSingleShopInitTask = $.taskInfo[item];
|
||||
if (browseSingleShopInitTask && !browseSingleShopInitTask.finished) {
|
||||
await browseSingleShopInit(browseSingleShopInitTask);
|
||||
}
|
||||
}
|
||||
if (inviteFriendsInit && !inviteFriendsInit.finished) {
|
||||
await inviteFriendsInitFun();
|
||||
}
|
||||
// 投食10次
|
||||
if (feedReachInit && !feedReachInit.finished) {
|
||||
await feedReachInitFun();
|
||||
}
|
||||
}
|
||||
// 好友助力信息
|
||||
async function masterHelpInit() {
|
||||
let res = await request('masterHelpInit');
|
||||
// that.log(`助力信息: ${JSON.stringify(res)}`);
|
||||
if (res.code === '0' && res.resultCode === '0') {
|
||||
if (res.result.masterHelpPeoples && res.result.masterHelpPeoples.length >= 5) {
|
||||
if(!res.result.addedBonusFlag) {
|
||||
that.log("开始领取额外奖励");
|
||||
let getHelpAddedBonusResult = await request('getHelpAddedBonus');
|
||||
if (getHelpAddedBonusResult.resultCode === '0') {
|
||||
message += "<font color=\'#778899\' size=2>"+ `【额外奖励${getHelpAddedBonusResult.result.reward}领取】${getHelpAddedBonusResult.message}\n` + "</font>\n\n";
|
||||
}
|
||||
that.log(`领取30g额外奖励结果:【${getHelpAddedBonusResult.message}】`);
|
||||
} else {
|
||||
that.log("已经领取过5好友助力额外奖励");
|
||||
message += "<font color=\'#778899\' size=2>"+ `【额外奖励】已领取\n` + "</font>\n\n";
|
||||
}
|
||||
} else {
|
||||
that.log("助力好友未达到5个")
|
||||
message += "<font color=\'#778899\' size=2>"+ `【额外奖励】领取失败,原因:给您助力的人未达5个\n` + "</font>\n\n";
|
||||
}
|
||||
if (res.result.masterHelpPeoples && res.result.masterHelpPeoples.length > 0) {
|
||||
that.log('帮您助力的好友的名单开始')
|
||||
let str = '';
|
||||
res.result.masterHelpPeoples.map((item, index) => {
|
||||
if (index === (res.result.masterHelpPeoples.length - 1)) {
|
||||
str += item.nickName || "匿名用户";
|
||||
} else {
|
||||
str += (item.nickName || "匿名用户") + ',';
|
||||
}
|
||||
})
|
||||
message += "<font color=\'#778899\' size=2>"+ `【助力您的好友】${str}\n` + "</font>\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 助力好友, 暂时支持一个好友, 需要拿到shareCode
|
||||
* shareCode为你要助力的好友的
|
||||
* 运行脚本时你自己的shareCode会在控制台输出, 可以将其分享给他人
|
||||
*/
|
||||
async function slaveHelp() {
|
||||
//$.log(`\n因1.6日好友助力功能下线。故暂时屏蔽\n`)
|
||||
//return
|
||||
let helpPeoples = '';
|
||||
for (let code of newShareCodes) {
|
||||
that.log(`开始助力动动账号${$.index} - ${$.nickName}的好友: ${code}`);
|
||||
if (!code) continue;
|
||||
let response = await request('slaveHelp', {'shareCode': code});
|
||||
if (response.code === '0' && response.resultCode === '0') {
|
||||
if (response.result.helpStatus === 0) {
|
||||
that.log('已给好友: 【' + response.result.masterNickName + '】助力成功');
|
||||
helpPeoples += response.result.masterNickName + ',';
|
||||
} else if (response.result.helpStatus === 1) {
|
||||
// 您今日已无助力机会
|
||||
that.log(`助力好友${response.result.masterNickName}失败,您今日已无助力机会`);
|
||||
break;
|
||||
} else if (response.result.helpStatus === 2) {
|
||||
//该好友已满5人助力,无需您再次助力
|
||||
that.log(`该好友${response.result.masterNickName}已满5人助力,无需您再次助力`);
|
||||
} else {
|
||||
that.log(`助力其他情况:${JSON.stringify(response)}`);
|
||||
}
|
||||
} else {
|
||||
that.log(`助力好友结果: ${response.message}`);
|
||||
}
|
||||
}
|
||||
if (helpPeoples && helpPeoples.length > 0) {
|
||||
message = message + "<font color=\'#778899\' size=2>"+ `【您助力的好友】${helpPeoples.substr(0, helpPeoples.length - 1)}\n` +"</font>\n\n";
|
||||
}
|
||||
}
|
||||
// 遛狗, 每天次数上限10次, 随机给狗粮, 每次遛狗结束需调用getSportReward领取奖励, 才能进行下一次遛狗
|
||||
async function petSport() {
|
||||
that.log('开始遛弯');
|
||||
let times = 1
|
||||
const code = 0
|
||||
let resultCode = 0
|
||||
do {
|
||||
let response = await request('petSport')
|
||||
that.log(`第${times}次遛狗完成: ${JSON.stringify(response)}`);
|
||||
resultCode = response.resultCode;
|
||||
if (resultCode == 0) {
|
||||
let sportRevardResult = await request('getSportReward');
|
||||
that.log(`领取遛狗奖励完成: ${JSON.stringify(sportRevardResult)}`);
|
||||
}
|
||||
times++;
|
||||
} while (resultCode == 0 && code == 0)
|
||||
if (times > 1) {
|
||||
// message += '【十次遛狗】已完成\n';
|
||||
}
|
||||
}
|
||||
// 初始化任务, 可查询任务完成情况
|
||||
async function taskInit() {
|
||||
that.log('开始任务初始化');
|
||||
$.taskInit = await request('taskInit', {"version":1});
|
||||
}
|
||||
// 每日签到, 每天一次
|
||||
async function signInitFun() {
|
||||
that.log('准备每日签到');
|
||||
const response = await request("getSignReward");
|
||||
that.log(`每日签到结果: ${JSON.stringify(response)}`);
|
||||
if (response.code === '0' && response.resultCode === '0') {
|
||||
that.log(`【每日签到成功】奖励${response.result.signReward}g狗粮\n`);
|
||||
// message += `【每日签到成功】奖励${response.result.signReward}g狗粮\n`;
|
||||
} else {
|
||||
that.log(`【每日签到】${response.message}\n`);
|
||||
// message += `【每日签到】${response.message}\n`;
|
||||
}
|
||||
}
|
||||
|
||||
// 三餐签到, 每天三段签到时间
|
||||
async function threeMealInitFun() {
|
||||
that.log('准备三餐签到');
|
||||
const response = await request("getThreeMealReward");
|
||||
that.log(`三餐签到结果: ${JSON.stringify(response)}`);
|
||||
if (response.code === '0' && response.resultCode === '0') {
|
||||
that.log(`【定时领狗粮】获得${response.result.threeMealReward}g\n`);
|
||||
// message += `【定时领狗粮】获得${response.result.threeMealReward}g\n`;
|
||||
} else {
|
||||
that.log(`【定时领狗粮】${response.message}\n`);
|
||||
// message += `【定时领狗粮】${response.message}\n`;
|
||||
}
|
||||
}
|
||||
|
||||
// 浏览指定店铺 任务
|
||||
async function browseSingleShopInit(item) {
|
||||
that.log(`开始做 ${item.title} 任务, ${item.desc}`);
|
||||
const body = {"index": item['index'], "version":1, "type":1};
|
||||
const body2 = {"index": item['index'], "version":1, "type":2};
|
||||
const response = await request("getSingleShopReward", body);
|
||||
// that.log(`点击进去response::${JSON.stringify(response)}`);
|
||||
if (response.code === '0' && response.resultCode === '0') {
|
||||
const response2 = await request("getSingleShopReward", body2);
|
||||
// that.log(`浏览完毕领取奖励:response2::${JSON.stringify(response2)}`);
|
||||
if (response2.code === '0' && response2.resultCode === '0') {
|
||||
that.log(`【浏览指定店铺】获取${response2.result.reward}g\n`);
|
||||
// message += `【浏览指定店铺】获取${response2.result.reward}g\n`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 浏览店铺任务, 任务可能为多个? 目前只有一个
|
||||
async function browseShopsInitFun() {
|
||||
that.log('开始浏览店铺任务');
|
||||
let times = 0;
|
||||
let resultCode = 0;
|
||||
let code = 0;
|
||||
do {
|
||||
let response = await request("getBrowseShopsReward");
|
||||
that.log(`第${times}次浏览店铺结果: ${JSON.stringify(response)}`);
|
||||
code = response.code;
|
||||
resultCode = response.resultCode;
|
||||
times++;
|
||||
} while (resultCode == 0 && code == 0 && times < 5)
|
||||
that.log('浏览店铺任务结束');
|
||||
}
|
||||
// 首次投食 任务
|
||||
function firstFeedInitFun() {
|
||||
that.log('首次投食任务合并到10次喂食任务中\n');
|
||||
}
|
||||
|
||||
// 邀请新用户
|
||||
async function inviteFriendsInitFun() {
|
||||
that.log('邀请新用户功能未实现');
|
||||
if ($.taskInfo.inviteFriendsInit.status == 1 && $.taskInfo.inviteFriendsInit.inviteFriendsNum > 0) {
|
||||
// 如果有邀请过新用户,自动领取60gg奖励
|
||||
const res = await request('getInviteFriendsReward');
|
||||
if (res.code == 0 && res.resultCode == 0) {
|
||||
that.log(`领取邀请新用户奖励成功,获得狗粮现有狗粮${$.taskInfo.inviteFriendsInit.reward}g,${res.result.foodAmount}g`);
|
||||
message += "<font color=\'#778899\' size=2>"+ `【邀请新用户】获取狗粮${$.taskInfo.inviteFriendsInit.reward}g\n` +"</font>\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 投食10次 任务
|
||||
*/
|
||||
async function feedReachInitFun() {
|
||||
that.log('投食任务开始...');
|
||||
let finishedTimes = $.taskInfo.feedReachInit.hadFeedAmount / 10; //已经喂养了几次
|
||||
let needFeedTimes = 10 - finishedTimes; //还需要几次
|
||||
let tryTimes = 20; //尝试次数
|
||||
do {
|
||||
that.log(`还需要投食${needFeedTimes}次`);
|
||||
const response = await request('feedPets');
|
||||
that.log(`本次投食结果: ${JSON.stringify(response)}`);
|
||||
if (response.resultCode == 0 && response.code == 0) {
|
||||
needFeedTimes--;
|
||||
}
|
||||
if (response.resultCode == 3003 && response.code == 0) {
|
||||
that.log('剩余狗粮不足, 投食结束');
|
||||
needFeedTimes = 0;
|
||||
}
|
||||
tryTimes--;
|
||||
} while (needFeedTimes > 0 && tryTimes > 0)
|
||||
that.log('投食任务结束...\n');
|
||||
}
|
||||
async function showMsg() {
|
||||
if ($.isNode() && process.env.PET_NOTIFY_CONTROL) {
|
||||
$.ctrTemp = `${process.env.PET_NOTIFY_CONTROL}` === 'false';
|
||||
} else if ($.getdata('jdPetNotify')) {
|
||||
$.ctrTemp = $.getdata('jdPetNotify') === 'false';
|
||||
} else {
|
||||
$.ctrTemp = `${jdNotify}` === 'false';
|
||||
}
|
||||
// jdNotify = `${notify.petNotifyControl}` === 'false' && `${jdNotify}` === 'false' && $.getdata('jdPetNotify') === 'false';
|
||||
if ($.ctrTemp) {
|
||||
$.msg($.name, subTitle, message, option);
|
||||
if ($.isNode()) {
|
||||
allMessage += `${subTitle}\n${message}${$.index !== cookiesArr.length ? '\n\n' : ''}`
|
||||
// await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `${subTitle}\n${message}`);
|
||||
}
|
||||
} else {
|
||||
$.log(`\n${message}\n`);
|
||||
}
|
||||
}
|
||||
function readShareCode() {
|
||||
return new Promise(async resolve => {
|
||||
$.get({url: `http://jd.turinglabs.net/api/v2/jd/pet/read/${randomCount}/`, 'timeout': 10000}, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (data) {
|
||||
that.log(`随机取个${randomCount}码放到您固定的互助码后面(不影响已有固定互助)`)
|
||||
data = JSON.parse(data);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
await $.wait(10000);
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
function shareCodesFormat() {
|
||||
return new Promise(async resolve => {
|
||||
// that.log(`第${$.index}个动动账号的助力码:::${jdPetShareArr[$.index - 1]}`)
|
||||
newShareCodes = [];
|
||||
if (jdPetShareArr[$.index - 1]) {
|
||||
newShareCodes = jdPetShareArr[$.index - 1].split('@');
|
||||
} else {
|
||||
that.log(`由于您第${$.index}个动动账号未提供shareCode,将采纳本脚本自带的助力码\n`)
|
||||
if(shareCodes.length>0){
|
||||
const tempIndex = $.index > shareCodes.length ? (shareCodes.length - 1) : ($.index - 1);
|
||||
newShareCodes = shareCodes[tempIndex].split('@');
|
||||
}
|
||||
}
|
||||
//因好友助力功能下线。故暂时屏蔽
|
||||
//const readShareCodeRes = await readShareCode();
|
||||
const readShareCodeRes = null;
|
||||
if (readShareCodeRes && readShareCodeRes.code === 200) {
|
||||
newShareCodes = [...new Set([...newShareCodes, ...(readShareCodeRes.data || [])])];
|
||||
}
|
||||
that.log(`第${$.index}个动动账号将要助力的好友${JSON.stringify(newShareCodes)}`)
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
function requireConfig() {
|
||||
return new Promise(resolve => {
|
||||
that.log('开始获取动动萌宠配置文件\n')
|
||||
notify = $.isNode() ? require('./sendNotify') : '';
|
||||
//Node.js用户请在jdCookie.js处填写动动ck;
|
||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||
const jdPetShareCodes = $.isNode() ? require('./jdPetShareCodes.js') : '';
|
||||
//IOS等用户直接用NobyDa的jd cookie
|
||||
if ($.isNode()) {
|
||||
Object.keys(jdCookieNode).forEach((item) => {
|
||||
if (jdCookieNode[item]) {
|
||||
cookiesArr.push(jdCookieNode[item])
|
||||
}
|
||||
})
|
||||
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.log = () => {};
|
||||
} else {
|
||||
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
|
||||
}
|
||||
that.log(`共${cookiesArr.length}个动动账号\n`)
|
||||
if ($.isNode()) {
|
||||
Object.keys(jdPetShareCodes).forEach((item) => {
|
||||
if (jdPetShareCodes[item]) {
|
||||
jdPetShareArr.push(jdPetShareCodes[item])
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const boxShareCodeArr = ['jd_pet1', 'jd_pet2', 'jd_pet3', 'jd_pet4', 'jd_pet5'];
|
||||
const boxShareCodeArr2 = ['jd2_pet1', 'jd2_pet2', 'jd2_pet3', 'jd2_pet4', 'jd2_pet5'];
|
||||
const isBox1 = boxShareCodeArr.some((item) => {
|
||||
const boxShareCode = $.getdata(item);
|
||||
return (boxShareCode !== undefined && boxShareCode !== null && boxShareCode !== '');
|
||||
});
|
||||
const isBox2 = boxShareCodeArr2.some((item) => {
|
||||
const boxShareCode = $.getdata(item);
|
||||
return (boxShareCode !== undefined && boxShareCode !== null && boxShareCode !== '');
|
||||
});
|
||||
isBox = isBox1 ? isBox1 : isBox2;
|
||||
if (isBox1) {
|
||||
let temp = [];
|
||||
for (const item of boxShareCodeArr) {
|
||||
if ($.getdata(item)) {
|
||||
temp.push($.getdata(item))
|
||||
}
|
||||
}
|
||||
jdPetShareArr.push(temp.join('@'));
|
||||
}
|
||||
if (isBox2) {
|
||||
let temp = [];
|
||||
for (const item of boxShareCodeArr2) {
|
||||
if ($.getdata(item)) {
|
||||
temp.push($.getdata(item))
|
||||
}
|
||||
}
|
||||
jdPetShareArr.push(temp.join('@'));
|
||||
}
|
||||
}
|
||||
// that.log(`jdPetShareArr::${JSON.stringify(jdPetShareArr)}`)
|
||||
// that.log(`jdPetShareArr账号长度::${jdPetShareArr.length}`)
|
||||
that.log(`您提供了${jdPetShareArr.length}个账号的动动萌宠助力码\n`);
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
function TotalBean() {
|
||||
return new Promise(async resolve => {
|
||||
const options = {
|
||||
"url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
|
||||
"headers": {
|
||||
"Accept": "application/json,text/plain, */*",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Accept-Language": "zh-cn",
|
||||
"Connection": "keep-alive",
|
||||
"Cookie": cookie,
|
||||
"Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
|
||||
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1")
|
||||
}
|
||||
}
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
if (data['retcode'] === 13) {
|
||||
$.isLogin = false; //cookie过期
|
||||
return
|
||||
}
|
||||
if (data['retcode'] === 0) {
|
||||
$.nickName = (data['base'] && data['base'].nickname) || $.UserName;
|
||||
} else {
|
||||
$.nickName = $.UserName
|
||||
}
|
||||
} else {
|
||||
that.log(`动动服务器返回空数据`)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
// 请求
|
||||
async function request(function_id, body = {}) {
|
||||
await $.wait(3000); //歇口气儿, 不然会报操作频繁
|
||||
return new Promise((resolve, reject) => {
|
||||
$.post(taskUrl(function_id, body), (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log('\n动动萌宠: API查询请求失败 ‼️‼️');
|
||||
that.log(JSON.stringify(err));
|
||||
$.logErr(err);
|
||||
} else {
|
||||
data = JSON.parse(data);
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
resolve(data)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
// function taskUrl(function_id, body = {}) {
|
||||
// return {
|
||||
// url: `${JD_API_HOST}?functionId=${function_id}&appid=wh5&loginWQBiz=pet-town&body=${escape(JSON.stringify(body))}`,
|
||||
// headers: {
|
||||
// Cookie: cookie,
|
||||
// UserAgent: $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
function taskUrl(function_id, body = {}) {
|
||||
body["version"] = 2;
|
||||
body["channel"] = 'app';
|
||||
return {
|
||||
url: `${JD_API_HOST}?functionId=${function_id}`,
|
||||
body: `body=${escape(JSON.stringify(body))}&appid=wh5&loginWQBiz=pet-town&clientVersion=9.0.4`,
|
||||
headers: {
|
||||
'Cookie': cookie,
|
||||
'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||
'Host': 'api.m.jd.com',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
}
|
||||
};
|
||||
}
|
||||
function jsonParse(str) {
|
||||
if (typeof str == "string") {
|
||||
try {
|
||||
return JSON.parse(str);
|
||||
} catch (e) {
|
||||
that.log(e);
|
||||
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//我加的函数
|
||||
function postToDingTalk(messgae) {
|
||||
const dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=18444b555747aad3381bc1d1e3dea72b03158e152a846f818d82a1ca946bd430"
|
||||
|
||||
const message1 = "" + messgae
|
||||
that.log(messgae)
|
||||
|
||||
const body = {
|
||||
"msgtype": "markdown",
|
||||
"markdown": {
|
||||
"title":"动动萌宠",
|
||||
"text": message1
|
||||
},
|
||||
"at": {
|
||||
"atMobiles": [],
|
||||
"isAtAll": false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
|
||||
try {
|
||||
that.log(resp)
|
||||
that.log(data)
|
||||
if (err) {
|
||||
that.log(JSON.stringify(err));
|
||||
$.logErr(err);
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
$.duckRes = JSON.parse(data);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
},"json")
|
||||
}
|
||||
|
||||
|
||||
function toDingtalk(urlmain, bodyMain) {
|
||||
return {
|
||||
url: urlmain,
|
||||
body:bodyMain,
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||
timeout: 10000,
|
||||
}
|
||||
}
|
||||
function getPic(){
|
||||
let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
|
||||
let address = "\n\n )
|
||||
address = address + code[pos] + ")"
|
||||
return address
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
//Node.js用户请在jdCookie.js处填写动动ck;
|
||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||
|
||||
//IOS等用户直接用NobyDa的jd cookie
|
||||
let cookiesArr = [], cookie = '';
|
||||
if ($.isNode()) {
|
||||
Object.keys(jdCookieNode).forEach((item) => {
|
||||
cookiesArr.push(jdCookieNode[item])
|
||||
})
|
||||
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.log = () => {};
|
||||
} else {
|
||||
let cookiesData = $.getdata('CookiesJD') || "[]";
|
||||
cookiesData = jsonParse(cookiesData);
|
||||
cookiesArr = cookiesData.map(item => item.cookie);
|
||||
cookiesArr.reverse();
|
||||
cookiesArr.push(...[$.getdata('CookieJD2'), $.getdata('CookieJD')]);
|
||||
cookiesArr.reverse();
|
||||
cookiesArr = cookiesArr.filter(item => item !== "" && item !== null && item !== undefined);
|
||||
}
|
||||
let message = '', subTitle = '';
|
||||
|
||||
const JD_API_HOST = 'https://api.m.jd.com/client.action';
|
||||
!(async () => {
|
||||
|
||||
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>动动超市</font> \n\n --- \n\n"
|
||||
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;
|
||||
}
|
||||
for (let i = 0; i < cookiesArr.length; i++) {
|
||||
if (cookiesArr[i]) {
|
||||
cookie = cookiesArr[i];
|
||||
$.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
|
||||
$.index = i + 1;
|
||||
$.isLogin = true;
|
||||
$.nickName = '';
|
||||
await TotalBean();
|
||||
|
||||
username = $.UserName
|
||||
if ($.UserName == "jd_66ea783827d30"){
|
||||
username = "跑腿小弟"
|
||||
}
|
||||
if ($.UserName == "jd_4521b375ebb5d"){
|
||||
username = "锟锟"
|
||||
}
|
||||
if ($.UserName == "jd_542c10c0222bc"){
|
||||
username = "康康"
|
||||
}
|
||||
//加上名称
|
||||
message = message + "<font color=\'#778899\' size=2>【羊毛姐妹】<font color=\'#FFA500\' size=3>" + username + " </font> </font> \n\n "
|
||||
that.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"});
|
||||
|
||||
if ($.isNode()) {
|
||||
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `动动账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
|
||||
}
|
||||
continue
|
||||
}
|
||||
subTitle = '';
|
||||
await jdShop();
|
||||
}
|
||||
message += "----\n\n"
|
||||
}
|
||||
})()
|
||||
.catch((e) => {
|
||||
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
|
||||
message = message + "<font color=\'#778899\' size=2>" +`❌ ${$.name}, 失败! 原因: ${e}!` + "</font>\n\n"
|
||||
})
|
||||
.finally(() => {
|
||||
message += getPic()
|
||||
that.log(message)
|
||||
// postToDingTalk(message)
|
||||
$.done();
|
||||
})
|
||||
async function jdShop() {
|
||||
const taskData = await getTask();
|
||||
if (taskData.code === '0') {
|
||||
if (!taskData.data.taskList) {
|
||||
that.log(`${taskData.data.taskErrorTips}\n`);
|
||||
$.msg($.name, '', `动动账号 ${$.index} ${$.nickName}\n${taskData.data.taskErrorTips}`);
|
||||
message += "<font color=\'#778899\' size=2>" + `${taskData.data.taskErrorTips}` + "</font>\n\n"
|
||||
} else {
|
||||
const { taskList } = taskData.data;
|
||||
let beanCount = 0;
|
||||
for (let item of taskList) {
|
||||
if (item.taskStatus === 3) {
|
||||
that.log(`${item.shopName} 已拿到2京豆\n`)
|
||||
message += "<font color=\'#778899\' size=2>" + `成功领取${beanCount}京豆` + "</font>\n\n"
|
||||
} else {
|
||||
that.log(`taskId::${item.taskId}`)
|
||||
const doTaskRes = await doTask(item.taskId);
|
||||
if (doTaskRes.code === '0') {
|
||||
beanCount += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
that.log(`beanCount::${beanCount}`);
|
||||
message += "<font color=\'#778899\' size=2>" + `成功领取${beanCount}京豆` + "</font>\n\n"
|
||||
$.msg($.name, '', `动动账号 ${$.index} ${$.nickName}\n成功领取${beanCount}京豆`);
|
||||
}
|
||||
}
|
||||
}
|
||||
function doTask(taskId) {
|
||||
that.log(`doTask-taskId::${taskId}`)
|
||||
return new Promise(resolve => {
|
||||
const body = { 'taskId': `${taskId}` };
|
||||
const options = {
|
||||
url: `${JD_API_HOST}`,
|
||||
body: `functionId=takeTask&body=${escape(JSON.stringify(body))}&appid=ld`,
|
||||
headers: {
|
||||
'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
|
||||
'Host': 'api.m.jd.com',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': cookie,
|
||||
}
|
||||
}
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log('\n进店领豆: API查询请求失败 ‼️‼️')
|
||||
$.logErr(err);
|
||||
} else {
|
||||
// that.log(data)
|
||||
data = JSON.parse(data);
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
function getTask(body = {}) {
|
||||
return new Promise(resolve => {
|
||||
const options = {
|
||||
url: `${JD_API_HOST}`,
|
||||
body: `functionId=queryTaskIndex&body=${escape(JSON.stringify(body))}&appid=ld`,
|
||||
headers: {
|
||||
'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
|
||||
'Host': 'api.m.jd.com',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': cookie,
|
||||
}
|
||||
}
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log('\n进店领豆: API查询请求失败 ‼️‼️')
|
||||
$.logErr(err);
|
||||
} else {
|
||||
// that.log(data)
|
||||
data = JSON.parse(data);
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
function TotalBean() {
|
||||
return new Promise(async resolve => {
|
||||
const options = {
|
||||
"url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
|
||||
"headers": {
|
||||
"Accept": "application/json,text/plain, */*",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Accept-Language": "zh-cn",
|
||||
"Connection": "keep-alive",
|
||||
"Cookie": cookie,
|
||||
"Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
|
||||
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0")
|
||||
}
|
||||
}
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
if (data['retcode'] === 13) {
|
||||
$.isLogin = false; //cookie过期
|
||||
return
|
||||
}
|
||||
if (data['retcode'] === 0) {
|
||||
$.nickName = (data['base'] && data['base'].nickname) || $.UserName;
|
||||
} else {
|
||||
$.nickName = $.UserName
|
||||
}
|
||||
} else {
|
||||
that.log(`动动服务器返回空数据`)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
function jsonParse(str) {
|
||||
if (typeof str == "string") {
|
||||
try {
|
||||
return JSON.parse(str);
|
||||
} catch (e) {
|
||||
that.log(e);
|
||||
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//我加的函数
|
||||
function postToDingTalk(messgae) {
|
||||
const dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=fa87e34729eaa6113fddfa857efebb477dea0a433d6eecfe93b1d3f5e24847b9"
|
||||
|
||||
const message1 = "" + messgae
|
||||
that.log(messgae)
|
||||
|
||||
const body = {
|
||||
"msgtype": "markdown",
|
||||
"markdown": {
|
||||
"title":"动动超市",
|
||||
"text": message1
|
||||
},
|
||||
"at": {
|
||||
"atMobiles": [],
|
||||
"isAtAll": false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
|
||||
try {
|
||||
that.log(resp)
|
||||
that.log(data)
|
||||
if (err) {
|
||||
that.log(JSON.stringify(err));
|
||||
$.logErr(err);
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
$.duckRes = JSON.parse(data);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
},"json")
|
||||
}
|
||||
|
||||
|
||||
function toDingtalk(urlmain, bodyMain) {
|
||||
return {
|
||||
url: urlmain,
|
||||
body:bodyMain,
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||
timeout: 10000,
|
||||
}
|
||||
}
|
||||
|
||||
function getPic(){
|
||||
let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
|
||||
let address = "\n\n )
|
||||
address = address + code[pos] + ")"
|
||||
return address
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
|
||||
const JD_API_HOST = 'https://api.m.jd.com/';
|
||||
|
||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
let cookiesArr = [], cookie = '', message = '';
|
||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||
if ($.isNode()) {
|
||||
Object.keys(jdCookieNode).forEach((item) => {
|
||||
cookiesArr.push(jdCookieNode[item])
|
||||
})
|
||||
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.log = () => {
|
||||
};
|
||||
} else {
|
||||
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
|
||||
}
|
||||
|
||||
$.linkId="";
|
||||
$.linkIds=["9wdf1YTT2L59Vr-meKskLA"];
|
||||
!(async () => {
|
||||
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>极速签到领红包</font> \n\n --- \n\n"
|
||||
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;
|
||||
}
|
||||
for(var index=0;index<$.linkIds.length;index++){
|
||||
$.linkId=$.linkIds[index];
|
||||
that.log("当前linkId:"+$.linkId);
|
||||
for (let i = 0; i < cookiesArr.length; i++) {
|
||||
if (cookiesArr[i]) {
|
||||
cookie = cookiesArr[i];
|
||||
$.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
|
||||
|
||||
|
||||
username = $.UserName
|
||||
if ($.UserName == "jd_66ea783827d30"){
|
||||
username = "跑腿小弟"
|
||||
}
|
||||
if ($.UserName == "jd_4521b375ebb5d"){
|
||||
username = "锟锟"
|
||||
}
|
||||
if ($.UserName == "jd_542c10c0222bc"){
|
||||
username = "康康"
|
||||
}
|
||||
//加上名称
|
||||
message = message + "<font color=\'#778899\' size=2>【羊毛姐妹】<font color=\'#FFA500\' size=3>" + username + " </font> </font> \n\n "
|
||||
|
||||
await spring_reward_query();
|
||||
if ($.data) {
|
||||
that.log("当前剩余次数:" + $.data.remainChance);
|
||||
if ($.data.remainChance) {
|
||||
for (var j = 0; j < $.data.remainChance; j++) {
|
||||
await spring_reward_receive();
|
||||
await $.wait(2000);
|
||||
if ($.reward) {
|
||||
if ($.reward.prizeType == 1) {
|
||||
message = message + "<font color=\'#778899\' size=2>" + "获得优惠券:" + $.reward.prizeDesc + ',面值:' + $.reward.amount + ",满" + $.reward.useLimit + "可用" + "</font>\n\n"
|
||||
that.log("获得优惠券:" + $.reward.prizeDesc + ',面值:' + $.reward.amount + ",满" + $.reward.useLimit + "可用");
|
||||
} else if ($.reward.prizeType == 4) {
|
||||
message = message + "<font color=\'#778899\' size=2>" + "获得现金:" + $.reward.amount + ',描述:' + $.reward.prizeDesc + "</font>\n\n"
|
||||
that.log("获得现金:" + $.reward.amount + ',描述:' + $.reward.prizeDesc);
|
||||
} else {
|
||||
message = message + "<font color=\'#778899\' size=2>" + "获得" + $.reward.prizeDesc + ",面值:" + $.reward.amount + "</font>\n\n"
|
||||
that.log("获得" + $.reward.prizeDesc + ",面值:" + $.reward.amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await spring_reward_list();
|
||||
if ($.list) {
|
||||
for (var item of $.list) {
|
||||
if (item.state == 0 && item.prizeType == 4) {
|
||||
message = message + "<font color=\'#778899\' size=2>" + "有" + item.amount + "现金没有提现,尝试提现中" + "</font>\n\n"
|
||||
that.log("有" + item.amount + "现金没有提现,尝试提现中");
|
||||
await apCashWithDraw(item);
|
||||
await $.wait(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})()
|
||||
.catch((e) => {
|
||||
message = message + "<font color=\'#778899\' size=2>" + `❌ ${$.name}, 失败! 原因: ${e}!` + "</font>\n\n"
|
||||
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
|
||||
})
|
||||
.finally(() => {
|
||||
message += getPic()
|
||||
taht.log(message)
|
||||
$.done();
|
||||
})
|
||||
|
||||
function spring_reward_receive() {
|
||||
return new Promise((resolve) => {
|
||||
$.get(taskUrl("spring_reward_receive", {
|
||||
"linkId": $.linkId,
|
||||
"inviter": "UhBiP5ZPaM28-O0MOaGu2g"
|
||||
}), (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if (data.code === 0) {
|
||||
$.reward = data.data.received;
|
||||
} else {
|
||||
that.log(JSON.stringify(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function spring_reward_query() {
|
||||
return new Promise((resolve) => {
|
||||
$.get(taskUrl("spring_reward_query", {
|
||||
"linkId": $.linkId,
|
||||
"inviter": "UhBiP5ZPaM28-O0MOaGu2g"
|
||||
}), (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if (data.code === 0) {
|
||||
$.data = data.data;
|
||||
} else {
|
||||
that.log(JSON.stringify(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function spring_reward_list() {
|
||||
return new Promise((resolve) => {
|
||||
$.get(taskUrl("spring_reward_list", {
|
||||
"pageNum": 1,
|
||||
"pageSize": 10,
|
||||
"linkId": $.linkId,
|
||||
"inviter": "UhBiP5ZPaM28-O0MOaGu2g"
|
||||
}), (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if (data.code === 0) {
|
||||
$.list = data.data.items;
|
||||
} else {
|
||||
that.log(JSON.stringify(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function apCashWithDraw(item) {
|
||||
console.log(item);
|
||||
return new Promise((resolve) => {
|
||||
$.post(taskUrlPost("apCashWithDraw", {
|
||||
"businessSource": "SPRING_FESTIVAL_RED_ENVELOPE",
|
||||
"base": {
|
||||
"id": item.id,
|
||||
"business": null,
|
||||
"poolBaseId": item.poolBaseId,
|
||||
"prizeGroupId": item.prizeGroupId,
|
||||
"prizeBaseId": item.prizeBaseId,
|
||||
"prizeType": 4
|
||||
},
|
||||
"linkId": $.linkId,
|
||||
"inviter": "UhBiP5ZPaM28-O0MOaGu2g"
|
||||
}), (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if (data.code === 0) {
|
||||
that.log(JSON.stringify(data.data));
|
||||
//that.log("如果提示null,请手动去提现一次(绑定微信)");
|
||||
} else {
|
||||
that.log(JSON.stringify(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function taskUrl(functionId, body = {}) {
|
||||
return {
|
||||
url: `${JD_API_HOST}?functionId=${functionId}&body=${escape(JSON.stringify(body))}&appid=activities_platform&_t=${new Date().getTime()}`,
|
||||
headers: {
|
||||
'Cookie': cookie,
|
||||
'Host': 'api.m.jd.com',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'application/json',
|
||||
'Referer': 'https://prodev.m.jd.com/jdlite/active/31U4T6S4PbcK83HyLPioeCWrD63j/index.html?channel=qqh5fx&inviter=UhBiP5ZPaM28-O0MOaGu2g&utm_user=plusmember&ad_od=share&cu=true&utm_source=kong&utm_medium=jingfen&utm_campaign=t_1000217905_&utm_term=2555319d90df4c66b502437958986790',
|
||||
'User-Agent': "jdltapp;android;3.1.0;9;",
|
||||
'Accept-Language': 'zh-cn',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function taskUrlPost(functionId, body = {}) {
|
||||
return {
|
||||
url: `${JD_API_HOST}`,
|
||||
body: `functionId=${functionId}&body=${escape(JSON.stringify(body))}&appid=activities_platform&_t=${new Date().getTime()}`,
|
||||
headers: {
|
||||
'Cookie': cookie,
|
||||
'Host': 'api.m.jd.com',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Referer': 'https://prodev.m.jd.com/jdlite/active/q1eB6WUB8oC4eH1BsCLWvQakVsX/index.html',
|
||||
'User-Agent': "jdltapp;android;3.1.0;9;",
|
||||
'Accept-Language': 'zh-cn',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function safeGet(data) {
|
||||
try {
|
||||
if (typeof JSON.parse(data) == "object") {
|
||||
return true;
|
||||
}
|
||||
} catch (e) {
|
||||
that.log(e);
|
||||
that.log(`动动服务器访问数据为空,请检查自身设备网络情况`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function jsonParse(str) {
|
||||
if (typeof str == "string") {
|
||||
try {
|
||||
return JSON.parse(str);
|
||||
} catch (e) {
|
||||
that.log(e);
|
||||
$.msg($.name, '', '不要在BoxJS手动复制粘贴修改cookie')
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//我加的函数
|
||||
function postToDingTalk(messgae) {
|
||||
const dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=fa87e34729eaa6113fddfa857efebb477dea0a433d6eecfe93b1d3f5e24847b9"
|
||||
|
||||
const message1 = "" + messgae
|
||||
that.log(messgae)
|
||||
|
||||
const body = {
|
||||
"msgtype": "markdown",
|
||||
"markdown": {
|
||||
"title":"极速签到领红包",
|
||||
"text": message1
|
||||
},
|
||||
"at": {
|
||||
"atMobiles": [],
|
||||
"isAtAll": false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
|
||||
try {
|
||||
that.log(resp)
|
||||
that.log(data)
|
||||
if (err) {
|
||||
that.log(JSON.stringify(err));
|
||||
$.logErr(err);
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
$.duckRes = JSON.parse(data);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
},"json")
|
||||
}
|
||||
|
||||
|
||||
function toDingtalk(urlmain, bodyMain) {
|
||||
return {
|
||||
url: urlmain,
|
||||
body:bodyMain,
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||
timeout: 10000,
|
||||
}
|
||||
}
|
||||
|
||||
function getPic(){
|
||||
let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
|
||||
let address = "\n\n )
|
||||
address = address + code[pos] + ")"
|
||||
return address
|
||||
}
|
||||
@@ -0,0 +1,942 @@
|
||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
//Node.js用户请在jdCookie.js处填写动动ck;
|
||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||
let CryptoJS=$.CryptoJS;
|
||||
$.toObj = (t, e = null) => {
|
||||
try {
|
||||
return JSON.parse(t)
|
||||
} catch {
|
||||
return e
|
||||
}
|
||||
}
|
||||
$.toStr = (t, e = null) => {
|
||||
try {
|
||||
return JSON.stringify(t)
|
||||
} catch {
|
||||
return e
|
||||
}
|
||||
}
|
||||
const linkId = "AkOULcXbUA_8EAPbYLLMgg";
|
||||
const signLinkId = '9WA12jYGulArzWS7vcrwhw';
|
||||
let cookiesArr = [], cookie = '';
|
||||
let message = ""
|
||||
if ($.isNode()) {
|
||||
Object.keys(jdCookieNode).forEach((item) => {
|
||||
cookiesArr.push(jdCookieNode[item])
|
||||
})
|
||||
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.log = () => {
|
||||
};
|
||||
} else {
|
||||
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
|
||||
}
|
||||
|
||||
const JD_API_HOST = 'https://api.m.jd.com/', actCode = 'visa-card-001';
|
||||
|
||||
|
||||
!(async () => {
|
||||
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;
|
||||
}
|
||||
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>极速签到挣金币</font> \n\n --- \n\n"
|
||||
for (let i = 0; i < cookiesArr.length; i++) {
|
||||
if (cookiesArr[i]) {
|
||||
cookie = cookiesArr[i];
|
||||
$.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
|
||||
$.index = i + 1;
|
||||
$.isLogin = true;
|
||||
$.nickName = '';
|
||||
|
||||
username = $.UserName
|
||||
if ($.UserName == "jd_66ea783827d30"){
|
||||
username = "跑腿小弟"
|
||||
}
|
||||
if ($.UserName == "jd_4521b375ebb5d"){
|
||||
username = "锟锟"
|
||||
}
|
||||
if ($.UserName == "jd_542c10c0222bc"){
|
||||
username = "康康"
|
||||
}
|
||||
//加上名称
|
||||
message = message + "<font color=\'#778899\' size=2>【羊毛姐妹】<font color=\'#FFA500\' size=3>" + username + " </font> </font> \n\n "
|
||||
|
||||
await TotalBean();
|
||||
that.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"});
|
||||
|
||||
if ($.isNode()) {
|
||||
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `动动账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
|
||||
}
|
||||
continue
|
||||
}
|
||||
await jdGlobal()
|
||||
}
|
||||
message = message +"----\n"
|
||||
}
|
||||
|
||||
})()
|
||||
.catch((e) => {
|
||||
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
|
||||
})
|
||||
.finally(() => {
|
||||
message += getPic()
|
||||
taht.log(message)
|
||||
postToDingTalk(message)
|
||||
$.done();
|
||||
})
|
||||
|
||||
async function jdGlobal() {
|
||||
try {
|
||||
await signInit()
|
||||
await sign()
|
||||
await getPacketList();//领红包提现
|
||||
await signPrizeDetailList();
|
||||
await invite()
|
||||
await invite2()
|
||||
$.score = 0
|
||||
$.total = 0
|
||||
await taskList()
|
||||
await queryJoy()
|
||||
await signInit()
|
||||
await cash()
|
||||
await showMsg()
|
||||
} catch (e) {
|
||||
$.logErr(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function showMsg() {
|
||||
return new Promise(resolve => {
|
||||
message += "<font color=\'#778899\' size=2>" + `本次运行获得${$.score}金币,共计${$.total}金币` + "</font>\n\n"
|
||||
$.msg($.name, '', `动动账号${$.index}${$.nickName}\n${message}`);
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
|
||||
async function sign() {
|
||||
return new Promise(resolve => {
|
||||
const body = {"linkId":signLinkId,"serviceName":"dayDaySignGetRedEnvelopeSignService","business":1};
|
||||
const options = {
|
||||
url: `https://api.m.jd.com`,
|
||||
body: `functionId=apSignIn_day&body=${escape(JSON.stringify(body))}&_t=${+new Date()}&appid=activities_platform`,
|
||||
headers: {
|
||||
'Cookie': cookie,
|
||||
"Host": "api.m.jd.com",
|
||||
'Origin': 'https://daily-redpacket.jd.com',
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Accept": "*/*",
|
||||
"Connection": "keep-alive",
|
||||
"User-Agent": "jdltapp;iPhone;3.3.2;14.5.1network/wifi;hasUPPay/0;pushNoticeIsOpen/1;lang/zh_CN;model/iPhone13,2;addressid/137923973;hasOCPay/0;appBuild/1047;supportBestPay/0;pv/467.11;apprpd/MyJD_Main;",
|
||||
"Accept-Language": "zh-Hans-CN;q=1, en-CN;q=0.9, zh-Hant-CN;q=0.8",
|
||||
'Referer': 'https://daily-redpacket.jd.com/?activityId=9WA12jYGulArzWS7vcrwhw',
|
||||
"Accept-Encoding": "gzip, deflate, br"
|
||||
}
|
||||
}
|
||||
$.post(options, async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = $.toObj(data);
|
||||
if (data.code === 0) {
|
||||
if (data.data.retCode === 0) {
|
||||
// message += `极速版签到提现:签到成功\n`;
|
||||
console.log(`极速版签到提现:签到成功\n`);
|
||||
} else {
|
||||
message += "<font color=\'#778899\' size=2>" + `极速版签到提现:签到异常:${JSON.stringify(data)}\n` + "</font>\n\n"
|
||||
console.log(`极速版签到提现:签到失败:${data.data.retMessage}\n`);
|
||||
}
|
||||
} else {
|
||||
message += "<font color=\'#778899\' size=2>" + `极速版签到提现:签到异常:${JSON.stringify(data)}\n` + "</font>\n\n"
|
||||
console.log(`极速版签到提现:签到异常:${JSON.stringify(data)}\n`);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
async function signInit() {
|
||||
return new Promise(resolve => {
|
||||
$.get(taskUrl('speedSignInit', {
|
||||
"activityId": "8a8fabf3cccb417f8e691b6774938bc2",
|
||||
"kernelPlatform": "RN",
|
||||
"inviterId":"y3gfQAo9OlMun43uVNyOgQ=="
|
||||
}), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
//that.log(data)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// async function sign() {
|
||||
// return new Promise(resolve => {
|
||||
// $.get(taskUrl('speedSign', {
|
||||
// "kernelPlatform": "RN",
|
||||
// "activityId": "8a8fabf3cccb417f8e691b6774938bc2",
|
||||
// "noWaitPrize": "false"
|
||||
// }),
|
||||
// async (err, resp, data) => {
|
||||
// try {
|
||||
// if (err) {
|
||||
// that.log(`${JSON.stringify(err)}`)
|
||||
// that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
// } else {
|
||||
// if (safeGet(data)) {
|
||||
// data = JSON.parse(data);
|
||||
// if (data.subCode === 0) {
|
||||
// that.log(`签到获得${data.data.signAmount}现金,共计获得${data.data.cashDrawAmount}`)
|
||||
// } else {
|
||||
// that.log(`签到失败,${data.msg}`)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (e) {
|
||||
// $.logErr(e, resp)
|
||||
// } finally {
|
||||
// resolve(data);
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
|
||||
async function taskList() {
|
||||
return new Promise(resolve => {
|
||||
$.get(taskUrl('ClientHandleService.execute', {
|
||||
"version": "3.1.0",
|
||||
"method": "newTaskCenterPage",
|
||||
"data": {"channel": 1}
|
||||
}),
|
||||
async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
for (let task of data.data) {
|
||||
$.taskName = task.taskInfo.mainTitle
|
||||
if (task.taskInfo.status === 0) {
|
||||
if (task.taskType >= 1000) {
|
||||
await doTask(task.taskType)
|
||||
await $.wait(1000)
|
||||
} else {
|
||||
$.canStartNewItem = true
|
||||
while ($.canStartNewItem) {
|
||||
if (task.taskType !== 3) {
|
||||
await queryItem(task.taskType)
|
||||
} else {
|
||||
await startItem("", task.taskType)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
that.log(`${task.taskInfo.mainTitle}已完成`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async function doTask(taskId) {
|
||||
return new Promise(resolve => {
|
||||
$.get(taskUrl('ClientHandleService.execute', {
|
||||
"method": "marketTaskRewardPayment",
|
||||
"data": {"channel": 1, "clientTime": +new Date() + 0.588, "activeType": taskId}
|
||||
}), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if (data.code === 0) {
|
||||
message +="<font color=\'#778899\' size=2>" + `${data.data.taskInfo.mainTitle}任务完成成功,预计获得${data.data.reward}金币` + "</font>\n\n"
|
||||
that.log(`${data.data.taskInfo.mainTitle}任务完成成功,预计获得${data.data.reward}金币`)
|
||||
} else {
|
||||
message +="<font color=\'#778899\' size=2>" + `${data.data.taskInfo.mainTitle}任务发生异常${data.errMsg}` + "</font>\n\n"
|
||||
that.log(`任务完成失败,${data.message}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function getPacketList() {
|
||||
return new Promise(resolve => {
|
||||
$.get(taskGetUrl("spring_reward_list",{"pageNum":1,"pageSize":100,linkId,"inviter":""}), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if (data.code === 0) {
|
||||
for(let item of data.data.items.filter(vo => vo.prizeType===4)){
|
||||
if(item.state===0){
|
||||
console.log(`去提现${item.amount}微信现金`)
|
||||
message +="<font color=\'#778899\' size=2>" + `提现${item.amount}微信现金,` + "</font>\n\n"
|
||||
await cashOut(item.id,item.poolBaseId,item.prizeGroupId,item.prizeBaseId)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
message +="<font color=\'#778899\' size=2>" + `提现发生异常:${data.errMsg}` + "</font>\n\n"
|
||||
console.log(data.errMsg)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
function signPrizeDetailList() {
|
||||
return new Promise(resolve => {
|
||||
const body = {"linkId":signLinkId,"serviceName":"dayDaySignGetRedEnvelopeSignService","business":1,"pageSize":20,"page":1};
|
||||
const options = {
|
||||
url: `https://api.m.jd.com`,
|
||||
body: `functionId=signPrizeDetailList&body=${escape(JSON.stringify(body))}&_t=${+new Date()}&appid=activities_platform`,
|
||||
headers: {
|
||||
'Cookie': cookie,
|
||||
"Host": "api.m.jd.com",
|
||||
'Origin': 'https://daily-redpacket.jd.com',
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Accept": "*/*",
|
||||
"Connection": "keep-alive",
|
||||
"User-Agent": "jdltapp;iPhone;3.3.2;14.5.1network/wifi;hasUPPay/0;pushNoticeIsOpen/1;lang/zh_CN;model/iPhone13,2;addressid/137923973;hasOCPay/0;appBuild/1047;supportBestPay/0;pv/467.11;apprpd/MyJD_Main;",
|
||||
"Accept-Language": "zh-Hans-CN;q=1, en-CN;q=0.9, zh-Hant-CN;q=0.8",
|
||||
'Referer': 'https://daily-redpacket.jd.com/?activityId=9WA12jYGulArzWS7vcrwhw',
|
||||
"Accept-Encoding": "gzip, deflate, br"
|
||||
}
|
||||
}
|
||||
$.post(options, async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = $.toObj(data);
|
||||
if (data.code === 0) {
|
||||
if (data.data.code === 0) {
|
||||
const list = (data.data.prizeDrawBaseVoPageBean.items || []).filter(vo => vo['prizeType'] === 4 && vo['prizeStatus'] === 0);
|
||||
for (let code of list) {
|
||||
console.log(`极速版签到提现,去提现${code['prizeValue']}现金\n`);
|
||||
message += "<font color=\'#778899\' size=2>" + `极速版签到提现,去提现${code['prizeValue']}微信现金,` + "</font>\n\n"
|
||||
await apCashWithDraw(code['id'], code['poolBaseId'], code['prizeGroupId'], code['prizeBaseId']);
|
||||
}
|
||||
} else {
|
||||
console.log(`极速版签到查询奖品:失败:${JSON.stringify(data)}\n`);
|
||||
}
|
||||
} else {
|
||||
console.log(`极速版签到查询奖品:异常:${JSON.stringify(data)}\n`);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
function apCashWithDraw(id, poolBaseId, prizeGroupId, prizeBaseId) {
|
||||
return new Promise(resolve => {
|
||||
const body = {
|
||||
"linkId": signLinkId,
|
||||
"businessSource": "DAY_DAY_RED_PACKET_SIGN",
|
||||
"base": {
|
||||
"prizeType": 4,
|
||||
"business": "dayDayRedPacket",
|
||||
"id": id,
|
||||
"poolBaseId": poolBaseId,
|
||||
"prizeGroupId": prizeGroupId,
|
||||
"prizeBaseId": prizeBaseId
|
||||
}
|
||||
}
|
||||
const options = {
|
||||
url: `https://api.m.jd.com`,
|
||||
body: `functionId=apCashWithDraw&body=${escape(JSON.stringify(body))}&_t=${+new Date()}&appid=activities_platform`,
|
||||
headers: {
|
||||
'Cookie': cookie,
|
||||
"Host": "api.m.jd.com",
|
||||
'Origin': 'https://daily-redpacket.jd.com',
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Accept": "*/*",
|
||||
"Connection": "keep-alive",
|
||||
"User-Agent": "jdltapp;iPhone;3.3.2;14.5.1network/wifi;hasUPPay/0;pushNoticeIsOpen/1;lang/zh_CN;model/iPhone13,2;addressid/137923973;hasOCPay/0;appBuild/1047;supportBestPay/0;pv/467.11;apprpd/MyJD_Main;",
|
||||
"Accept-Language": "zh-Hans-CN;q=1, en-CN;q=0.9, zh-Hant-CN;q=0.8",
|
||||
'Referer': 'https://daily-redpacket.jd.com/?activityId=9WA12jYGulArzWS7vcrwhw',
|
||||
"Accept-Encoding": "gzip, deflate, br"
|
||||
}
|
||||
}
|
||||
$.post(options, async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = $.toObj(data);
|
||||
if (data.code === 0) {
|
||||
if (data.data.status === "310") {
|
||||
console.log(`极速版签到提现现金成功!`)
|
||||
// message += `极速版签到提现现金成功!`;
|
||||
} else {
|
||||
console.log(`极速版签到提现现金:失败:${JSON.stringify(data)}\n`);
|
||||
message +="<font color=\'#778899\' size=2>" + `极速版签到提现现金:失败:${JSON.stringify(data)}\n` + "</font>\n\n"
|
||||
}
|
||||
} else {
|
||||
message +="<font color=\'#778899\' size=2>" + `极速版签到提现现金:失败:${JSON.stringify(data)}\n` + "</font>\n\n"
|
||||
console.log(`极速版签到提现现金:异常:${JSON.stringify(data)}\n`);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
function cashOut(id,poolBaseId,prizeGroupId,prizeBaseId,) {
|
||||
let body = {
|
||||
"businessSource": "SPRING_FESTIVAL_RED_ENVELOPE",
|
||||
"base": {
|
||||
"id": id,
|
||||
"business": null,
|
||||
"poolBaseId": poolBaseId,
|
||||
"prizeGroupId": prizeGroupId,
|
||||
"prizeBaseId": prizeBaseId,
|
||||
"prizeType": 4
|
||||
},
|
||||
linkId,
|
||||
"inviter": ""
|
||||
}
|
||||
return new Promise(resolve => {
|
||||
$.post(taskPostUrl("apCashWithDraw",body), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
console.log(`提现零钱结果:${data}`)
|
||||
data = JSON.parse(data);
|
||||
if (data.code === 0) {
|
||||
if (data['data']['status'] === "310") {
|
||||
console.log(`提现成功!`)
|
||||
// message += `提现成功!\n`;
|
||||
} else {
|
||||
console.log(`提现失败:${data['data']['message']}`);
|
||||
message +="<font color=\'#778899\' size=2>" + `提现失败:${data['data']['message']}` + "</font>\n\n";
|
||||
}
|
||||
} else {
|
||||
message +="<font color=\'#778899\' size=2>" + `提现失败:${data['data']['message']}` + "</font>\n\n";
|
||||
console.log(`提现异常:${data['errMsg']}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async function queryJoy() {
|
||||
return new Promise(resolve => {
|
||||
$.get(taskUrl('ClientHandleService.execute', {"method": "queryJoyPage", "data": {"channel": 1}}),
|
||||
async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if (data.data.taskBubbles)
|
||||
for (let task of data.data.taskBubbles) {
|
||||
await rewardTask(task.id, task.activeType)
|
||||
await $.wait(500)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async function rewardTask(id, taskId) {
|
||||
return new Promise(resolve => {
|
||||
$.get(taskUrl('ClientHandleService.execute', {
|
||||
"method": "joyTaskReward",
|
||||
"data": {"id": id, "channel": 1, "clientTime": +new Date() + 0.588, "activeType": taskId}
|
||||
}), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if (data.code === 0) {
|
||||
$.score += data.data.reward
|
||||
that.log(`气泡收取成功,获得${data.data.reward}金币`)
|
||||
} else {
|
||||
that.log(`气泡收取失败,${data.message}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
async function queryItem(activeType = 1) {
|
||||
return new Promise(resolve => {
|
||||
$.get(taskUrl('ClientHandleService.execute', {
|
||||
"method": "queryNextTask",
|
||||
"data": {"channel": 1, "activeType": activeType}
|
||||
}), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if (data.code === 0 && data.data) {
|
||||
await startItem(data.data.nextResource, activeType)
|
||||
} else {
|
||||
that.log(`商品任务开启失败,${data.message}`)
|
||||
$.canStartNewItem = false
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async function startItem(activeId, activeType) {
|
||||
return new Promise(resolve => {
|
||||
$.get(taskUrl('ClientHandleService.execute', {
|
||||
"method": "enterAndLeave",
|
||||
"data": {
|
||||
"activeId": activeId,
|
||||
"clientTime": +new Date(),
|
||||
"channel": "1",
|
||||
"messageType": "1",
|
||||
"activeType": activeType,
|
||||
}
|
||||
}), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if (data.code === 0 && data.data) {
|
||||
if (data.data.taskInfo.isTaskLimit === 0) {
|
||||
let {videoBrowsing, taskCompletionProgress, taskCompletionLimit} = data.data.taskInfo
|
||||
if (activeType !== 3)
|
||||
videoBrowsing = activeType === 1 ? 5 : 10
|
||||
that.log(`【${taskCompletionProgress + 1}/${taskCompletionLimit}】浏览商品任务记录成功,等待${videoBrowsing}秒`)
|
||||
await $.wait(videoBrowsing * 1000)
|
||||
await endItem(data.data.uuid, activeType, activeId, activeType === 3 ? videoBrowsing : "")
|
||||
} else {
|
||||
that.log(`${$.taskName}任务已达上限`)
|
||||
$.canStartNewItem = false
|
||||
}
|
||||
} else {
|
||||
$.canStartNewItem = false
|
||||
that.log(`${$.taskName}任务开启失败,${data.message}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async function endItem(uuid, activeType, activeId = "", videoTimeLength = "") {
|
||||
return new Promise(resolve => {
|
||||
$.get(taskUrl('ClientHandleService.execute',
|
||||
{
|
||||
"method": "enterAndLeave",
|
||||
"data": {
|
||||
"channel": "1",
|
||||
"clientTime": +new Date(),
|
||||
"uuid": uuid,
|
||||
"videoTimeLength": videoTimeLength,
|
||||
"messageType": "2",
|
||||
"activeType": activeType,
|
||||
"activeId": activeId
|
||||
}
|
||||
}), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if (data.code === 0 && data.isSuccess) {
|
||||
await rewardItem(uuid, activeType, activeId, videoTimeLength)
|
||||
} else {
|
||||
that.log(`${$.taskName}任务结束失败,${data.message}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async function rewardItem(uuid, activeType, activeId = "", videoTimeLength = "") {
|
||||
return new Promise(resolve => {
|
||||
$.get(taskUrl('ClientHandleService.execute',
|
||||
{
|
||||
"method": "rewardPayment",
|
||||
"data": {
|
||||
"channel": "1",
|
||||
"clientTime": +new Date(),
|
||||
"uuid": uuid,
|
||||
"videoTimeLength": videoTimeLength,
|
||||
"messageType": "2",
|
||||
"activeType": activeType,
|
||||
"activeId": activeId
|
||||
}
|
||||
}), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if (data.code === 0 && data.isSuccess) {
|
||||
$.score += data.data.reward
|
||||
that.log(`${$.taskName}任务完成,获得${data.data.reward}金币`)
|
||||
} else {
|
||||
that.log(`${$.taskName}任务失败,${data.message}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async function cash() {
|
||||
return new Promise(resolve => {
|
||||
$.get(taskUrl('MyAssetsService.execute',
|
||||
{"method": "userCashRecord", "data": {"channel": 1, "pageNum": 1, "pageSize": 20}}),
|
||||
async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
$.total = data.data.goldBalance
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
var __encode ='jsjiami.com',_a={}, _0xb483=["\x5F\x64\x65\x63\x6F\x64\x65","\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x73\x6F\x6A\x73\x6F\x6E\x2E\x63\x6F\x6D\x2F\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x6F\x62\x66\x75\x73\x63\x61\x74\x6F\x72\x2E\x68\x74\x6D\x6C"];(function(_0xd642x1){_0xd642x1[_0xb483[0]]= _0xb483[1]})(_a);var __Oxb24bc=["\x6C\x69\x74\x65\x2D\x61\x6E\x64\x72\x6F\x69\x64\x26","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x26\x61\x6E\x64\x72\x6F\x69\x64\x26\x33\x2E\x31\x2E\x30\x26","\x26","\x26\x38\x34\x36\x63\x34\x63\x33\x32\x64\x61\x65\x39\x31\x30\x65\x66","\x31\x32\x61\x65\x61\x36\x35\x38\x66\x37\x36\x65\x34\x35\x33\x66\x61\x66\x38\x30\x33\x64\x31\x35\x63\x34\x30\x61\x37\x32\x65\x30","\x69\x73\x4E\x6F\x64\x65","\x63\x72\x79\x70\x74\x6F\x2D\x6A\x73","","\x61\x70\x69\x3F\x66\x75\x6E\x63\x74\x69\x6F\x6E\x49\x64\x3D","\x26\x62\x6F\x64\x79\x3D","\x26\x61\x70\x70\x69\x64\x3D\x6C\x69\x74\x65\x2D\x61\x6E\x64\x72\x6F\x69\x64\x26\x63\x6C\x69\x65\x6E\x74\x3D\x61\x6E\x64\x72\x6F\x69\x64\x26\x75\x75\x69\x64\x3D\x38\x34\x36\x63\x34\x63\x33\x32\x64\x61\x65\x39\x31\x30\x65\x66\x26\x63\x6C\x69\x65\x6E\x74\x56\x65\x72\x73\x69\x6F\x6E\x3D\x33\x2E\x31\x2E\x30\x26\x74\x3D","\x26\x73\x69\x67\x6E\x3D","\x61\x70\x69\x2E\x6D\x2E\x6A\x64\x2E\x63\x6F\x6D","\x2A\x2F\x2A","\x52\x4E","\x4A\x44\x4D\x6F\x62\x69\x6C\x65\x4C\x69\x74\x65\x2F\x33\x2E\x31\x2E\x30\x20\x28\x69\x50\x61\x64\x3B\x20\x69\x4F\x53\x20\x31\x34\x2E\x34\x3B\x20\x53\x63\x61\x6C\x65\x2F\x32\x2E\x30\x30\x29","\x7A\x68\x2D\x48\x61\x6E\x73\x2D\x43\x4E\x3B\x71\x3D\x31\x2C\x20\x6A\x61\x2D\x43\x4E\x3B\x71\x3D\x30\x2E\x39","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x6C\x6F\x67","\u5220\u9664","\u7248\u672C\u53F7\uFF0C\x6A\x73\u4F1A\u5B9A","\u671F\u5F39\u7A97\uFF0C","\u8FD8\u8BF7\u652F\u6301\u6211\u4EEC\u7684\u5DE5\u4F5C","\x6A\x73\x6A\x69\x61","\x6D\x69\x2E\x63\x6F\x6D"];function taskUrl(_0x7683x2,_0x7683x3= {}){let _0x7683x4=+ new Date();let _0x7683x5=`${__Oxb24bc[0x0]}${JSON[__Oxb24bc[0x1]](_0x7683x3)}${__Oxb24bc[0x2]}${_0x7683x2}${__Oxb24bc[0x3]}${_0x7683x4}${__Oxb24bc[0x4]}`;let _0x7683x6=__Oxb24bc[0x5];const _0x7683x7=$[__Oxb24bc[0x6]]()?require(__Oxb24bc[0x7]):CryptoJS;let _0x7683x8=_0x7683x7.HmacSHA256(_0x7683x5,_0x7683x6).toString();return {url:`${__Oxb24bc[0x8]}${JD_API_HOST}${__Oxb24bc[0x9]}${_0x7683x2}${__Oxb24bc[0xa]}${escape(JSON[__Oxb24bc[0x1]](_0x7683x3))}${__Oxb24bc[0xb]}${_0x7683x4}${__Oxb24bc[0xc]}${_0x7683x8}${__Oxb24bc[0x8]}`,headers:{'\x48\x6F\x73\x74':__Oxb24bc[0xd],'\x61\x63\x63\x65\x70\x74':__Oxb24bc[0xe],'\x6B\x65\x72\x6E\x65\x6C\x70\x6C\x61\x74\x66\x6F\x72\x6D':__Oxb24bc[0xf],'\x75\x73\x65\x72\x2D\x61\x67\x65\x6E\x74':__Oxb24bc[0x10],'\x61\x63\x63\x65\x70\x74\x2D\x6C\x61\x6E\x67\x75\x61\x67\x65':__Oxb24bc[0x11],'\x43\x6F\x6F\x6B\x69\x65':cookie}}}(function(_0x7683x9,_0x7683xa,_0x7683xb,_0x7683xc,_0x7683xd,_0x7683xe){_0x7683xe= __Oxb24bc[0x12];_0x7683xc= function(_0x7683xf){if( typeof alert!== _0x7683xe){alert(_0x7683xf)};if( typeof that!== _0x7683xe){that[__Oxb24bc[0x13]](_0x7683xf)}};_0x7683xb= function(_0x7683x7,_0x7683x9){return _0x7683x7+ _0x7683x9};_0x7683xd= _0x7683xb(__Oxb24bc[0x14],_0x7683xb(_0x7683xb(__Oxb24bc[0x15],__Oxb24bc[0x16]),__Oxb24bc[0x17]));try{_0x7683x9= __encode;if(!( typeof _0x7683x9!== _0x7683xe&& _0x7683x9=== _0x7683xb(__Oxb24bc[0x18],__Oxb24bc[0x19]))){_0x7683xc(_0x7683xd)}}catch(e){_0x7683xc(_0x7683xd)}})({})
|
||||
|
||||
function invite2() {
|
||||
let t = +new Date()
|
||||
var headers = {
|
||||
'Host': 'api.m.jd.com',
|
||||
'accept': 'application/json, text/plain, */*',
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'origin': 'https://assignment.jd.com',
|
||||
'accept-language': 'zh-cn',
|
||||
'user-agent': 'jdltapp;iPad;3.1.0;14.4;a54abe779c8fbeb4e8e34f01fdc5cc4dd78173a2;network/wifi;ADID/BB69CC09-77D8-43A2-8645-CBC4CCE49911;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPad13,1;addressid/3438850002;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/14.9;apprpd/ProductCoupon_MergeMain;ref/FSPromListViewController;psq/0;ads/;psn/a54abe779c8fbeb4e8e34f01fdc5cc4dd78173a2|27;jdv/0|kong|t_1000170135|tuiguang|notset|1613101365448|1613101365;adk/;app_device/IOS;pap/JA2020_3112531|3.1.0|IOS 14.4;Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||
'referer': 'https://assignment.jd.com/?inviterId=GaYxmFpHAG%2BJLi7W28KWYw==&lng=0.000000&lat=0.000000&sid=2131b85f0bcb82714e032402628cc2fw&un_area=12_904_50647_57886',
|
||||
'Cookie': cookie
|
||||
};
|
||||
|
||||
var dataString = `functionId=TaskInviteService&body={"method":"participateInviteTask","data":{"channel":"1","encryptionInviterPin":"GaYxmFpHAG%2BJLi7W28KWYw%3D%3D","type":1}}&appid=market-task-h5&uuid=&_t=${t}`;
|
||||
|
||||
var options = {
|
||||
url: 'https://api.m.jd.com/',
|
||||
headers: headers,
|
||||
body: dataString
|
||||
}
|
||||
$.post(options, (err, resp, data) => {
|
||||
// that.log(data)
|
||||
})
|
||||
}
|
||||
|
||||
function invite() {
|
||||
let t = +new Date()
|
||||
var headers = {
|
||||
'Host': 'api.m.jd.com',
|
||||
'accept': 'application/json, text/plain, */*',
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'origin': 'https://invite-reward.jd.com',
|
||||
'accept-language': 'zh-cn',
|
||||
'user-agent': 'jdltapp;iPad;3.1.0;14.4;Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||
'referer': 'https://invite-reward.jd.com/?lng=0.000000&lat=0.000000&sid=2131b85f0bcb82714e032402628cc2fw&un_area=12_904_50647_57886',
|
||||
'Cookie': cookie
|
||||
};
|
||||
|
||||
var dataString = `functionId=InviteFriendApiService&body={"method":"attendInviteActivity","data":{"inviterPin":"GaYxmFpHAG%2BJLi7W28KWYw%3D%3D","channel":1,"token":"","frontendInitStatus":""}}&referer=-1&eid=eidIf3dd8121b7sdmiBLGdxRR46OlWyh62kFAZogTJFnYqqRkwgr63%2BdGmMlcv7EQJ5v0HBic81xHXzXLwKM6fh3i963zIa7Ym2v5ehnwo2B7uDN92Q0&aid=&client=ios&clientVersion=14.4&networkType=wifi&fp=-1&appid=market-task-h5&_t=${t}`;
|
||||
|
||||
var options = {
|
||||
url: 'https://api.m.jd.com/?t=1613645706861',
|
||||
headers: headers,
|
||||
body: dataString
|
||||
};
|
||||
$.post(options, (err, resp, data) => {
|
||||
// that.log(data)
|
||||
})
|
||||
}
|
||||
|
||||
function TotalBean() {
|
||||
return new Promise(async resolve => {
|
||||
const options = {
|
||||
"url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
|
||||
"headers": {
|
||||
"Accept": "application/json,text/plain, */*",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Accept-Language": "zh-cn",
|
||||
"Connection": "keep-alive",
|
||||
"Cookie": cookie,
|
||||
"Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
|
||||
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0")
|
||||
}
|
||||
}
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
that.log(`${JSON.stringify(err)}`)
|
||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
if (data['retcode'] === 13) {
|
||||
$.isLogin = false; //cookie过期
|
||||
return
|
||||
}
|
||||
if (data['retcode'] === 0) {
|
||||
$.nickName = (data['base'] && data['base'].nickname) || $.UserName;
|
||||
} else {
|
||||
$.nickName = $.UserName
|
||||
}
|
||||
} else {
|
||||
that.log(`动动服务器返回空数据`)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function safeGet(data) {
|
||||
try {
|
||||
if (typeof JSON.parse(data) == "object") {
|
||||
return true;
|
||||
}
|
||||
} catch (e) {
|
||||
that.log(e);
|
||||
that.log(`动动服务器访问数据为空,请检查自身设备网络情况`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function jsonParse(str) {
|
||||
if (typeof str == "string") {
|
||||
try {
|
||||
return JSON.parse(str);
|
||||
} catch (e) {
|
||||
that.log(e);
|
||||
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function taskGetUrl(function_id, body) {
|
||||
return {
|
||||
url: `https://api.m.jd.com/?appid=activities_platform&functionId=${function_id}&body=${escape(JSON.stringify(body))}&t=${+new Date()}`,
|
||||
headers: {
|
||||
'Cookie': cookie,
|
||||
'Host': 'api.m.jd.com',
|
||||
'Accept': '*/*',
|
||||
'Connection': 'keep-alive',
|
||||
'user-agent': $.isNode() ? (process.env.JS_USER_AGENT ? process.env.JS_USER_AGENT : (require('./JS_USER_AGENTS').USER_AGENT)) : ($.getdata('JSUA') ? $.getdata('JSUA') : "'jdltapp;iPad;3.1.0;14.4;network/wifi;Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||
'Accept-Language': 'zh-Hans-CN;q=1,en-CN;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': "application/x-www-form-urlencoded",
|
||||
"referer": "https://an.jd.com/babelDiy/Zeus/q1eB6WUB8oC4eH1BsCLWvQakVsX/index.html"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function taskPostUrl(function_id, body) {
|
||||
return {
|
||||
url: `https://api.m.jd.com/`,
|
||||
body: `appid=activities_platform&functionId=${function_id}&body=${escape(JSON.stringify(body))}&t=${+new Date()}`,
|
||||
headers: {
|
||||
'Cookie': cookie,
|
||||
'Host': 'api.m.jd.com',
|
||||
'Accept': '*/*',
|
||||
'Connection': 'keep-alive',
|
||||
// 'user-agent': $.isNode() ? (process.env.JS_USER_AGENT ? process.env.JS_USER_AGENT : (require('./JS_USER_AGENTS').USER_AGENT)) : ($.getdata('JSUA') ? $.getdata('JSUA') : "'jdltapp;iPad;3.1.0;14.4;network/wifi;Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||
'user-agent': "jdltapp;iPhone;3.3.2;14.3;b488010ad24c40885d846e66931abaf532ed26a5;network/4g;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone11,8;addressid/2005183373;hasOCPay/0;appBuild/1049;supportBestPay/0;pv/220.46;apprpd/;ref/JDLTSubMainPageViewController;psq/0;ads/;psn/b488010ad24c40885d846e66931abaf532ed26a5|520;jdv/0|iosapp|t_335139774|liteshare|CopyURL|1618673222002|1618673227;adk/;app_device/IOS;pap/JA2020_3112531|3.3.2|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1 ",
|
||||
'Accept-Language': 'zh-Hans-CN;q=1,en-CN;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': "application/x-www-form-urlencoded",
|
||||
"referer": "https://an.jd.com/babelDiy/Zeus/q1eB6WUB8oC4eH1BsCLWvQakVsX/index.html"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//我加的函数
|
||||
function postToDingTalk(messgae) {
|
||||
const dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=18444b555747aad3381bc1d1e3dea72b03158e152a846f818d82a1ca946bd430"
|
||||
|
||||
const message1 = "" + messgae
|
||||
that.log(messgae)
|
||||
|
||||
const body = {
|
||||
"msgtype": "markdown",
|
||||
"markdown": {
|
||||
"title":"动动极速签到",
|
||||
"text": message1
|
||||
},
|
||||
"at": {
|
||||
"atMobiles": [],
|
||||
"isAtAll": false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
|
||||
try {
|
||||
that.log(resp)
|
||||
that.log(data)
|
||||
if (err) {
|
||||
that.log(JSON.stringify(err));
|
||||
$.logErr(err);
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
$.duckRes = JSON.parse(data);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
},"json")
|
||||
}
|
||||
|
||||
|
||||
function toDingtalk(urlmain, bodyMain) {
|
||||
return {
|
||||
url: urlmain,
|
||||
body:bodyMain,
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||
timeout: 10000,
|
||||
}
|
||||
}
|
||||
|
||||
function getPic(){
|
||||
let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
|
||||
let address = "\n\n )
|
||||
address = address + code[pos] + ")"
|
||||
return address
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user