diff --git a/jd_jinli_hongbao.ts b/jd_jinli_hongbao.ts index ffbe548..2f86e74 100644 --- a/jd_jinli_hongbao.ts +++ b/jd_jinli_hongbao.ts @@ -12,7 +12,7 @@ import {get, getshareCodeHW, o2s, requireConfig, wait} from "./TS_USER_AGENTS" let cookie: string, cookiesArr: string[] = [], res: any, UserName: string let shareCodesSelf: string[] = [], shareCodes: string[] = [], shareCodesHW: string[] = [], fullCode: string[] = [] -let min: number[] = [0.02, 0.12, 0.3, 0.4, 0.6, 0.7, 0.8, 1, 1.2, 2, 3.6], log: string +let min: number[] = [0.02, 0.03, 0.12, 0.3, 0.4, 0.6, 0.7, 0.8, 1, 1.2, 2, 3.6], log: string !(async () => { cookiesArr = await requireConfig(false) diff --git a/jd_mofang.ts b/jd_mofang.ts new file mode 100644 index 0000000..74e9930 --- /dev/null +++ b/jd_mofang.ts @@ -0,0 +1,129 @@ +import axios from 'axios' +import {o2s, requireConfig, wait} from './TS_USER_AGENTS' +import {mf_logs} from './test/mf_log'; + +let cookie: string = '', res: any = '', UserName: string, index: number, log: string = '' + +!(async () => { + let cookiesArr: any = await requireConfig() + for (let i = 0; i < cookiesArr.length; i++) { + cookie = cookiesArr[i] + UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1]) + index = i + 1 + console.log(`\n开始【京东账号${index}】${UserName}\n`) + + res = await api("functionId=getInteractionHomeInfo&body=%7B%22sign%22%3A%22u6vtLQ7ztxgykLEr%22%7D&appid=content_ecology&client=wh5&clientVersion=1.0.0") + let sign: string = res.result.taskConfig.projectId + + res = await api(`functionId=queryInteractiveInfo&body=%7B%22encryptProjectId%22%3A%22${sign}%22%2C%22sourceCode%22%3A%22acexinpin0823%22%2C%22ext%22%3A%7B%7D%7D&client=wh5&clientVersion=1.0.0&appid=content_ecology`) + o2s(res) + for (let t of res.assignmentList) { + if (t.completionCnt < t.assignmentTimesLimit) { + if (t.ext) { + if (t.assignmentName === '每日签到') { + if (t.ext.sign1.status === 1) { + let signDay: number = t.ext.sign1.signList?.length || 0, + type: number = t.rewards[signDay].rewardType + console.log(signDay, type) + log = getLog() + res = await api(`functionId=doInteractiveAssignment&body=${JSON.stringify({ + "encryptProjectId": sign, "encryptAssignmentId": t.encryptAssignmentId, "sourceCode": "acexinpin0823", "itemId": "1", "actionType": "", "completionFlag": "", "ext": {}, "extParam": {"businessData": {"random": log.match(/"random":"(\d+)"/)[1]}, "signStr": log.match(/"log":"(.*)"/)[1], "sceneid": "XMFhPageh5"} + })}&client=wh5&clientVersion=1.0.0&appid=content_ecology`) + o2s(res, '签到成功') + } else { + console.log('已签到') + } + } + + for (let proInfo of t.ext.productsInfo ?? []) { + if (proInfo.status === 1) { + console.log(t.assignmentName) + log = getLog() + res = await api(`functionId=doInteractiveAssignment&body=${encodeURIComponent(JSON.stringify({"encryptProjectId": sign, "encryptAssignmentId": t.encryptAssignmentId, "sourceCode": "acexinpin0823", "itemId": proInfo.itemId, "actionType": 0, "completionFlag": "", "ext": {}, "extParam": {"businessData": {"random": log.match(/"random":"(\d+)"/)[1]}, "signStr": log.match(/"log":"(.*)"/)[1], "sceneid": "XMFhPageh5"}}))}&client=wh5&clientVersion=1.0.0&appid=content_ecology`) + o2s(res) + } + } + + for (let proInfo of t.ext.shoppingActivity ?? []) { + if (proInfo.status === 1) { + console.log(t.assignmentName) + log = getLog() + res = await api(`functionId=doInteractiveAssignment&body=${encodeURIComponent(JSON.stringify({"encryptProjectId": sign, "encryptAssignmentId": t.encryptAssignmentId, "sourceCode": "acexinpin0823", "itemId": proInfo.itemId, "actionType": 1, "completionFlag": "", "ext": {}, "extParam": {"businessData": {"random": log.match(/"random":"(\d+)"/)[1]}, "signStr": log.match(/"log":"(.*)"/)[1], "sceneid": "XMFhPageh5"}}))}&client=wh5&clientVersion=1.0.0&appid=content_ecology`) + o2s(res) + await wait(t.ext.waitDuration * 1000) + log = getLog() + res = await api(`functionId=doInteractiveAssignment&body=${encodeURIComponent(JSON.stringify({"encryptProjectId": sign, "encryptAssignmentId": t.encryptAssignmentId, "sourceCode": "acexinpin0823", "itemId": proInfo.itemId, "actionType": 0, "completionFlag": "", "ext": {}, "extParam": {"businessData": {"random": log.match(/"random":"(\d+)"/)[1]}, "signStr": log.match(/"log":"(.*)"/)[1], "sceneid": "XMFhPageh5"}}))}&client=wh5&clientVersion=1.0.0&appid=content_ecology`) + o2s(res) + } + } + + for (let proInfo of t.ext.browseShop ?? []) { + if (proInfo.status === 1) { + console.log(t.assignmentName) + log = getLog() + res = await api(`functionId=doInteractiveAssignment&body=${JSON.stringify({ + "encryptProjectId": sign, "encryptAssignmentId": t.encryptAssignmentId, "sourceCode": "acexinpin0823", "itemId": proInfo.itemId, "actionType": 1, "completionFlag": "", "ext": {}, "extParam": {"businessData": {"random": log.match(/"random":"(\d+)"/)[1]}, "signStr": log.match(/"log":"(.*)"/)[1], "sceneid": "XMFhPageh5"} + })}&client=wh5&clientVersion=1.0.0&appid=content_ecology`) + o2s(res) + await wait(t.ext.waitDuration * 1000) + log = getLog() + res = await api(`functionId=doInteractiveAssignment&body=${JSON.stringify({ + "encryptProjectId": sign, "encryptAssignmentId": t.encryptAssignmentId, "sourceCode": "acexinpin0823", "itemId": proInfo.itemId, "actionType": 0, "completionFlag": "", "ext": {}, "extParam": {"businessData": {"random": log.match(/"random":"(\d+)"/)[1]}, "signStr": log.match(/"log":"(.*)"/)[1], "sceneid": "XMFhPageh5"} + })}&client=wh5&clientVersion=1.0.0&appid=content_ecology`) + o2s(res) + } + } + + for (let proInfo of t.ext.addCart ?? []) { + if (proInfo.status === 1) { + console.log(t.assignmentName) + log = getLog() + res = await api(`functionId=doInteractiveAssignment&body=${encodeURIComponent(JSON.stringify({"encryptProjectId": sign, "encryptAssignmentId": t.encryptAssignmentId, "sourceCode": "acexinpin0823", "itemId": proInfo.itemId, "actionType": "0", "completionFlag": "", "ext": {}, "extParam": {"businessData": {"random": log.match(/"random":"(\d+)"/)[1]}, "signStr": log.match(/"log":"(.*)"/)[1], "sceneid": "XMFJGh5"}}))}&client=wh5&clientVersion=1.0.0&appid=content_ecology`) + o2s(res) + } + } + } else if (t.assignmentName === '去新品频道逛逛') { + + } + } + } + } + /* + console.log('助力排队:', shareCodeSelf) + cookie = cookiesArr[0] + UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1]) + for (let code of shareCodeSelf) { + console.log(`账号1 ${UserName} 去助力 ${code.itemId}`) + res = await api(`functionId=doInteractiveAssignment&body=%7B%22encryptProjectId%22%3A%22${code.encryptProjectId}%22%2C%22encryptAssignmentId%22%3A%22${code.encryptAssignmentId}%22%2C%22sourceCode%22%3A%22acexinpin0823%22%2C%22itemId%22%3A%22${code.itemId}%22%2C%22actionType%22%3A%22%22%2C%22completionFlag%22%3A%22%22%2C%22ext%22%3A%7B%7D%7D&client=wh5&clientVersion=1.0.0&appid=content_ecology`) + console.log('助力结果:', res) + await wait(2000) + } + + if (shareCodeSelf[0]) { + cookie = cookiesArr[1] + UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1]) + let code: any = shareCodeSelf[0] + console.log(`账号2 ${UserName} 去助力 ${code.itemId}`) + res = await api(`functionId=doInteractiveAssignment&body=%7B%22encryptProjectId%22%3A%22${code.encryptProjectId}%22%2C%22encryptAssignmentId%22%3A%22${code.encryptAssignmentId}%22%2C%22sourceCode%22%3A%22acexinpin0823%22%2C%22itemId%22%3A%22${code.itemId}%22%2C%22actionType%22%3A%22%22%2C%22completionFlag%22%3A%22%22%2C%22ext%22%3A%7B%7D%7D&client=wh5&clientVersion=1.0.0&appid=content_ecology`) + console.log('助力结果:', res) + }*/ +})() + +async function api(params: any) { + let {data}: any = await axios.post("https://api.m.jd.com/client.action", params, { + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + "User-Agent": "Mozilla/5.0 (Linux; U; Android 8.0.0; zh-cn; Mi Note 2 Build/OPR1.170623.032) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/61.0.3163.128 Mobile Safari/537.36 XiaoMi/MiuiBrowser/10.1.1", + 'Referer': 'https://h5.m.jd.com/babelDiy/Zeus/2bf3XEEyWG11pQzPGkKpKX2GxJz2/index.html', + 'Origin': 'https://h5.m.jd.com', + 'Host': 'api.m.jd.com', + 'Cookie': cookie + } + }) + await wait(1000) + return data +} + +function getLog() { + return mf_logs[Math.floor(Math.random() * mf_logs.length)] +} \ No newline at end of file