2 Star 1 Fork 27

kevin/jd_scripts

forked from XanderYe/jd_scripts 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
jd_cfd.ts 26.37 KB
一键复制 编辑 原始数据 按行查看 历史
kevin 提交于 2021-11-30 10:17 . edit
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
/**
* 京喜财富岛
* 包含雇佣导游,建议每小时1次
* 使用jd_env_copy.js同步js环境变量到ts
* 使用jd_ts_test.ts测试环境变量
*
* cron: 0 * * * *
*/
import axios from 'axios'
import {Md5} from 'ts-md5'
import {getDate} from 'date-fns'
import {requireConfig, wait, requestAlgo, h5st, getJxToken, getBeanShareCode, getFarmShareCode, getRandomNumberByRange, randomString} from './TS_USER_AGENTS'
const axi = axios.create({timeout: 10000})
let cookie: string = '', res: any = '', UserName: string, index: number
let shareCodes: string[] = [], shareCodesSelf: string[] = [], shareCodesHW: string[] = [], isCollector: Boolean = false, token: any = {}
interface Params {
strBuildIndex?: string,
ddwCostCoin?: number,
taskId?: number,
dwType?: string,
configExtra?: string,
strStoryId?: string,
triggerType?: number,
ddwTriggerDay?: number,
ddwConsumeCoin?: number,
dwIsFree?: number,
ddwTaskId?: string,
strShareId?: string,
strMarkList?: string,
dwSceneId?: string,
strTypeCnt?: string,
dwUserId?: number,
ddwCoin?: number,
ddwMoney?: number,
dwPrizeLv?: number,
dwPrizeType?: number,
strPrizePool?: string,
dwFirst?: any,
dwIdentityType?: number,
strBussKey?: string,
strMyShareId?: string,
ddwCount?: number,
__t?: number,
strBT?: string,
dwCurStageEndCnt?: number,
dwRewardType?: number,
dwRubbishId?: number,
strPgtimestamp?: number,
strPhoneID?: string,
strPgUUNum?: string,
showAreaTaskFlag?: number,
strVersion?: string,
strIndex?: string
strToken?: string
dwGetType?: number,
ddwSeaonStart?: number,
size?: number,
type?: number,
strLT?: string,
dwQueryType?: number,
dwPageIndex?: number,
dwPageSize?: number,
dwProperty?: number,
bizCode?: string,
dwCardType?: number,
strCardTypeIndex?: string,
dwIsReJoin?: number,
}
!(async () => {
await requestAlgo()
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`)
token = getJxToken(cookie)
try {
await makeShareCodes()
} catch (e) {
console.log(e)
}
// 当日累计获得财富
let todayMoney: number = 0, flag: boolean = true
for (let dwPageIndex = 0; dwPageIndex < 5; dwPageIndex++) {
if (!flag) break
res = await api('user/GetMoneyDetail', '_cfd_t,bizCode,dwEnv,dwPageIndex,dwPageSize,dwProperty,dwQueryType,ptag,source,strZone', {dwQueryType: 0, dwPageIndex: 1, dwPageSize: 10, dwProperty: 1})
await wait(1000)
for (let t of res?.Detail) {
if (getDate(t.ddwTime * 1000) === getDate(new Date())) {
todayMoney += t.ddwValue
} else {
flag = false
break
}
}
}
console.log('今日累计获得财富:', todayMoney)
// 离线
res = await api('user/QueryUserInfo', '_cfd_t,bizCode,ddwTaskId,dwEnv,ptag,source,strMarkList,strPgUUNum,strPgtimestamp,strPhoneID,strShareId,strZone', {ddwTaskId: '', strShareId: '', strMarkList: 'guider_step,collect_coin_auth,guider_medal,guider_over_flag,build_food_full,build_sea_full,build_shop_full,build_fun_full,medal_guider_show,guide_guider_show,guide_receive_vistor,daily_task,guider_daily_task', strPgtimestamp: token.strPgtimestamp, strPhoneID: token.strPhoneID, strPgUUNum: token.strPgUUNum})
await wait(5000)
res = await api('user/QueryUserInfo', '_cfd_t,bizCode,ddwTaskId,dwEnv,dwIsReJoin,ptag,source,strPgUUNum,strPgtimestamp,strPhoneID,strShareId,strVersion,strZone', {ddwTaskId: '', strShareId: '', strMarkList: 'undefined', strVersion: '1.0.1', dwIsReJoin: 0, strPgtimestamp: token.strPgtimestamp, strPhoneID: token.strPhoneID, strPgUUNum: token.strPgUUNum})
console.log('财富余额:', res.ddwRichBalance)
await wait(5000)
// 寻宝
for (let xb of res.XbStatus.XBDetail) {
if (xb.dwRemainCnt !== 0) {
res = await api('user/TreasureHunt', '_cfd_t,bizCode,dwEnv,ptag,source,strIndex,strZone', {strIndex: xb.strIndex})
if (res.iRet === 0) {
console.log('发现宝物:', res.AwardInfo.ddwValue)
} else {
console.log('寻宝失败:', res)
break
}
await wait(2000)
}
}
let tasks: any
// 加速卡任务
tasks = await api('story/GetPropTask', '_cfd_t,bizCode,dwEnv,ptag,source,strZone')
for (let t of tasks.Data.TaskList) {
if (t.dwCompleteNum === t.dwTargetNum && t.dwAwardStatus === 2) {
res = await api('Award', '_cfd_t,bizCode,dwEnv,ptag,source,strZone,taskId', {bizCode: tasks.Data.strZone, taskId: t.ddwTaskId})
await wait(1000)
if (res.ret === 0) {
let prizeInfo: any = JSON.parse(res.data.prizeInfo)
let CardList: any = prizeInfo.CardInfo.CardList
let cards: string = ''
for (let card of CardList) {
cards += card.strCardName
}
console.log('加速卡领取成功', cards)
} else {
console.log('加速卡领取失败', res)
break
}
}
if (t.dwCompleteNum < t.dwTargetNum && t.strTaskName !== '去接待NPC') {
console.log(t.strTaskName)
res = await api('DoTask', '_cfd_t,bizCode,configExtra,dwEnv,ptag,source,strZone,taskId', {bizCode: tasks.Data.strZone, taskId: t.ddwTaskId})
await wait(t.dwLookTime * 1000 ?? 2000)
if (res.ret === 0) {
console.log('加速卡任务完成')
} else {
console.log('加速卡任务失败', res)
break
}
}
}
// 加速卡
res = await api('user/GetPropCardCenterInfo', '_cfd_t,bizCode,dwEnv,ptag,source,strZone')
let richcard: any = res.cardInfo.richcard, coincard: any = res.cardInfo.coincard, isUsing: boolean = res.cardInfo.dwWorkingType !== 0
for (let card of coincard) {
if (!isUsing && card.dwCardNums !== 0) {
res = await api('user/UsePropCard', '_cfd_t,bizCode,dwCardType,dwEnv,ptag,source,strCardTypeIndex,strZone', {dwCardType: 1, strCardTypeIndex: encodeURIComponent(card.strCardTypeIndex)})
if (res.iRet === 0) {
console.log('金币加速卡使用成功')
isUsing = true
} else {
console.log('金币加速卡使用失败', res)
break
}
} else {
break
}
}
for (let card of richcard) {
if (!isUsing && card.dwCardNums !== 0) {
for (let j = 0; j < card.dwCardNums; j++) {
res = await api('user/UsePropCard', '_cfd_t,bizCode,dwCardType,dwEnv,ptag,source,strCardTypeIndex,strZone', {dwCardType: 2, strCardTypeIndex: encodeURIComponent(card.strCardTypeIndex)})
if (res.iRet === 0) {
console.log('点券加速卡使用成功')
isUsing = true
} else {
console.log('点券加速卡使用失败', res)
break
}
await wait(2000)
}
} else {
break
}
}
// 任务⬇️
console.log('底部任务列表开始')
for (let j = 0; j < 30; j++) {
if (await task() === 0) {
break
}
await wait(3000)
}
console.log('底部任务列表结束')
// 升级建筑
while (1) {
res = await api('user/QueryUserInfo',
'_cfd_t,bizCode,ddwTaskId,dwEnv,ptag,source,strMarkList,strPgUUNum,strPgtimestamp,strPhoneID,strShareId,strZone',
{
ddwTaskId: '',
strShareId: '',
strMarkList: 'guider_step,collect_coin_auth,guider_medal,guider_over_flag,build_food_full,build_sea_full,build_shop_full,build_fun_full,medal_guider_show,guide_guider_show,guide_receive_vistor,daily_task,guider_daily_task',
strPgtimestamp: token.strPgtimestamp,
strPhoneID: token.strPhoneID,
strPgUUNum: token.strPgUUNum
})
let wallet: number = res.ddwCoinBalance
console.log('金币余额:', wallet)
let build: string = '', minLV: number = 99999
for (let b of ['food', 'fun', 'shop', 'sea']) {
res = await api('user/GetBuildInfo', '_cfd_t,bizCode,dwEnv,dwType,ptag,source,strBuildIndex,strZone', {strBuildIndex: b})
await wait(2000)
if (res.dwBuildLvl <= minLV) {
minLV = res.dwBuildLvl
build = b
}
}
console.log('最低等级建筑:', minLV, build)
res = await api('user/GetBuildInfo', '_cfd_t,bizCode,dwEnv,dwType,ptag,source,strBuildIndex,strZone', {strBuildIndex: build})
console.log(`${build}升级需要:`, res.ddwNextLvlCostCoin)
await wait(2000)
if (res.dwCanLvlUp === 1 && res.ddwNextLvlCostCoin * 2 <= wallet) {
res = await api('user/BuildLvlUp', '_cfd_t,bizCode,ddwCostCoin,dwEnv,ptag,source,strBuildIndex,strZone', {ddwCostCoin: res.ddwNextLvlCostCoin, strBuildIndex: build})
await wait(2000)
if (res.iRet === 0) {
console.log(`升级成功`)
await wait(2000)
}
} else {
break
}
await wait(3000)
}
// 珍珠
res = await api('user/ComposePearlState', '', {__t: Date.now(), dwGetType: 0})
let dwCurProgress: number = res.dwCurProgress, strDT: string = res.strDT, strMyShareId: string = res.strMyShareId, ddwSeasonStartTm: number = res.ddwSeasonStartTm
let strLT: string = res.oPT[res.ddwCurTime % (res.oPT.length)]
console.log(`已合成${dwCurProgress}个珍珠,${res.ddwVirHb / 100}元红包`)
if (res.dayDrawInfo.dwIsDraw === 0) {
res = await api("user/GetPearlDailyReward", "__t,strZone", {__t: Date.now()})
if (res.iRet === 0) {
res = await api("user/PearlDailyDraw", "__t,ddwSeaonStart,strToken,strZone", {__t: Date.now(), ddwSeaonStart: ddwSeasonStartTm, strToken: res.strToken})
if (res.strPrizeName) {
console.log('抽奖获得:', res.strPrizeName)
} else {
console.log('抽奖失败?', res)
}
}
}
// 模拟合成
if (strDT) {
console.log('继续合成')
let RealTmReport: number = getRandomNumberByRange(10, 20)
console.log('本次合成需要上报:', RealTmReport)
for (let j = 0; j < RealTmReport; j++) {
res = await api('user/RealTmReport', '', {__t: Date.now(), dwIdentityType: 0, strBussKey: 'composegame', strMyShareId: strMyShareId, ddwCount: 10})
if (res.iRet === 0)
console.log(`游戏中途上报${j + 1}:OK`)
await wait(2000)
if (getRandomNumberByRange(1, 6) === 2) {
res = await api('user/ComposePearlAward', '__t,size,strBT,strZone,type', {__t: Date.now(), size: 1, strBT: strDT, type: 4})
if (res.iRet === 0) {
console.log(`上报得红包:${res.ddwAwardHb / 100}红包,当前有${res.ddwVirHb / 100}`)
} else {
console.log('上报得红包失败:', res)
}
await wait(1000)
}
}
// 珍珠奖励
res = await api(`user/ComposePearlAddProcess`, '__t,strBT,strLT,strZone', {__t: Date.now(), strBT: strDT, strLT: strLT})
if (res.iRet === 0) {
console.log(`合成成功:获得${res.ddwAwardHb / 100}红包,当前有${res.dwCurProgress}珍珠,${res.ddwVirHb / 100}红包`)
} else {
console.log('合成失败:', res)
}
}
// 签到 助力奖励
res = await api('story/GetTakeAggrPage', '_cfd_t,bizCode,dwEnv,ptag,source,strZone')
let employee: any = res.Data.Employee.EmployeeList.filter((e: any) => {
return e.dwStatus === 0
})
for (let emp of employee) {
let empRes: any = await api('story/helpdraw', '_cfd_t,bizCode,dwEnv,dwUserId,ptag,source,strZone', {dwUserId: emp.dwId})
if (empRes.iRet === 0)
console.log('助力奖励领取成功:', empRes.Data.ddwCoin)
await wait(1000)
}
if (res.Data.Sign.dwTodayStatus === 0) {
console.log('今日未签到')
for (let sign of res.Data.Sign.SignList) {
if (sign.dwDayId === res.Data.Sign.dwTodayId) {
res = await api('story/RewardSign',
'_cfd_t,bizCode,ddwCoin,ddwMoney,dwEnv,dwPrizeLv,dwPrizeType,ptag,source,strPgUUNum,strPgtimestamp,strPhoneID,strPrizePool,strZone',
{
ddwCoin: sign.ddwCoin,
ddwMoney: sign.ddwMoney,
dwPrizeLv: sign.dwBingoLevel,
dwPrizeType: sign.dwPrizeType,
strPrizePool: sign.strPrizePool,
strPgtimestamp: token.strPgtimestamp,
strPhoneID: token.strPhoneID,
strPgUUNum: token.strPgUUNum
})
if (res.iRet === 0)
console.log('签到成功:', res.Data.ddwCoin, res.Data.ddwMoney, res.Data.strPrizePool)
else
console.log('签到失败:', res)
break
}
}
} else {
console.log('今日已经签到')
}
await wait(2000)
res = await api('user/QueryUserInfo', '_cfd_t,bizCode,ddwTaskId,dwEnv,ptag,source,strMarkList,strPgUUNum,strPgtimestamp,strPhoneID,strShareId,strVersion,strZone', {
ddwTaskId: '',
strShareId: '',
strMarkList: 'guider_step,collect_coin_auth,guider_medal,guider_over_flag,build_food_full,build_sea_full,build_shop_full,build_fun_full,medal_guider_show,guide_guider_show,guide_receive_vistor,daily_task,guider_daily_task,cfd_has_show_selef_point',
strPgUUNum: token.strPgUUNum,
strPgtimestamp: token.strPgtimestamp,
strPhoneID: token.strPhoneID,
strVersion: '1.0.1'
})
await wait(5000)
if (res.StoryInfo.StoryList) {
// 美人鱼
if (res.StoryInfo.StoryList[0].Mermaid) {
console.log(`发现美人鱼🧜‍♀️`)
let MermaidRes: any = await api('story/MermaidOper', '_cfd_t,bizCode,ddwTriggerDay,dwEnv,dwType,ptag,source,strStoryId,strZone', {
strStoryId: res.StoryInfo.StoryList[0].strStoryId,
dwType: '1',
ddwTriggerDay: res.StoryInfo.StoryList[0].ddwTriggerDay
})
await wait(3000)
if (MermaidRes.iRet === 0) {
MermaidRes = await api('story/MermaidOpe', '_cfd_t,bizCode,ddwTriggerDay,dwEnv,dwType,ptag,source,strStoryId,strZone', {
strStoryId: res.StoryInfo.StoryList[0].strStoryId,
dwType: '3',
ddwTriggerDay: res.StoryInfo.StoryList[0].ddwTriggerDay
})
if (MermaidRes.iRet === 0) {
console.log(`拯救美人鱼成功`)
}
}
await wait(1000)
MermaidRes = await api('story/MermaidOper', '_cfd_t,bizCode,ddwTriggerDay,dwEnv,dwType,ptag,source,strStoryId,strZone', {
strStoryId: res.StoryInfo.StoryList[0].strStoryId,
dwType: '2',
ddwTriggerDay: res.StoryInfo.StoryList[0].ddwTriggerDay
})
if (MermaidRes.iRet === 0)
console.log('获得金币:', MermaidRes.Data.ddwCoin)
}
await wait(2000)
if (res.StoryInfo.StoryList[0].Special) {
console.log(`船来了,乘客是${res.StoryInfo.StoryList[0].Special.strName}`)
let shipRes: any = await api('story/SpecialUserOper', '_cfd_t,bizCode,ddwTriggerDay,dwEnv,dwType,ptag,source,strStoryId,strZone,triggerType', {
strStoryId: res.StoryInfo.StoryList[0].strStoryId,
dwType: '2',
triggerType: 0,
ddwTriggerDay: res.StoryInfo.StoryList[0].ddwTriggerDay
})
console.log('正在下船,等待30s')
await wait(30000)
shipRes = await api('story/SpecialUserOper', '_cfd_t,bizCode,ddwTriggerDay,dwEnv,dwType,ptag,source,strStoryId,strZone,triggerType', {
strStoryId: res.StoryInfo.StoryList[0].strStoryId,
dwType: '3',
triggerType: 0,
ddwTriggerDay: res.StoryInfo.StoryList[0].ddwTriggerDay
})
if (shipRes.iRet === 0)
console.log('船客接待成功')
else
console.log('船客接待失败', shipRes)
}
isCollector = false
if (res.StoryInfo.StoryList[0].Collector) {
console.log('收藏家出现')
// TODO 背包满了再卖给收破烂的
res = await api('story/CollectorOper', '_cfd_t,bizCode,dwEnv,ptag,source,strZone,strStoryId,dwType,ddwTriggerDay', {strStoryId: res.StoryInfo.StoryList[0].strStoryId, dwType: '2', ddwTriggerDay: res.StoryInfo.StoryList[0].ddwTriggerDay})
console.log(res)
await wait(1000)
isCollector = true
// 清空背包
res = await api('story/querystorageroom', '_cfd_t,bizCode,dwEnv,ptag,source,strZone')
let bags: number[] = []
for (let s of res.Data.Office) {
bags.push(s.dwType)
bags.push(s.dwCount)
}
await wait(1000)
let strTypeCnt: string = ''
for (let n = 0; n < bags.length; n++) {
if (n % 2 === 0)
strTypeCnt += `${bags[n]}:`
else
strTypeCnt += `${bags[n]}|`
}
if (bags.length !== 0) {
res = await api('story/sellgoods', '_cfd_t,bizCode,dwEnv,dwSceneId,ptag,source,strTypeCnt,strZone',
{dwSceneId: isCollector ? '2' : '1', strTypeCnt: strTypeCnt})
console.log('卖贝壳收入:', res.Data.ddwCoin, res.Data.ddwMoney)
}
}
await wait(2000)
}
// 清空背包
res = await api('story/querystorageroom', '_cfd_t,bizCode,dwEnv,ptag,source,strZone')
let bags: number[] = []
for (let s of res.Data.Office) {
bags.push(s.dwType)
bags.push(s.dwCount)
}
await wait(1000)
let strTypeCnt: string = ''
for (let n = 0; n < bags.length; n++) {
if (n % 2 === 0)
strTypeCnt += `${bags[n]}:`
else
strTypeCnt += `${bags[n]}|`
}
if (bags.length !== 0) {
res = await api('story/sellgoods', '_cfd_t,bizCode,dwEnv,dwSceneId,ptag,source,strTypeCnt,strZone',
{dwSceneId: isCollector ? '2' : '1', strTypeCnt: strTypeCnt})
console.log('卖贝壳收入:', res.Data.ddwCoin, res.Data.ddwMoney)
}
// 垃圾🚮
res = await api('story/QueryRubbishInfo', '_cfd_t,bizCode,dwEnv,ptag,source,strZone')
if (res.Data.StoryInfo.StoryList.length !== 0) {
console.log('有垃圾')
await api('story/RubbishOper', '_cfd_t,bizCode,dwEnv,dwRewardType,dwType,ptag,source,strZone', {
dwType: '1',
dwRewardType: 0
})
await wait(1000)
for (let j = 1; j < 9; j++) {
res = await api('story/RubbishOper', '_cfd_t,bizCode,dwEnv,dwRewardType,dwRubbishId,dwType,ptag,source,strZone', {
dwType: '2',
dwRewardType: 0,
dwRubbishId: j
})
await wait(1500)
}
}
await wait(2000)
// 任务➡️
tasks = await api('story/GetActTask', '_cfd_t,bizCode,dwEnv,ptag,source,strZone')
await wait(2000)
for (let t of tasks.Data.TaskList) {
if ([1, 2].indexOf(t.dwOrderId) > -1 && t.dwCompleteNum < t.dwTargetNum && t.strTaskName != '热气球接待20位游客') {
console.log('开始任务➡️:', t.strTaskName)
res = await api('DoTask', '_cfd_t,bizCode,configExtra,dwEnv,ptag,source,strZone,taskId', {taskId: t.ddwTaskId, configExtra: ''}, 'right')
await wait(t.dwLookTime * 1000)
if (res.ret === 0) {
console.log('任务完成')
} else {
console.log('任务失败', res)
}
}
}
tasks = await api('story/GetActTask', '_cfd_t,bizCode,dwEnv,ptag,source,strZone')
await wait(2000)
for (let t of tasks.Data.TaskList) {
if (t.dwCompleteNum === t.dwTargetNum && t.dwAwardStatus === 2) {
res = await api('Award', '_cfd_t,bizCode,configExtra,dwEnv,ptag,source,strZone,taskId', {taskId: t.ddwTaskId}, 'right')
await wait(1000)
if (res.ret === 0) {
console.log(`领奖成功:`, res)
} else {
console.log('领奖失败', res)
}
}
}
tasks = await api('story/GetActTask', '_cfd_t,bizCode,dwEnv,ptag,source,strZone')
await wait(2000)
if (tasks.Data.dwStatus === 3) {
res = await api('story/ActTaskAward', '_cfd_t,bizCode,dwEnv,ptag,source,strZone')
if (res.ret === 0) {
console.log('100财富任务完成')
}
}
await wait(2000)
// 导游
res = await api('user/EmployTourGuideInfo', '_cfd_t,bizCode,dwEnv,ptag,source,strZone')
if (!res.TourGuideList) {
console.log('手动雇佣4个试用导游')
} else {
for (let e of res.TourGuideList) {
if (e.strBuildIndex !== 'food' && e.ddwRemainTm === 0) {
let employ: any = await api('user/EmployTourGuide', '_cfd_t,bizCode,ddwConsumeCoin,dwEnv,dwIsFree,ptag,source,strBuildIndex,strZone',
{ddwConsumeCoin: e.ddwCostCoin, dwIsFree: 0, strBuildIndex: e.strBuildIndex})
if (employ.iRet === 0)
console.log(`雇佣${e.strBuildIndex}导游成功`)
if (employ.iRet === 2003)
break
await wait(1000)
}
}
}
await wait(2000)
for (let b of ['fun', 'shop', 'sea', 'food']) {
res = await api('user/CollectCoin', '_cfd_t,bizCode,dwEnv,dwType,ptag,source,strBuildIndex,strZone', {strBuildIndex: b, dwType: '1'})
console.log(`${b}收金币:`, res.ddwCoin)
await wait(1000)
}
}
for (let i = 0; i < cookiesArr.length; i++) {
await getCodesHW()
// 获取随机助力码
try {
let {data}: any = await axi.get(`https://api.jdsharecode.xyz/api/jxcfd/30`, {timeout: 10000})
shareCodes = [...shareCodesSelf, ...shareCodesHW, ...data.data]
} catch (e) {
console.log('获取助力池失败')
shareCodes = [...shareCodesSelf, ...shareCodesHW]
}
for (let j = 0; j < shareCodes.length; j++) {
cookie = cookiesArr[i]
console.log(`账号${i + 1}去助力:`, shareCodes[j])
res = await api('story/helpbystage', '_cfd_t,bizCode,dwEnv,ptag,source,strShareId,strZone', {strShareId: shareCodes[j]})
if (res.iRet === 0) {
console.log('助力成功:', res.Data.GuestPrizeInfo.strPrizeName)
} else if (res.iRet === 2235) {
console.log('上限')
break
} else if (res.iRet === 1023) {
console.log('信号弱')
break
} else if (res.iRet === 2191) {
console.log('已助力')
} else {
console.log('其他错误:', res)
}
await wait(3000)
}
}
})()
async function api(fn: string, stk: string, params: Params = {}, taskPosition = '') {
let url: string
if (['GetUserTaskStatusList', 'Award', 'DoTask'].includes(fn)) {
let bizCode: string
if (!params.bizCode) {
bizCode = taskPosition === 'right' ? 'jxbfddch' : 'jxbfd'
} else {
bizCode = params.bizCode
}
url = `https://m.jingxi.com/newtasksys/newtasksys_front/${fn}?strZone=jxbfd&bizCode=${bizCode}&source=jxbfd&dwEnv=7&_cfd_t=${Date.now()}&ptag=&_stk=${encodeURIComponent(stk)}&_ste=1&_=${Date.now()}&sceneval=2&g_login_type=1&callback=jsonpCBK${String.fromCharCode(Math.floor(Math.random() * 26) + "A".charCodeAt(0))}&g_ty=ls`
} else {
url = `https://m.jingxi.com/jxbfd/${fn}?strZone=jxbfd&bizCode=jxbfd&source=jxbfd&dwEnv=7&_cfd_t=${Date.now()}&ptag=&_stk=${encodeURIComponent(stk)}&_ste=1&_=${Date.now()}&sceneval=2&g_login_type=1&callback=jsonpCBK${String.fromCharCode(Math.floor(Math.random() * 26) + "A".charCodeAt(0))}&g_ty=ls`
}
url = h5st(url, stk, params, 10032)
let {data} = await axios.get(url, {
headers: {
'Host': 'm.jingxi.com',
'Accept': '*/*',
'Connection': 'keep-alive',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
'User-Agent': `jdpingou;iPhone;4.13.0;14.4.2;${randomString(40)};network/wifi;model/iPhone10,2;appBuild/100609;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/1;hasOCPay/0;supportBestPay/0;session/${Math.random() * 98 + 1};pap/JA2019_3111789;brand/apple;supportJDSHWK/1;Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148`,
'Referer': 'https://st.jingxi.com/',
'Cookie': cookie
}
})
if (typeof data === 'string') {
try {
return JSON.parse(data.replace(/\n/g, '').match(/jsonpCBK.?\(([^)]*)/)![1])
} catch (e) {
console.log(data)
return ''
}
} else {
return data
}
}
async function task() {
console.log('刷新任务列表')
res = await api('GetUserTaskStatusList', '_cfd_t,bizCode,dwEnv,ptag,showAreaTaskFlag,source,strZone,taskId', {taskId: 0, showAreaTaskFlag: 1})
await wait(2000)
for (let t of res.data.userTaskStatusList) {
if (t.awardStatus === 2 && t.completedTimes === t.targetTimes) {
console.log('可领奖:', t.taskName)
res = await api('Award', '_cfd_t,bizCode,dwEnv,ptag,source,strZone,taskId', {taskId: t.taskId, bizCode: t.bizCode})
await wait(2000)
if (res.ret === 0) {
try {
res = JSON.parse(res.data.prizeInfo)
console.log(`领奖成功:`, res.ddwCoin, res.ddwMoney)
} catch (e) {
console.log('领奖成功:', res.data)
}
await wait(1000)
return 1
} else {
console.log('领奖失败:', res)
return 0
}
}
if (t.dateType === 2 && t.awardStatus === 2 && t.completedTimes < t.targetTimes && t.taskCaller === 1) {
console.log('做任务:', t.taskId, t.taskName, t.completedTimes, t.targetTimes)
res = await api('DoTask', '_cfd_t,bizCode,configExtra,dwEnv,ptag,source,strZone,taskId', {taskId: t.taskId, configExtra: '', bizCode: t.bizCode})
await wait(5000)
if (res.ret === 0) {
console.log('任务完成')
return 1
} else {
console.log('任务失败')
return 0
}
}
}
return 0
}
async function makeShareCodes() {
try {
res = await api('user/QueryUserInfo', '_cfd_t,bizCode,ddwTaskId,dwEnv,ptag,source,strPgUUNum,strPgtimestamp,strPhoneID,strShareId,strVersion,strZone', {
ddwTaskId: '',
strShareId: '',
strMarkList: 'undefined',
strPgUUNum: token.strPgUUNum,
strPgtimestamp: token.strPgtimestamp,
strPhoneID: token.strPhoneID,
strVersion: '1.0.1'
})
console.log('助力码:', res.strMyShareId)
shareCodesSelf.push(res.strMyShareId)
let bean: string = await getBeanShareCode(cookie)
let farm: string = await getFarmShareCode(cookie)
let pin: string = Md5.hashStr(cookie.match(/pt_pin=([^;]*)/)![1])
let {data}: any = await axios.get(`https://api.jdsharecode.xyz/api/autoInsert/jxcfd?sharecode=${res.strMyShareId}&bean=${bean}&farm=${farm}&pin=${pin}`)
console.log(data.message)
} catch (e) {
console.log('自动提交失败')
console.log(e)
}
}
async function getCodesHW() {
try {
let {data}: any = await axi.get(`https://api.jdsharecode.xyz/api/HW_CODES`, {timeout: 10000})
shareCodesHW = data['jxcfd'] || []
} catch (e) {
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kevin0217/jd_scripts.git
git@gitee.com:kevin0217/jd_scripts.git
kevin0217
jd_scripts
jd_scripts
master

搜索帮助