mirror of
https://github.com/shufflewzc/faker3.git
synced 2026-04-04 08:54:08 +08:00
sync
This commit is contained in:
94
jd_mofang.ts
94
jd_mofang.ts
@@ -1,10 +1,23 @@
|
||||
import axios from 'axios'
|
||||
import {o2s, requireConfig, wait} from './TS_USER_AGENTS'
|
||||
import {mf_logs} from './test/mf_log';
|
||||
/**
|
||||
* 京东-新品-魔方
|
||||
* 本地log或rabbit log
|
||||
* cron: 10 9,12,15 * * *
|
||||
*/
|
||||
|
||||
import {o2s, requireConfig, wait, post, get} from './TS_USER_AGENTS'
|
||||
import {existsSync} from "fs";
|
||||
import * as dotenv from 'dotenv'
|
||||
|
||||
let cookie: string = '', res: any = '', UserName: string, index: number, log: string = ''
|
||||
let rabbitToken: string = process.env.RABBIT_TOKEN || '', tg_id: string = process.env.TG_ID || '', mf_logs: any
|
||||
|
||||
!(async () => {
|
||||
dotenv.config()
|
||||
if (existsSync('./test/mf_log.ts')) {
|
||||
mf_logs = require('./test/mf_log').mf_logs
|
||||
} else {
|
||||
console.log('./test/mf_log not found')
|
||||
}
|
||||
let cookiesArr: any = await requireConfig()
|
||||
for (let i = 0; i < cookiesArr.length; i++) {
|
||||
cookie = cookiesArr[i]
|
||||
@@ -16,7 +29,7 @@ let cookie: string = '', res: any = '', UserName: string, index: number, log: st
|
||||
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)
|
||||
// o2s(res)
|
||||
for (let t of res.assignmentList) {
|
||||
if (t.completionCnt < t.assignmentTimesLimit) {
|
||||
if (t.ext) {
|
||||
@@ -25,7 +38,7 @@ let cookie: string = '', res: any = '', UserName: string, index: number, log: st
|
||||
let signDay: number = t.ext.sign1.signList?.length || 0,
|
||||
type: number = t.rewards[signDay].rewardType
|
||||
console.log(signDay, type)
|
||||
log = getLog()
|
||||
log = await 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`)
|
||||
@@ -38,20 +51,23 @@ let cookie: string = '', res: any = '', UserName: string, index: number, log: st
|
||||
for (let proInfo of t.ext.productsInfo ?? []) {
|
||||
if (proInfo.status === 1) {
|
||||
console.log(t.assignmentName)
|
||||
log = getLog()
|
||||
log = await 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)
|
||||
if (res.msg === '任务已完成') {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (let proInfo of t.ext.shoppingActivity ?? []) {
|
||||
if (proInfo.status === 1) {
|
||||
console.log(t.assignmentName)
|
||||
log = getLog()
|
||||
log = await 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()
|
||||
log = await 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)
|
||||
}
|
||||
@@ -60,13 +76,13 @@ let cookie: string = '', res: any = '', UserName: string, index: number, log: st
|
||||
for (let proInfo of t.ext.browseShop ?? []) {
|
||||
if (proInfo.status === 1) {
|
||||
console.log(t.assignmentName)
|
||||
log = getLog()
|
||||
log = await 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()
|
||||
log = await 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`)
|
||||
@@ -77,9 +93,12 @@ let cookie: string = '', res: any = '', UserName: string, index: number, log: st
|
||||
for (let proInfo of t.ext.addCart ?? []) {
|
||||
if (proInfo.status === 1) {
|
||||
console.log(t.assignmentName)
|
||||
log = getLog()
|
||||
log = await 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)
|
||||
if (res.msg === '任务已完成') {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (t.assignmentName === '去新品频道逛逛') {
|
||||
@@ -88,42 +107,29 @@ let cookie: string = '', res: any = '', UserName: string, index: number, log: st
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
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
|
||||
}
|
||||
})
|
||||
async function api(params: string) {
|
||||
await wait(1000)
|
||||
return data
|
||||
return await post("https://api.m.jd.com/client.action", params, {
|
||||
'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
|
||||
})
|
||||
}
|
||||
|
||||
function getLog() {
|
||||
return mf_logs[Math.floor(Math.random() * mf_logs.length)]
|
||||
async function getLog() {
|
||||
if (rabbitToken && tg_id) {
|
||||
console.log('rabbit log api')
|
||||
let {data} = await get(`http://www.madrabbit.cf:8080/license/log?tg_id=${tg_id}&token=${rabbitToken}`)
|
||||
return `'"random":"${data.random}","log":"${data.log}"'`
|
||||
} else if (mf_logs) {
|
||||
return mf_logs[Math.floor(Math.random() * mf_logs.length)]
|
||||
} else {
|
||||
console.log('No log')
|
||||
process.exit(0)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user