mirror of
https://github.com/shufflewzc/faker2.git
synced 2025-04-23 10:58:44 +08:00
update
This commit is contained in:
parent
58b5b33cbc
commit
e3bee3ddbd
35
jd_captian_mn.js
Executable file
35
jd_captian_mn.js
Executable file
File diff suppressed because one or more lines are too long
40
jd_dadoudou.js
Normal file
40
jd_dadoudou.js
Normal file
File diff suppressed because one or more lines are too long
79
jd_farautomation.js
Normal file
79
jd_farautomation.js
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
//20 5,12,21 * * * m_jd_farm_automation.js
|
||||||
|
//问题反馈:https://t.me/Wall_E_Channel
|
||||||
|
const {Env} = require('./magic');
|
||||||
|
const $ = new Env('M农场自动化');
|
||||||
|
let level = process.env.M_JD_FARM_LEVEL ? process.env.M_JD_FARM_LEVEL * 1 : 2
|
||||||
|
$.log('默认种植2级种子,自行配置请配置 M_JD_FARM_LEVEL')
|
||||||
|
$.logic = async function () {
|
||||||
|
let info = await api('initForFarm',
|
||||||
|
{"version": 11, "channel": 3, "babelChannel": 0});
|
||||||
|
$.log(JSON.stringify(info));
|
||||||
|
if (!info?.farmUserPro?.treeState) {
|
||||||
|
$.log('可能没玩农场')
|
||||||
|
}
|
||||||
|
if (info.farmUserPro.treeState === 1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (info.farmUserPro.treeState === 2) {
|
||||||
|
await $.wait(1000, 3000)
|
||||||
|
$.log(`${info.farmUserPro.name},种植时间:${$.formatDate(
|
||||||
|
info.farmUserPro.createTime)}`);
|
||||||
|
//成熟了
|
||||||
|
let coupon = await api('gotCouponForFarm',
|
||||||
|
{"version": 11, "channel": 3, "babelChannel": 0});
|
||||||
|
$.log(coupon)
|
||||||
|
info = await api('initForFarm',
|
||||||
|
{"version": 11, "channel": 3, "babelChannel": 0});
|
||||||
|
}
|
||||||
|
if (info.farmUserPro.treeState !== 3) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let hongBao = info.myHongBaoInfo.hongBao;
|
||||||
|
$.putMsg(`${hongBao.discount}红包,${$.formatDate(hongBao.endTime)}过期`)
|
||||||
|
let element = info.farmLevelWinGoods[level][0];
|
||||||
|
await $.wait(1000, 3000)
|
||||||
|
info = await api('choiceGoodsForFarm', {
|
||||||
|
"imageUrl": '',
|
||||||
|
"nickName": '',
|
||||||
|
"shareCode": '',
|
||||||
|
"goodsType": element.type,
|
||||||
|
"type": "0",
|
||||||
|
"version": 11,
|
||||||
|
"channel": 3,
|
||||||
|
"babelChannel": 0
|
||||||
|
});
|
||||||
|
if (info.code * 1 === 0) {
|
||||||
|
$.putMsg(`已种【${info.farmUserPro.name}】`)
|
||||||
|
}
|
||||||
|
await api('gotStageAwardForFarm',
|
||||||
|
{"type": "4", "version": 11, "channel": 3, "babelChannel": 0});
|
||||||
|
await api('waterGoodForFarm',
|
||||||
|
{"type": "", "version": 11, "channel": 3, "babelChannel": 0});
|
||||||
|
await api('gotStageAwardForFarm',
|
||||||
|
{"type": "1", "version": 11, "channel": 3, "babelChannel": 0});
|
||||||
|
};
|
||||||
|
|
||||||
|
$.run({
|
||||||
|
wait: [20000, 30000], whitelist: ['1-15']
|
||||||
|
}).catch(
|
||||||
|
reason => $.log(reason));
|
||||||
|
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
async function api(fn, body) {
|
||||||
|
let url = `https://api.m.jd.com/client.action?functionId=${fn}&body=${JSON.stringify(
|
||||||
|
body)}&client=apple&clientVersion=10.0.4&osVersion=13.7&appid=wh5&loginType=2&loginWQBiz=interact`
|
||||||
|
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓请求头↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
|
||||||
|
let headers = {
|
||||||
|
"Cookie": $.cookie,
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Accept": "*/*",
|
||||||
|
"Host": "api.m.jd.com",
|
||||||
|
'User-Agent': `Mozilla/5.0 (iPhone; CPU iPhone OS 14_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.4(0x1800042c) NetType/4G Language/zh_CN miniProgram`,
|
||||||
|
"Accept-Encoding": "gzip, deflate, br",
|
||||||
|
"Accept-Language": "zh-cn"
|
||||||
|
}
|
||||||
|
let {data} = await $.request(url, headers)
|
||||||
|
await $.wait(1000, 3000)
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
125
jd_follow_shop.js
Normal file
125
jd_follow_shop.js
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
/*
|
||||||
|
7 7 7 7 7 m_jd_follow_shop.js
|
||||||
|
*/
|
||||||
|
let mode = __dirname.includes('magic')
|
||||||
|
const {Env} = mode ? require('./magic') : require('./magic')
|
||||||
|
const $ = new Env('M关注有礼');
|
||||||
|
$.followShopArgv = process.env.M_FOLLOW_SHOP_ARGV
|
||||||
|
? process.env.M_FOLLOW_SHOP_ARGV
|
||||||
|
: '';
|
||||||
|
if (mode) {
|
||||||
|
$.followShopArgv = '1000104168_1000104168'
|
||||||
|
}
|
||||||
|
$.logic = async function () {
|
||||||
|
let argv = $?.followShopArgv?.split('_');
|
||||||
|
$.shopId = argv?.[0];
|
||||||
|
$.venderId = argv?.[1];
|
||||||
|
if (!$.shopId || !$.venderId) {
|
||||||
|
$.log(`无效的参数${$.followShopArgv}`)
|
||||||
|
$.expire = true;
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let actInfo = await getShopHomeActivityInfo();
|
||||||
|
if (actInfo?.code !== '0') {
|
||||||
|
$.log(JSON.stringify(actInfo))
|
||||||
|
if (actInfo?.message.includes('不匹配')) {
|
||||||
|
$.expire = true;
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let actInfoData = actInfo?.result;
|
||||||
|
|
||||||
|
if (actInfoData?.shopGifts?.filter(o => o.rearWord.includes('京豆')).length
|
||||||
|
> 0) {
|
||||||
|
$.activityId = actInfoData?.activityId?.toString();
|
||||||
|
let gift = await drawShopGift();
|
||||||
|
if (gift?.code !== '0') {
|
||||||
|
$.log(JSON.stringify(gift))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let giftData = gift?.result;
|
||||||
|
$.log(giftData)
|
||||||
|
for (let ele of
|
||||||
|
giftData?.alreadyReceivedGifts?.filter(o => o.prizeType === 4) || []) {
|
||||||
|
$.putMsg(`${ele.redWord}${ele.rearWord}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$.putMsg(`没有豆子`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let kv = {'jd': '京豆', 'jf': '积分', 'dq': 'q券'}
|
||||||
|
$.after = async function () {
|
||||||
|
$.msg.push(`\n${(await $.getShopInfo()).shopName}`);
|
||||||
|
if ($?.content) {
|
||||||
|
let message = `\n`;
|
||||||
|
for (let ele of $.content || []) {
|
||||||
|
message += ` ${ele.takeNum || ele.discount} ${kv[ele?.type]}\n`
|
||||||
|
}
|
||||||
|
$.msg.push(message)
|
||||||
|
$.msg.push($.activityUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.run({whitelist: ['1-5'], wait: [1000, 3000]}).catch(reason => $.log(reason))
|
||||||
|
|
||||||
|
async function drawShopGift() {
|
||||||
|
$.log('店铺信息', $.shopId, $.venderId, $.activityId)
|
||||||
|
let sb = {
|
||||||
|
"follow": 0,
|
||||||
|
"shopId": $.shopId,
|
||||||
|
"activityId": $.activityId,
|
||||||
|
"sourceRpc": "shop_app_home_window",
|
||||||
|
"venderId": $.venderId
|
||||||
|
};
|
||||||
|
let newVar = await $.sign('drawShopGift', sb);
|
||||||
|
|
||||||
|
let headers = {
|
||||||
|
'J-E-H': '',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
'Host': 'api.m.jd.com',
|
||||||
|
'Referer': '',
|
||||||
|
'J-E-C': '',
|
||||||
|
'Accept-Language': 'zh-Hans-CN;q=1, en-CN;q=0.9',
|
||||||
|
'Accept': '*/*',
|
||||||
|
'User-Agent': 'JD4iPhone/167841 (iPhone; iOS; Scale/3.00)'
|
||||||
|
}
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
headers['Cookie'] = $.cookie
|
||||||
|
let url = `https://api.m.jd.com/client.action?functionId=` + newVar.fn
|
||||||
|
let {status, data} = await $.request(url, headers, newVar.sign);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getShopHomeActivityInfo() {
|
||||||
|
let sb = {
|
||||||
|
"shopId": $.shopId,
|
||||||
|
"source": "app-shop",
|
||||||
|
"latWs": "0",
|
||||||
|
"lngWs": "0",
|
||||||
|
"displayWidth": "1098.000000",
|
||||||
|
"sourceRpc": "shop_app_home_home",
|
||||||
|
"lng": "0",
|
||||||
|
"lat": "0",
|
||||||
|
"venderId": $.venderId
|
||||||
|
}
|
||||||
|
let newVar = await $.sign('getShopHomeActivityInfo', sb);
|
||||||
|
let headers = {
|
||||||
|
'J-E-H': '',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
'Host': 'api.m.jd.com',
|
||||||
|
'Referer': '',
|
||||||
|
'J-E-C': '',
|
||||||
|
'Accept-Language': 'zh-Hans-CN;q=1, en-CN;q=0.9',
|
||||||
|
'Accept': '*/*',
|
||||||
|
'User-Agent': 'JD4iPhone/167841 (iPhone; iOS; Scale/3.00)'
|
||||||
|
}
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
headers['Cookie'] = $.cookie
|
||||||
|
let url = `https://api.m.jd.com/client.action?functionId=` + newVar.fn
|
||||||
|
let {status, data} = await $.request(url, headers, newVar.sign);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
actId 活动id
|
actId 活动id
|
||||||
无内置,助力ck1,默认不跑
|
无内置,助力ck1,默认不跑
|
||||||
7 7 7 7 7
|
7 7 7 7 7 jd_jinggengjcq_dapainew.js
|
||||||
*/
|
*/
|
||||||
const $ = new Env("大牌联合");
|
const $ = new Env("大牌联合");
|
||||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||||
|
545
jd_lzdz1_customized5_16.js
Normal file
545
jd_lzdz1_customized5_16.js
Normal file
File diff suppressed because one or more lines are too long
64
jd_pet_automation.js
Normal file
64
jd_pet_automation.js
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
//40 5,12,21 * * * m_jd_pet_automation.js
|
||||||
|
//问题反馈:https://t.me/Wall_E_Channel
|
||||||
|
const {Env} = require('./magic');
|
||||||
|
const $ = new Env('M萌宠自动化');
|
||||||
|
let commodityName = process.env.M_JD_PET_COMMODITY
|
||||||
|
? process.env.M_JD_PET_COMMODITY
|
||||||
|
: ''
|
||||||
|
$.log('默认4级商品,生产指定商品请自行配置 M_JD_PET_COMMODITY')
|
||||||
|
$.logic = async function () {
|
||||||
|
let info = await api('initPetTown', {"version": 1});
|
||||||
|
$.log(JSON.stringify(info));
|
||||||
|
debugger
|
||||||
|
if (info?.result?.petStatus < 5) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (info?.result?.petStatus === 5) {
|
||||||
|
$.log(info?.result?.goodsInfo);
|
||||||
|
let activityId = info?.result?.goodsInfo.activityId;
|
||||||
|
let activityIds = info?.result?.goodsInfo.activityIds;
|
||||||
|
let data = await api('redPacketExchange',
|
||||||
|
{"activityId": activityId, "activityIds": activityIds});
|
||||||
|
$.putMsg(`${info?.result?.goodsInfo.exchangeMedalNum === 4 ? '12'
|
||||||
|
: '25'}红包,${$.formatDate(
|
||||||
|
$.timestamp() + data.result.pastDays * 24 * 60 * 60 * 1000)}过期`)
|
||||||
|
info = await api('initPetTown', {"version": 1});
|
||||||
|
}
|
||||||
|
if (info?.result?.petStatus === 6) {
|
||||||
|
info = await api('goodsInfoList', {"type": 2})
|
||||||
|
let goods = commodityName ? info.result.goodsList.filter(
|
||||||
|
o => o.goodsName.includes(commodityName))[0]
|
||||||
|
: info.result.goodsList.filter(o => o.exchangeMedalNum === 4)[0];
|
||||||
|
if (!goods) {
|
||||||
|
$.putMsg(`没找到你要生产的 ${commodityName}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
info = await api('goodsInfoUpdate', {"goodsId": goods.goodsId})
|
||||||
|
$.putMsg(`生产【${info.result.goodsInfo.goodsName}】成功`)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$.run({
|
||||||
|
wait: [2000, 3000], whitelist: ['1-15']
|
||||||
|
}).catch(
|
||||||
|
reason => $.log(reason));
|
||||||
|
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
async function api(fn, body) {
|
||||||
|
let url = `https://api.m.jd.com/client.action?functionId=${fn}&body=${JSON.stringify(
|
||||||
|
body)}&client=apple&clientVersion=10.0.4&osVersion=13.7&appid=wh5&loginType=2&loginWQBiz=pet-town`
|
||||||
|
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓请求头↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
|
||||||
|
let headers = {
|
||||||
|
"Cookie": $.cookie,
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Accept": "*/*",
|
||||||
|
"Host": "api.m.jd.com",
|
||||||
|
'User-Agent': `Mozilla/5.0 (iPhone; CPU iPhone OS 14_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.4(0x1800042c) NetType/4G Language/zh_CN miniProgram`,
|
||||||
|
"Accept-Encoding": "gzip, deflate, br",
|
||||||
|
"Accept-Language": "zh-cn"
|
||||||
|
}
|
||||||
|
let {data} = await $.request(url, headers)
|
||||||
|
await $.wait(1000, 3000)
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
关注 https://t.me/okyydsnb
|
关注 https://t.me/okyydsnb
|
||||||
7 7 7 7 7
|
7 7 7 7 7 jd_share.js
|
||||||
注意控制ck数量
|
注意控制ck数量
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
182
jd_wx_addCart.js
Normal file
182
jd_wx_addCart.js
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
//问题反馈:https://t.me/Wall_E_Channel
|
||||||
|
/*
|
||||||
|
7 7 7 7 7 m_jd_wx_addCart.js
|
||||||
|
*/
|
||||||
|
let mode = __dirname.includes('magic')
|
||||||
|
const {Env} = mode ? require('./magic') : require('./magic')
|
||||||
|
const $ = new Env('M加购有礼');
|
||||||
|
$.activityUrl = process.env.M_WX_ADD_CART_URL
|
||||||
|
? process.env.M_WX_ADD_CART_URL
|
||||||
|
: '';
|
||||||
|
if (mode) {
|
||||||
|
$.activityUrl = 'https://lzkj-isv.isvjcloud.com/wxCollectionActivity/activity2/507a016fb7cc46acb51f792cbbbd9903?activityId=507a016fb7cc46acb51f792cbbbd9903&shopid=1000003005'
|
||||||
|
}
|
||||||
|
$.activityUrl = $.match(
|
||||||
|
/(https?:\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|])/,
|
||||||
|
$.activityUrl)
|
||||||
|
$.domain = $.match(/https?:\/\/([^/]+)/, $.activityUrl)
|
||||||
|
$.activityId = $.getQueryString($.activityUrl, 'activityId')
|
||||||
|
$.activityContent = ''
|
||||||
|
$.logic = async function () {
|
||||||
|
if (!$.activityId || !$.activityUrl) {
|
||||||
|
$.expire = true;
|
||||||
|
$.putMsg(`activityId|activityUrl不存在`);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$.log(`活动地址: ${$.activityUrl}`)
|
||||||
|
$.UA = $.ua();
|
||||||
|
|
||||||
|
let token = await $.isvObfuscator();
|
||||||
|
if (token.code !== '0') {
|
||||||
|
$.putMsg(`获取Token失败`);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$.Token = token?.token
|
||||||
|
|
||||||
|
let actInfo = await $.api('customer/getSimpleActInfoVo',
|
||||||
|
`activityId=${$.activityId}`);
|
||||||
|
if (!actInfo.result) {
|
||||||
|
$.expire = true;
|
||||||
|
$.putMsg(`获取活动信息失败`);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$.venderId = actInfo.data.venderId;
|
||||||
|
$.shopId = actInfo.data.shopId;
|
||||||
|
$.activityType = actInfo.data.activityType;
|
||||||
|
|
||||||
|
let myPing = await $.api('customer/getMyPing',
|
||||||
|
`userId=${$.venderId}&token=${$.Token}&fromType=APP`)
|
||||||
|
if (!myPing.result) {
|
||||||
|
$.putMsg(`获取pin失败`);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$.Pin = $.domain.includes('cjhy') ? encodeURIComponent(
|
||||||
|
encodeURIComponent(myPing.data.secretPin)) : encodeURIComponent(
|
||||||
|
myPing.data.secretPin);
|
||||||
|
|
||||||
|
await $.api(
|
||||||
|
`common/${$.domain.includes('cjhy') ? 'accessLog' : 'accessLogWithAD'}`,
|
||||||
|
`venderId=${$.venderId}&code=${$.activityType}&pin=${$.Pin}&activityId=${$.activityId}&pageUrl=${encodeURIComponent(
|
||||||
|
$.activityUrl)}&subType=app&adSource=`);
|
||||||
|
let activityContent = await $.api('wxCollectionActivity/activityContent',
|
||||||
|
`activityId=${$.activityId}&pin=${$.Pin}`);
|
||||||
|
|
||||||
|
if (!activityContent.result || !activityContent.data) {
|
||||||
|
$.putMsg(activityContent.errorMessage || '活动可能已结束')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
$.activityContent = activityContent;
|
||||||
|
let content = activityContent.data;
|
||||||
|
if (![6, 7, 9, 13, 14, 15, 16].includes(
|
||||||
|
activityContent.data.drawInfo.drawInfoType)) {
|
||||||
|
$.putMsg(`垃圾活动不跑了`)
|
||||||
|
$.expire = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (1 > 2) {
|
||||||
|
let memberInfo = await $.api($.domain.includes('cjhy')
|
||||||
|
? 'mc/new/brandCard/common/shopAndBrand/getOpenCardInfo'
|
||||||
|
: 'wxCommonInfo/getActMemberInfo',
|
||||||
|
$.domain.includes('cjhy')
|
||||||
|
? `venderId=${$.venderId}&buyerPin=${$.Pin}&activityType=${$.activityType}`
|
||||||
|
:
|
||||||
|
`venderId=${$.venderId}&activityId=${$.activityId}&pin=${$.Pin}`);
|
||||||
|
// 没开卡需要开卡
|
||||||
|
if ($.domain.includes('cjhy')) {
|
||||||
|
if (memberInfo.result && !memberInfo.data?.openCard
|
||||||
|
&& memberInfo.data?.openCardLink) {
|
||||||
|
$.putMsg('需要开卡,跳过')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (memberInfo.result && !memberInfo.data?.openCard
|
||||||
|
&& memberInfo.data?.actMemberStatus === 1) {
|
||||||
|
$.putMsg('需要开卡,跳过')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await $.api('wxActionCommon/getUserInfo', `pin=${$.Pin}`)
|
||||||
|
if (content.needFollow && !content.hasFollow) {
|
||||||
|
let followShop = await $.api(`wxActionCommon/followShop`,
|
||||||
|
`userId=${$.venderId}&activityId=${$.activityId}&buyerNick=${$.Pin}&activityType=${$.activityType}`);
|
||||||
|
await $.wait(1300, 1500)
|
||||||
|
if (!followShop.result) {
|
||||||
|
$.putMsg(followShop.errorMessage)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let needCollectionSize = content.needCollectionSize || 1;
|
||||||
|
let hasCollectionSize = content.hasCollectionSize;
|
||||||
|
let oneKeyAddCart = content.oneKeyAddCart * 1 === 1;
|
||||||
|
$.log('drawInfo', JSON.stringify(content.drawInfo));
|
||||||
|
if (hasCollectionSize < needCollectionSize) {
|
||||||
|
let productIds = [];
|
||||||
|
a:for (let cpvo of content.cpvos) {
|
||||||
|
if (oneKeyAddCart) {
|
||||||
|
productIds.push(cpvo.skuId)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for (let i = 0; i < 2; i++) {
|
||||||
|
try {
|
||||||
|
let carInfo = await $.api(`wxCollectionActivity/addCart`,
|
||||||
|
`activityId=${$.activityId}&pin=${$.Pin}&productId=${cpvo.skuId}`)
|
||||||
|
if (carInfo.result) {
|
||||||
|
if (carInfo.data.hasAddCartSize >= needCollectionSize) {
|
||||||
|
$.log(`加购完成,本次加购${carInfo.data.hasAddCartSize}个商品`)
|
||||||
|
break a
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
await $.wxStop(carInfo.errorMessage) ? $.expire = true
|
||||||
|
: ''
|
||||||
|
$.putMsg(`${carInfo.errorMessage || '未知'}`);
|
||||||
|
break a
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.log(e)
|
||||||
|
} finally {
|
||||||
|
await $.wait(1300, 1500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (oneKeyAddCart) {
|
||||||
|
let carInfo = await $.api('wxCollectionActivity/oneKeyAddCart',
|
||||||
|
`activityId=${$.activityId}&pin=${$.Pin}&productIds=${encodeURIComponent(
|
||||||
|
JSON.stringify(productIds))}`)
|
||||||
|
if (carInfo.result && carInfo.data) {
|
||||||
|
$.log(`加购完成,本次加购${carInfo.data.hasAddCartSize}个商品`)
|
||||||
|
} else {
|
||||||
|
await $.wxStop(carInfo.errorMessage) ? $.expire = true : ''
|
||||||
|
$.putMsg(`${carInfo.errorMessage || '未知'}`);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($.expire) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let prize = await $.api('wxCollectionActivity/getPrize',
|
||||||
|
`activityId=${$.activityId}&pin=${$.Pin}`);
|
||||||
|
if (prize.result) {
|
||||||
|
let msg = prize.data.drawOk ? prize.data.name : prize.data.errorMessage
|
||||||
|
|| '空气';
|
||||||
|
await $.wxStop(prize.data.errorMessage) ? $.expire = true : ''
|
||||||
|
$.putMsg(msg);
|
||||||
|
} else {
|
||||||
|
await $.wxStop(prize.errorMessage) ? $.expire = true : ''
|
||||||
|
$.putMsg(`${prize.errorMessage || '未知'}`);
|
||||||
|
}
|
||||||
|
await $.unfollow()
|
||||||
|
}
|
||||||
|
$.after = async function () {
|
||||||
|
$.msg.push(`\n${(await $.getShopInfo()).shopName}`)
|
||||||
|
$.msg.push(
|
||||||
|
`\n加购${$.activityContent?.data?.needCollectionSize}件,${$.activityContent.data.drawInfo?.name
|
||||||
|
|| ''}\n`);
|
||||||
|
$.msg.push($.activityUrl)
|
||||||
|
}
|
||||||
|
$.run({whitelist: ['1-5'], wait: [3000, 5000]}).catch(
|
||||||
|
reason => $.log(reason));
|
241
jd_wx_collectCard.js
Normal file
241
jd_wx_collectCard.js
Normal file
@ -0,0 +1,241 @@
|
|||||||
|
//问题反馈:https://t.me/Wall_E_Channel
|
||||||
|
/*
|
||||||
|
7 7 7 7 7 m_jd_wx_collectCard.js
|
||||||
|
*/
|
||||||
|
let mode = __dirname.includes('magic')
|
||||||
|
const {Env} = mode ? require('./magic') : require('./magic')
|
||||||
|
const $ = new Env('M集卡抽奖');
|
||||||
|
$.activityUrl = process.env.M_WX_COLLECT_CARD_URL
|
||||||
|
? process.env.M_WX_COLLECT_CARD_URL
|
||||||
|
: '';
|
||||||
|
//最多几个集卡的,其余只助力
|
||||||
|
let leaders = process.env.M_WX_COLLECT_CARD_LEADERS
|
||||||
|
? process.env.M_WX_COLLECT_CARD_LEADERS * 1
|
||||||
|
: 5;
|
||||||
|
if (mode) {
|
||||||
|
$.activityUrl = 'https://lzkjdz-isv.isvjcloud.com/wxCollectCard/activity/1193422?activityId=cb4d9c7ca992427db5a52ec1c0bcc42e'
|
||||||
|
$.activityUrl = 'https://lzkjdz-isv.isvjcloud.com/wxCollectCard/activity/3839759?activityId=2a47604ff73b47b5b432a06dc2226b70'
|
||||||
|
}
|
||||||
|
|
||||||
|
$.activityUrl = $.match(
|
||||||
|
/(https?:\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|])/,
|
||||||
|
$.activityUrl)
|
||||||
|
$.domain = $.match(/https?:\/\/([^/]+)/, $.activityUrl)
|
||||||
|
$.activityId = $.getQueryString($.activityUrl, 'activityId')
|
||||||
|
$.shareUuid = ''
|
||||||
|
let stop = false;
|
||||||
|
let shopInfo = ''
|
||||||
|
const all = new Set();
|
||||||
|
|
||||||
|
$.logic = async function () {
|
||||||
|
if (stop) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!$.activityId || !$.activityUrl) {
|
||||||
|
stop = true;
|
||||||
|
$.putMsg(`activityId|activityUrl不存在`);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$.log(`活动url: ${$.activityUrl} ${await $._algo() || ""}`)
|
||||||
|
$.UA = $.ua();
|
||||||
|
let token = await $.isvObfuscator();
|
||||||
|
if (token.code !== '0') {
|
||||||
|
$.putMsg(`获取Token失败`);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$.Token = token?.token
|
||||||
|
|
||||||
|
let actInfo = await $.api('customer/getSimpleActInfoVo',
|
||||||
|
`activityId=${$.activityId}`);
|
||||||
|
if (!actInfo.result || !actInfo.data) {
|
||||||
|
$.log(`获取活动信息失败`);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$.venderId = actInfo.data.venderId;
|
||||||
|
$.shopId = actInfo.data.shopId;
|
||||||
|
$.activityType = actInfo.data.activityType;
|
||||||
|
|
||||||
|
let myPing = await $.api('customer/getMyPing',
|
||||||
|
`userId=${$.venderId}&token=${$.Token}&fromType=APP`)
|
||||||
|
if (!myPing.result) {
|
||||||
|
$.putMsg(`获取pin失败`);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$.Pin = $.domain.includes('cjhy') ? encodeURIComponent(
|
||||||
|
encodeURIComponent(myPing.data.secretPin)) : encodeURIComponent(
|
||||||
|
myPing.data.secretPin);
|
||||||
|
|
||||||
|
shopInfo = await $.api(`wxCollectCard/shopInfo`,
|
||||||
|
`activityId=${$.activityId}`);
|
||||||
|
if (!shopInfo.result) {
|
||||||
|
$.putMsg('获取不到店铺信息,结束运行')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$.shopName = shopInfo?.data?.shopName
|
||||||
|
|
||||||
|
await $.api(
|
||||||
|
`common/${$.domain.includes('cjhy') ? 'accessLog' : 'accessLogWithAD'}`,
|
||||||
|
`venderId=${$.venderId}&code=${$.activityType}&pin=${
|
||||||
|
$.Pin}&activityId=${$.activityId}&pageUrl=${encodeURIComponent(
|
||||||
|
$.activityUrl)}&subType=app&adSource=`);
|
||||||
|
|
||||||
|
$.index > 1 ? $.log(`去助力${$.shareUuid}`) : ''
|
||||||
|
let activityContent = await $.api(
|
||||||
|
'wxCollectCard/activityContent',
|
||||||
|
`activityId=${$.activityId}&pin=${
|
||||||
|
$.Pin}&uuid=${$.shareUuid}`);
|
||||||
|
if (!activityContent.result && !activityContent.data) {
|
||||||
|
$.putMsg(activityContent.errorMessage || '活动可能已结束')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let drawCount = $.match(/每人每天可获得(\d+)次/, activityContent.data.rule)
|
||||||
|
&& $.match(/每人每天可获得(\d+)次/, activityContent.data.rule) * 1 || 5
|
||||||
|
console.log('openCard', activityContent.data.openCard);
|
||||||
|
$.shareUuid = $.shareUuid || activityContent.data.uuid
|
||||||
|
if ($.index % 5 === 0) {
|
||||||
|
$.log('执行可持续发展之道')
|
||||||
|
await $.wait(1000, 6000)
|
||||||
|
}
|
||||||
|
let drawContent = await $.api('wxCollectCard/drawContent',
|
||||||
|
`activityId=${$.activityId}`);
|
||||||
|
if (drawContent.result && drawContent.data) {
|
||||||
|
$.content = drawContent.data.content || []
|
||||||
|
}
|
||||||
|
let memberInfo = await $.api($.domain.includes('cjhy')
|
||||||
|
? 'mc/new/brandCard/common/shopAndBrand/getOpenCardInfo'
|
||||||
|
: 'wxCommonInfo/getActMemberInfo',
|
||||||
|
$.domain.includes('cjhy')
|
||||||
|
? `venderId=${$.venderId}&buyerPin=${$.Pin}&activityType=${$.activityType}`
|
||||||
|
:
|
||||||
|
`venderId=${$.venderId}&activityId=${$.activityId}&pin=${
|
||||||
|
$.Pin}`);
|
||||||
|
//没开卡 需要开卡
|
||||||
|
if ($.domain.includes('cjhy')) {
|
||||||
|
//没开卡 需要开卡
|
||||||
|
if (memberInfo.result && !memberInfo.data?.openCard
|
||||||
|
&& memberInfo.data?.openCardLink) {
|
||||||
|
$.putMsg('需要开卡,跳过')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (memberInfo.result && !memberInfo.data?.openCard
|
||||||
|
&& memberInfo.data?.actMemberStatus === 1) {
|
||||||
|
$.putMsg('需要开卡,跳过')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.shareUuid = $.shareUuid || activityContent.data.uuid
|
||||||
|
let userInfo = await $.api('wxActionCommon/getUserInfo',
|
||||||
|
`pin=${$.Pin}`);
|
||||||
|
if (!userInfo.result || !userInfo.data) {
|
||||||
|
$.putMsg(`获取getUserInfo失败`);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$.nickname = userInfo.data.nickname;
|
||||||
|
$.attrTouXiang = userInfo.data.yunMidImageUrl
|
||||||
|
|| 'https://img10.360buyimg.com/imgzone/jfs/t1/21383/2/6633/3879/5c5138d8E0967ccf2/91da57c5e2166005.jpg'
|
||||||
|
|
||||||
|
await $.api('crm/pageVisit/insertCrmPageVisit',
|
||||||
|
`venderId=${$.venderId}&elementId=${encodeURIComponent(
|
||||||
|
'邀请')}&pageId=${$.activityId}&pin=${$.Pin}`);
|
||||||
|
|
||||||
|
await $.api('wxCollectCard/drawCard',
|
||||||
|
`sourceId=${$.shareUuid}&activityId=${$.activityId}&type=1&pinImg=${encodeURIComponent(
|
||||||
|
$.attrTouXiang)}&pin=${$.Pin}&jdNick=${encodeURIComponent(
|
||||||
|
$.nickname)}`);
|
||||||
|
if ($.index > leaders) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let saveSource = await $.api('wxCollectCard/saveSource',
|
||||||
|
`activityId=${$.activityId}&pinImg=${encodeURIComponent(
|
||||||
|
$.attrTouXiang)}&pin=${
|
||||||
|
$.Pin}&jdNick=${encodeURIComponent($.nickname)}`);
|
||||||
|
if (!saveSource.result || !saveSource.data) {
|
||||||
|
$.putMsg(`初始化shareuuid失败`);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$.shareUuid = $.shareUuid || saveSource.data
|
||||||
|
|
||||||
|
for (let i = 0; i < drawCount; i++) {
|
||||||
|
let prize = await $.api(`wxCollectCard/drawCard`,
|
||||||
|
`sourceId=${saveSource.data}&activityId=${$.activityId}&type=0`);
|
||||||
|
$.log(JSON.stringify(prize))
|
||||||
|
if (prize.result) {
|
||||||
|
// $.putMsg(prize.data.reward.cardName);
|
||||||
|
} else {
|
||||||
|
if (prize.errorMessage.includes('上限')) {
|
||||||
|
$.putMsg('上限');
|
||||||
|
break;
|
||||||
|
} else if (prize.errorMessage.includes('来晚了')
|
||||||
|
|| prize.errorMessage.includes('已发完')
|
||||||
|
|| prize.errorMessage.includes('活动已结束')) {
|
||||||
|
stop = true;
|
||||||
|
break
|
||||||
|
}
|
||||||
|
$.log(`${prize}`);
|
||||||
|
}
|
||||||
|
await $.api('crm/pageVisit/insertCrmPageVisit',
|
||||||
|
`venderId=${$.venderId}&elementId=${encodeURIComponent(
|
||||||
|
'抽卡')}&pageId=${$.activityId}&pin=${
|
||||||
|
$.Pin}`);
|
||||||
|
await $.wait(1000, 2000)
|
||||||
|
}
|
||||||
|
activityContent = await $.api(
|
||||||
|
'wxCollectCard/activityContent',
|
||||||
|
`activityId=${$.activityId}&pin=${
|
||||||
|
$.Pin}&uuid=${$.shareUuid}`);
|
||||||
|
if (!activityContent.result || !activityContent.data) {
|
||||||
|
$.putMsg(activityContent.errorMessage || '活动可能已结束')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activityContent.data.canDraw) {
|
||||||
|
let prize = await $.api(`wxCollectCard/getPrize`,
|
||||||
|
`activityId=${$.activityId}&pin=${$.Pin}`);
|
||||||
|
$.log(JSON.stringify(prize))
|
||||||
|
if (!prize.result) {
|
||||||
|
let msg = prize.data.drawOk ? prize.data.name
|
||||||
|
: prize.data.errorMessage || '空气';
|
||||||
|
$.log(msg);
|
||||||
|
} else {
|
||||||
|
$.putMsg(`${prize.errorMessage}`);
|
||||||
|
if (prize.errorMessage.includes('来晚了')
|
||||||
|
|| prize.errorMessage.includes('已发完')
|
||||||
|
|| prize.errorMessage.includes('活动已结束')) {
|
||||||
|
stop = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
activityContent = await $.api(
|
||||||
|
'wxCollectCard/activityContent',
|
||||||
|
`activityId=${$.activityId}&pin=${
|
||||||
|
$.Pin}&uuid=${$.shareUuid}`);
|
||||||
|
if (!activityContent.result || !activityContent.data) {
|
||||||
|
$.putMsg(activityContent.errorMessage || '活动可能已结束')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const has = new Set();
|
||||||
|
for (const ele of activityContent.data.cardList) {
|
||||||
|
all.add(ele.cardName)
|
||||||
|
ele.count > 0 ? has.add(ele.cardName) : ''
|
||||||
|
}
|
||||||
|
$.putMsg(Array.from(has).join(','))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.after = async function () {
|
||||||
|
if ($.msg.length > 0) {
|
||||||
|
let message = `\n${$.shopName || ''}\n`;
|
||||||
|
message += `\n${Array.from(all).join(",")}\n`;
|
||||||
|
for (let ele of $.content || []) {
|
||||||
|
if (ele.name.includes('谢谢') || ele.name.includes('再来')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
message += ` ${ele.name}${ele?.type === 8 ? '专享价' : ''}\n`
|
||||||
|
}
|
||||||
|
$.msg.push(message)
|
||||||
|
$.msg.push($.activityUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.run({whitelist: ['1-5'], wait: [1000, 3000]}).catch(
|
||||||
|
reason => $.log(reason));
|
231
jd_wx_luckDraw.js
Normal file
231
jd_wx_luckDraw.js
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
//问题反馈:https://t.me/Wall_E_Channel
|
||||||
|
/*
|
||||||
|
7 7 7 7 7 m_jd_wx_luckDraw.js
|
||||||
|
*/
|
||||||
|
let mode = __dirname.includes('magic')
|
||||||
|
const {Env} = mode ? require('./magic') : require('./magic')
|
||||||
|
const $ = new Env('M幸运抽奖');
|
||||||
|
$.activityUrl = process.env.M_WX_LUCK_DRAW_URL
|
||||||
|
? process.env.M_WX_LUCK_DRAW_URL
|
||||||
|
: '';
|
||||||
|
$.notLuckDrawList = process.env.M_WX_NOT_LUCK_DRAW_LIST
|
||||||
|
? process.env.M_WX_NOT_LUCK_DRAW_LIST.split('@')
|
||||||
|
: 'test'.split('@');
|
||||||
|
if (mode) {
|
||||||
|
$.activityUrl = 'https://lzkj-isv.isvjcloud.com/lzclient/1648724528320/cjwx/common/entry.html?activityId=9cf424654f2d4821a229f73043987968&gameType=wxTurnTable&shopid=11743182'
|
||||||
|
}
|
||||||
|
$.activityUrl = $.match(
|
||||||
|
/(https?:\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|])/,
|
||||||
|
$.activityUrl)
|
||||||
|
$.domain = $.match(/https?:\/\/([^/]+)/, $.activityUrl)
|
||||||
|
$.activityId = $.getQueryString($.activityUrl, 'activityId')
|
||||||
|
let shopInfo = ''
|
||||||
|
$.logic = async function () {
|
||||||
|
if (!$.activityId || !$.activityUrl) {
|
||||||
|
$.expire = true;
|
||||||
|
$.putMsg(`activityId|activityUrl不存在`, $.activityUrl, $.activityId);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$.log(`活动id: ${$.activityId}`, `活动url: ${$.activityUrl}`)
|
||||||
|
$.UA = $.ua();
|
||||||
|
|
||||||
|
let token = await $.isvObfuscator();
|
||||||
|
if (token.code !== '0') {
|
||||||
|
$.putMsg(`获取Token失败`);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$.Token = token?.token
|
||||||
|
if ($.domain.includes("gzsl")) {
|
||||||
|
let activityContent = await $.api(
|
||||||
|
`wuxian/user/getLottery/${$.activityId}`,
|
||||||
|
{'id': $.activityId, 'token': $.Token, 'source': "01"});
|
||||||
|
$.log(activityContent)
|
||||||
|
if (activityContent.status !== '1') {
|
||||||
|
$.putMsg(`获取活动信息失败`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.shopName = activityContent.activity.shopName
|
||||||
|
$.activityType = activityContent.activity.activityType
|
||||||
|
$.shopId = activityContent.activity.shopId;
|
||||||
|
$.content = activityContent.activity.prizes
|
||||||
|
if (activityContent.leftTime === 0) {
|
||||||
|
$.putMsg("抽奖次数为0")
|
||||||
|
}
|
||||||
|
while (activityContent.leftTime-- > 0) {
|
||||||
|
await $.wait(3000, 5000)
|
||||||
|
let data = await $.api(
|
||||||
|
`wuxian/user/draw/${$.activityId}`,
|
||||||
|
{'id': $.activityId, 'token': $.Token, 'source': "01"});
|
||||||
|
if (data.status !== "1") {
|
||||||
|
if (data.status === "-14") {
|
||||||
|
$.putMsg("开卡入会后参与活动")
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (data.status === "-2") {
|
||||||
|
$.putMsg("已结束")
|
||||||
|
$.expire = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$.putMsg(data.msg)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (data?.winId) {
|
||||||
|
if (data.data.source === "0") {
|
||||||
|
activityContent.leftTime++
|
||||||
|
}
|
||||||
|
$.putMsg(data.data.name)
|
||||||
|
} else {
|
||||||
|
$.putMsg("空气")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let actInfo = await $.api('customer/getSimpleActInfoVo',
|
||||||
|
`activityId=${$.activityId}`);
|
||||||
|
if (!actInfo.result || !actInfo.data) {
|
||||||
|
$.log(`获取活动信息失败`);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$.venderId = actInfo.data.venderId;
|
||||||
|
$.shopId = actInfo.data.shopId;
|
||||||
|
$.activityType = actInfo.data.activityType;
|
||||||
|
|
||||||
|
let myPing = await $.api('customer/getMyPing',
|
||||||
|
`userId=${$.venderId}&token=${$.Token}&fromType=APP`)
|
||||||
|
if (!myPing.result) {
|
||||||
|
$.putMsg(`获取pin失败`);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$.Pin = $.domain.includes('cjhy') ? encodeURIComponent(
|
||||||
|
encodeURIComponent(myPing.data.secretPin)) : encodeURIComponent(
|
||||||
|
myPing.data.secretPin);
|
||||||
|
|
||||||
|
shopInfo = await $.api('wxDrawActivity/shopInfo',
|
||||||
|
`activityId=${$.activityId}`);
|
||||||
|
if (!shopInfo.result) {
|
||||||
|
$.putMsg('获取不到店铺信息,结束运行')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$.shopName = shopInfo?.data?.shopName
|
||||||
|
|
||||||
|
for (let ele of $.notLuckDrawList) {
|
||||||
|
if ($.shopName.includes(ele)) {
|
||||||
|
$.expire = true
|
||||||
|
$.putMsg('已屏蔽')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await $.api(
|
||||||
|
`common/${$.domain.includes('cjhy') ? 'accessLog'
|
||||||
|
: 'accessLogWithAD'}`,
|
||||||
|
`venderId=${$.venderId}&code=${$.activityType}&pin=${$.Pin}&activityId=${$.activityId}&pageUrl=${encodeURIComponent(
|
||||||
|
$.activityUrl)}&subType=app&adSource=`);
|
||||||
|
let activityContent = await $.api(
|
||||||
|
`${$.activityType === 26 ? 'wxPointDrawActivity'
|
||||||
|
: 'wxDrawActivity'}/activityContent`,
|
||||||
|
`activityId=${$.activityId}&pin=${$.Pin}`);
|
||||||
|
if (!activityContent.result || !activityContent.data) {
|
||||||
|
$.putMsg(activityContent.errorMessage || '活动可能已结束')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
debugger
|
||||||
|
$.hasFollow = activityContent.data.hasFollow || ''
|
||||||
|
$.needFollow = activityContent.data.needFollow || false
|
||||||
|
$.canDrawTimes = activityContent.data.canDrawTimes || 1
|
||||||
|
$.content = activityContent.data.content || []
|
||||||
|
$.drawConsume = activityContent.data.drawConsume || 0
|
||||||
|
$.canDrawTimes === 0 ? $.canDrawTimes = 1 : ''
|
||||||
|
debugger
|
||||||
|
let memberInfo = await $.api($.domain.includes('cjhy')
|
||||||
|
? 'mc/new/brandCard/common/shopAndBrand/getOpenCardInfo'
|
||||||
|
: 'wxCommonInfo/getActMemberInfo',
|
||||||
|
$.domain.includes('cjhy')
|
||||||
|
? `venderId=${$.venderId}&buyerPin=${$.Pin}&activityType=${$.activityType}`
|
||||||
|
:
|
||||||
|
`venderId=${$.venderId}&activityId=${$.activityId}&pin=${$.Pin}`);
|
||||||
|
//没开卡 需要开卡
|
||||||
|
if ($.domain.includes('cjhy')) {
|
||||||
|
//没开卡 需要开卡
|
||||||
|
if (memberInfo.result && !memberInfo.data?.openCard
|
||||||
|
&& memberInfo.data?.openCardLink) {
|
||||||
|
$.putMsg('需要开卡,跳过')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (memberInfo.result && !memberInfo.data?.openCard
|
||||||
|
&& memberInfo.data?.actMemberStatus === 1) {
|
||||||
|
$.putMsg('需要开卡,跳过')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($.needFollow && !$.hasFollow) {
|
||||||
|
let followShop = await $.api($.domain.includes('cjhy')
|
||||||
|
? 'wxActionCommon/newFollowShop'
|
||||||
|
: 'wxActionCommon/followShop',
|
||||||
|
$.domain.includes('cjhy')
|
||||||
|
? `venderId=${$.venderId}&activityId=${$.activityId}&buyerPin=${$.Pin}&activityType=${$.activityType}`
|
||||||
|
: `userId=${$.venderId}&activityId=${$.activityId}&buyerNick=${$.Pin}&activityType=${$.activityType}`);
|
||||||
|
if (!followShop.result) {
|
||||||
|
$.putMsg(followShop.errorMessage)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await $.wait(1000);
|
||||||
|
}
|
||||||
|
for (let m = 1; $.canDrawTimes--; m++) {
|
||||||
|
let prize = await $.api(
|
||||||
|
`${$.activityType === 26 ? 'wxPointDrawActivity'
|
||||||
|
: 'wxDrawActivity'}/start`,
|
||||||
|
$.domain.includes('cjhy')
|
||||||
|
? `activityId=${$.activityId}&pin=${$.Pin}`
|
||||||
|
: `activityId=${$.activityId}&pin=${$.Pin}`);
|
||||||
|
if (prize.result) {
|
||||||
|
$.canDrawTimes = prize.data.canDrawTimes
|
||||||
|
let msg = prize.data.drawOk ? prize.data.name
|
||||||
|
: prize.data.errorMessage || '空气';
|
||||||
|
$.putMsg(msg)
|
||||||
|
} else {
|
||||||
|
if (prize.errorMessage) {
|
||||||
|
$.putMsg(`${prize.errorMessage}`);
|
||||||
|
if (prize.errorMessage.includes('来晚了')
|
||||||
|
|| prize.errorMessage.includes('已发完')
|
||||||
|
|| prize.errorMessage.includes('活动已结束')) {
|
||||||
|
$.expire = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
await $.wait(parseInt(Math.random() * 500 + 1500, 10));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await $.unfollow($.shopId)
|
||||||
|
}
|
||||||
|
let kv = {
|
||||||
|
3: '幸运九宫格',
|
||||||
|
4: '转盘抽奖',
|
||||||
|
11: '扭蛋抽奖',
|
||||||
|
12: '九宫格抽奖',
|
||||||
|
13: '转盘抽奖',
|
||||||
|
26: '积分抽奖'
|
||||||
|
}
|
||||||
|
let kv2 = {'0': '再来一次', '1': '京豆', '2': '券', '3': '实物', '4': '积分'}
|
||||||
|
|
||||||
|
$.after = async function () {
|
||||||
|
let message = `\n${$.shopName || ''} ${kv[$.activityType]
|
||||||
|
|| $.activityType}\n`;
|
||||||
|
for (let ele of $.content || []) {
|
||||||
|
if (ele.name.includes('谢谢') || ele.name.includes('再来')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($.domain.includes('lzkj') || $.domain.includes('cjhy')) {
|
||||||
|
message += `\n ${ele.name} ${ele?.type === 8 ? '专享价' : ''}`
|
||||||
|
} else {
|
||||||
|
message += ` ${ele.name} ${kv2[ele?.source]
|
||||||
|
|| ele?.source}\n`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.msg.push(message)
|
||||||
|
$.msg.push($.activityUrl);
|
||||||
|
}
|
||||||
|
$.run({whitelist: ['1-5'], wait: [3000, 5000]}).catch(
|
||||||
|
reason => $.log(reason));
|
||||||
|
|
326
jx_factory_automation.js
Normal file
326
jx_factory_automation.js
Normal file
@ -0,0 +1,326 @@
|
|||||||
|
//20 * * * * m_jx_factory_automation.js
|
||||||
|
//问题反馈:https://t.me/Wall_E_Channel
|
||||||
|
const {Env} = require('./magic');
|
||||||
|
const $ = new Env('M工厂自动化');
|
||||||
|
let commodityName = process.env.M_JX_FACTORY_COMMODITY
|
||||||
|
? process.env.M_JX_FACTORY_COMMODITY
|
||||||
|
: '你还没设置要生产的变量M_JX_FACTORY_COMMODITY'
|
||||||
|
let stop = false;
|
||||||
|
$.logic = async function () {
|
||||||
|
if (stop) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let info = await GetUserInfo();
|
||||||
|
$.log(JSON.stringify(info));
|
||||||
|
|
||||||
|
if (!info) {
|
||||||
|
$.putMsg('没有找到工厂信息');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await GetUserComponent(info.user.encryptPin);
|
||||||
|
$.log(info.factoryList[0].name, '等级', info.user.currentLevel);
|
||||||
|
if (info?.productionList) {
|
||||||
|
let product = info?.productionList[0];
|
||||||
|
if (product.investedElectric !== product.needElectric) {
|
||||||
|
$.log('还没有生产完成');
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let productionId = product.productionId;
|
||||||
|
await $.wait(300, 500)
|
||||||
|
let {active} = await ExchangeCommodity(productionId);
|
||||||
|
await $.wait(300, 500)
|
||||||
|
await QueryHireReward();
|
||||||
|
await $.wait(300, 500)
|
||||||
|
await queryprizedetails(active)
|
||||||
|
await $.wait(300, 500)
|
||||||
|
}
|
||||||
|
let factoryId = info?.deviceList[0].factoryId;
|
||||||
|
$.log('获取工厂id', factoryId);
|
||||||
|
let deviceId = info?.deviceList[0].deviceId;
|
||||||
|
$.log('获取设备id', deviceId);
|
||||||
|
let {commodityList} = await GetCommodityList();
|
||||||
|
let filter = commodityList.filter(o => o.name.includes(commodityName));
|
||||||
|
if (filter.length === 1) {
|
||||||
|
let commodity = filter[0];
|
||||||
|
if (commodity?.flashStartTime && commodity?.flashStartTime
|
||||||
|
> $.timestamp()) {
|
||||||
|
$.log(`还没到时间`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let data = await GetCommodityDetails(commodity.commodityId);
|
||||||
|
await $.wait(300, 500)
|
||||||
|
let newVar = await AddProduction(factoryId, deviceId, data.commodityId);
|
||||||
|
if (newVar?.productionId) {
|
||||||
|
$.putMsg(`${data.name}已经开始生产`)
|
||||||
|
info = await GetUserInfo();
|
||||||
|
let product = info?.productionList[0];
|
||||||
|
let productionId = product.productionId;
|
||||||
|
await InvestElectric(productionId);//添加电力
|
||||||
|
await InvestElectric(productionId);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$.putMsg(`没找到你要生产的 ${commodityName}`)
|
||||||
|
stop = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$.run({
|
||||||
|
wait: [2000, 3000]
|
||||||
|
}).catch(
|
||||||
|
reason => $.log(reason));
|
||||||
|
|
||||||
|
async function InvestElectric(productionId) {
|
||||||
|
let url = `https://m.jingxi.com/dreamfactory/userinfo/InvestElectric?zone=dream_factory&productionId=${productionId}&_time=1637743936757&_ts=1637743936757&_=1637743936758&sceneval=2&g_login_type=1&callback=jsonpCBKR&g_ty=ls`;
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
let headers = {
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Referer': 'https://st.jingxi.com/pingou/dream_factory/index.html',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Host': 'm.jingxi.com',
|
||||||
|
'Accept-Language': 'zh-cn'
|
||||||
|
}
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
headers['Cookie'] = $.cookie
|
||||||
|
headers['User-Agent'] = `jdpingou;iPhone;5.2.2;14.3;${$.randomString(
|
||||||
|
40)};network/wifi;model/iPhone12,1;appBuild/100630;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/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`
|
||||||
|
let data = await $.get(url, headers)
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
if (data?.ret === 0) {
|
||||||
|
return data?.data
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function AddProduction(factoryId, deviceId, commodityDimId) {
|
||||||
|
let url = `https://m.jingxi.com/dreamfactory/userinfo/AddProduction?zone=dream_factory&factoryId=${factoryId}&deviceId=${deviceId}&commodityDimId=${commodityDimId}&replaceProductionId=&_time=1637282973549&_ts=1637282973549&_=1637282973550&sceneval=2&g_login_type=1&callback=jsonpCBKGGG&g_ty=ls`;
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
let headers = {
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Referer': 'https://st.jingxi.com/pingou/dream_factory/index.html',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Host': 'm.jingxi.com',
|
||||||
|
'Accept-Language': 'zh-cn',
|
||||||
|
'Cookie': $.cookie
|
||||||
|
}
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
headers['User-Agent'] = `jdpingou;iPhone;5.2.2;14.3;${$.randomString(
|
||||||
|
40)};network/wifi;model/iPhone12,1;appBuild/100630;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/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`
|
||||||
|
let data = await $.get(url, headers)
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
if (data?.ret === 0) {
|
||||||
|
return data?.data
|
||||||
|
} else {
|
||||||
|
$.putMsg(data?.msg)
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function GetDeviceDetails() {
|
||||||
|
let url = `https://m.jingxi.com/dreamfactory/diminfo/GetDeviceDetails?zone=dream_factory&deviceId=1&_time=1637282971386&_ts=1637282971386&_=1637282971386&sceneval=2&g_login_type=1&callback=jsonpCBKFFF&g_ty=ls`;
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
let headers = {
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Referer': 'https://st.jingxi.com/pingou/dream_factory/index.html',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Host': 'm.jingxi.com',
|
||||||
|
'Accept-Language': 'zh-cn',
|
||||||
|
'Cookie': $.cookie
|
||||||
|
}
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
headers['User-Agent'] = `jdpingou;iPhone;5.2.2;14.3;${$.randomString(
|
||||||
|
40)};network/wifi;model/iPhone12,1;appBuild/100630;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/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`
|
||||||
|
let data = await $.get(url, headers)
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
if (data?.ret === 0) {
|
||||||
|
return data?.data
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function GetUserComponent(pin) {
|
||||||
|
let url = `https://m.jingxi.com/dreamfactory/usermaterial/GetUserComponent?zone=dream_factory&pin=${pin}&_time=1637282950558&_ts=1637282950559&sceneval=2&g_login_type=1&_=1637282951435&sceneval=2&g_login_type=1&callback=jsonpCBKSS&g_ty=ls`;
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
let headers = {
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Referer': 'https://st.jingxi.com/pingou/dream_factory/index.html',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Host': 'm.jingxi.com',
|
||||||
|
'Accept-Language': 'zh-cn',
|
||||||
|
'Cookie': $.cookie
|
||||||
|
}
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
headers['User-Agent'] = `jdpingou;iPhone;5.2.2;14.3;${$.randomString(
|
||||||
|
40)};network/wifi;model/iPhone12,1;appBuild/100630;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/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`
|
||||||
|
let data = await $.get(url, headers)
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
if (data?.ret === 0) {
|
||||||
|
return data?.data
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
async function GetUserInfo() {
|
||||||
|
let url = `https://m.jingxi.com/dreamfactory/userinfo/GetUserInfo?zone=dream_factory&pin=&sharePin=&shareType=&materialTuanPin=&materialTuanId=&needPickSiteInfo=1&source=&_time=1637282934811&_ts=1637282934811&timeStamp=&h5st=20211119084854812%3B5505286748222516%3Bc0ff1%3Btk02w96e01bc918n2aG34crijQCFgW%2BYZgoTBRpLWz6TM%2FWXRBmShiIQLtGvxCMJkN0g1uyofC04iuOhphAyAm66c3U5%3B2b53e58445b6ec6a5487e95f6aeae526c6c93b4724a0e54e03f3a8105f1caea6%3B3.0%3B1637282934812&_stk=_time%2C_ts%2CmaterialTuanId%2CmaterialTuanPin%2CneedPickSiteInfo%2Cpin%2CsharePin%2CshareType%2Csource%2CtimeStamp%2Czone&_ste=1&_=1637282934818&sceneval=2&g_login_type=1&callback=jsonpCBKY&g_ty=ls`;
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
let headers = {
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Referer': 'https://st.jingxi.com/pingou/dream_factory/index.html',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Host': 'm.jingxi.com',
|
||||||
|
'Accept-Language': 'zh-cn',
|
||||||
|
'Cookie': $.cookie
|
||||||
|
}
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
headers['User-Agent'] = `jdpingou;iPhone;5.2.2;14.3;${$.randomString(
|
||||||
|
40)};network/wifi;model/iPhone12,1;appBuild/100630;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/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`
|
||||||
|
let data = await $.get(url, headers)
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
if (data?.ret === 0) {
|
||||||
|
return data?.data
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
async function ExchangeCommodity(productionId) {
|
||||||
|
let url = `https://m.jingxi.com/dreamfactory/userinfo/ExchangeCommodity?zone=dream_factory&productionId=${productionId}&exchangeType=1&_time=1637282949946&_ts=1637282949946&_=1637282949947&sceneval=2&g_login_type=1&callback=jsonpCBKJJ&g_ty=ls`;
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
let headers = {
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Referer': 'https://st.jingxi.com/pingou/dream_factory/index.html',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Host': 'm.jingxi.com',
|
||||||
|
'Accept-Language': 'zh-cn',
|
||||||
|
'Cookie': $.cookie
|
||||||
|
}
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
headers['User-Agent'] = `jdpingou;iPhone;5.2.2;14.3;${$.randomString(
|
||||||
|
40)};network/wifi;model/iPhone12,1;appBuild/100630;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/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`
|
||||||
|
let data = await $.get(url, headers)
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
if (data?.ret === 0) {
|
||||||
|
return data?.data
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
async function GetCommodityList() {
|
||||||
|
let url = `https://m.jingxi.com/dreamfactory/diminfo/GetCommodityList?zone=dream_factory&flag=2&pageNo=1&pageSize=12&_time=1636619666773&_ts=1636619666773&_=1636619666773&sceneval=2&g_login_type=1&callback=jsonpCBKKK&g_ty=ls`;
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
let headers = {
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Referer': 'https://st.jingxi.com/pingou/dream_factory/index.html',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Host': 'm.jingxi.com',
|
||||||
|
'Accept-Language': 'zh-cn',
|
||||||
|
'Cookie': $.cookie
|
||||||
|
}
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
headers['User-Agent'] = `jdpingou;iPhone;5.2.2;14.3;${$.randomString(
|
||||||
|
40)};network/wifi;model/iPhone12,1;appBuild/100630;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/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`
|
||||||
|
let data = await $.get(url, headers)
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
if (data?.ret === 0) {
|
||||||
|
return data?.data
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
async function GetCommodityDetails(commodityId) {
|
||||||
|
let url = `https://m.jingxi.com/dreamfactory/diminfo/GetCommodityDetails?zone=dream_factory&commodityId=${commodityId}&_time=1636437544857&_ts=1636437544857&_=1636437544857&sceneval=2&g_login_type=1&callback=jsonpCBKWWW&g_ty=ls`;
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
let headers = {
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Referer': 'https://st.jingxi.com/pingou/dream_factory/index.html',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Host': 'm.jingxi.com',
|
||||||
|
'Accept-Language': 'zh-cn',
|
||||||
|
'Cookie': $.cookie
|
||||||
|
}
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
headers['User-Agent'] = `jdpingou;iPhone;5.2.2;14.3;${$.randomString(
|
||||||
|
40)};network/wifi;model/iPhone12,1;appBuild/100630;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/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`
|
||||||
|
let data = await $.get(url, headers)
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
return data?.data?.commodityList?.[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
async function queryprizedetails(actives) {
|
||||||
|
let url = `https://m.jingxi.com/active/queryprizedetails?actives=${actives}&_time=1637282950925&_ts=1637282950925&_=1637282950925&sceneval=2&g_login_type=1&callback=jsonpCBKQQ&g_ty=ls`;
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
let headers = {
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Referer': 'https://st.jingxi.com/pingou/dream_factory/index.html',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Host': 'm.jingxi.com',
|
||||||
|
'Accept-Language': 'zh-cn',
|
||||||
|
'Cookie': $.cookie
|
||||||
|
}
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
headers['User-Agent'] = `jdpingou;iPhone;5.2.2;14.3;${$.randomString(
|
||||||
|
40)};network/wifi;model/iPhone12,1;appBuild/100630;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/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`
|
||||||
|
let data = await $.get(url, headers)
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
if (data?.ret === 0) {
|
||||||
|
return data?.data
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function QueryHireReward() {
|
||||||
|
let url = `https://m.jingxi.com/dreamfactory/friend/QueryHireReward?zone=dream_factory&_time=1637282950550&_ts=1637282950550&_=1637282950550&sceneval=2&g_login_type=1&callback=jsonpCBKLL&g_ty=ls`;
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
let headers = {
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Referer': 'https://st.jingxi.com/pingou/dream_factory/index.html',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Host': 'm.jingxi.com',
|
||||||
|
'Accept-Language': 'zh-cn',
|
||||||
|
'Cookie': $.cookie
|
||||||
|
}
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
headers['User-Agent'] = `jdpingou;iPhone;5.2.2;14.3;${$.randomString(
|
||||||
|
40)};network/wifi;model/iPhone12,1;appBuild/100630;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/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`
|
||||||
|
let data = await $.get(url, headers)
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
if (data?.ret === 0) {
|
||||||
|
return data?.data
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function GetShelvesList() {
|
||||||
|
let url = `https://m.jingxi.com/dreamfactory/userinfo/GetShelvesList?zone=dream_factory&pageNo=1&pageSize=12&_time=1637282954475&_ts=1637282954475&_=1637282954475&sceneval=2&g_login_type=1&callback=jsonpCBKVV&g_ty=ls`;
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
let headers = {
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Referer': 'https://st.jingxi.com/pingou/dream_factory/index.html',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Host': 'm.jingxi.com',
|
||||||
|
'Accept-Language': 'zh-cn',
|
||||||
|
'Cookie': $.cookie
|
||||||
|
}
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
headers['User-Agent'] = `jdpingou;iPhone;5.2.2;14.3;${$.randomString(
|
||||||
|
40)};network/wifi;model/iPhone12,1;appBuild/100630;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/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`
|
||||||
|
let data = await $.get(url, headers)
|
||||||
|
// noinspection DuplicatedCode
|
||||||
|
if (data?.ret === 0) {
|
||||||
|
return data?.data
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
97
jx_factory_commodity.js
Normal file
97
jx_factory_commodity.js
Normal file
File diff suppressed because one or more lines are too long
@ -14,7 +14,7 @@ const querystring = require('querystring');
|
|||||||
const exec = require('child_process').exec;
|
const exec = require('child_process').exec;
|
||||||
const $ = new Env();
|
const $ = new Env();
|
||||||
const timeout = 15000; //超时时间(单位毫秒)
|
const timeout = 15000; //超时时间(单位毫秒)
|
||||||
console.log("加载sendNotify,当前版本: 20220504");
|
console.log("加载sendNotify,当前版本: 20220517");
|
||||||
// =======================================go-cqhttp通知设置区域===========================================
|
// =======================================go-cqhttp通知设置区域===========================================
|
||||||
//gobot_url 填写请求地址http://127.0.0.1/send_private_msg
|
//gobot_url 填写请求地址http://127.0.0.1/send_private_msg
|
||||||
//gobot_token 填写在go-cqhttp文件设置的访问密钥
|
//gobot_token 填写在go-cqhttp文件设置的访问密钥
|
||||||
@ -246,6 +246,7 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By cc
|
|||||||
var Use_WxPusher = true;
|
var Use_WxPusher = true;
|
||||||
var strtext = text;
|
var strtext = text;
|
||||||
var strdesp = desp;
|
var strdesp = desp;
|
||||||
|
var titleIndex =-1;
|
||||||
if (process.env.NOTIFY_NOCKFALSE) {
|
if (process.env.NOTIFY_NOCKFALSE) {
|
||||||
Notify_NoCKFalse = process.env.NOTIFY_NOCKFALSE;
|
Notify_NoCKFalse = process.env.NOTIFY_NOCKFALSE;
|
||||||
}
|
}
|
||||||
@ -403,6 +404,7 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By cc
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strtext.indexOf("cookie已失效") != -1 || strdesp.indexOf("重新登录获取") != -1 || strtext == "Ninja 运行通知") {
|
if (strtext.indexOf("cookie已失效") != -1 || strdesp.indexOf("重新登录获取") != -1 || strtext == "Ninja 运行通知") {
|
||||||
if (Notify_NoCKFalse == "true" && text != "Ninja 运行通知") {
|
if (Notify_NoCKFalse == "true" && text != "Ninja 运行通知") {
|
||||||
console.log(`检测到NOTIFY_NOCKFALSE变量为true,不发送ck失效通知...`);
|
console.log(`检测到NOTIFY_NOCKFALSE变量为true,不发送ck失效通知...`);
|
||||||
@ -430,6 +432,7 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By cc
|
|||||||
if (text.indexOf("任务") != -1 && (text.indexOf("新增") != -1 || text.indexOf("删除") != -1)) {
|
if (text.indexOf("任务") != -1 && (text.indexOf("新增") != -1 || text.indexOf("删除") != -1)) {
|
||||||
strTitle = "脚本任务更新";
|
strTitle = "脚本任务更新";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strTitle) {
|
if (strTitle) {
|
||||||
const notifyRemindList = process.env.NOTIFY_NOREMIND ? process.env.NOTIFY_NOREMIND.split('&') : [];
|
const notifyRemindList = process.env.NOTIFY_NOREMIND ? process.env.NOTIFY_NOREMIND.split('&') : [];
|
||||||
titleIndex = notifyRemindList.findIndex((item) => item === strTitle);
|
titleIndex = notifyRemindList.findIndex((item) => item === strTitle);
|
||||||
@ -442,7 +445,6 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By cc
|
|||||||
} else {
|
} else {
|
||||||
strTitle = text;
|
strTitle = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Notify_NoLoginSuccess == "true") {
|
if (Notify_NoLoginSuccess == "true") {
|
||||||
if (desp.indexOf("登陆成功") != -1) {
|
if (desp.indexOf("登陆成功") != -1) {
|
||||||
console.log(`登陆成功不推送`);
|
console.log(`登陆成功不推送`);
|
||||||
@ -463,7 +465,7 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By cc
|
|||||||
|
|
||||||
//检查黑名单屏蔽通知
|
//检查黑名单屏蔽通知
|
||||||
const notifySkipList = process.env.NOTIFY_SKIP_LIST ? process.env.NOTIFY_SKIP_LIST.split('&') : [];
|
const notifySkipList = process.env.NOTIFY_SKIP_LIST ? process.env.NOTIFY_SKIP_LIST.split('&') : [];
|
||||||
let titleIndex = notifySkipList.findIndex((item) => item === strTitle);
|
titleIndex = notifySkipList.findIndex((item) => item === strTitle);
|
||||||
|
|
||||||
if (titleIndex !== -1) {
|
if (titleIndex !== -1) {
|
||||||
console.log(`${strTitle} 在推送黑名单中,已跳过推送`);
|
console.log(`${strTitle} 在推送黑名单中,已跳过推送`);
|
||||||
@ -1457,7 +1459,10 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By cc
|
|||||||
if(envs[i].created)
|
if(envs[i].created)
|
||||||
Tempinfo=getQLinfo(cookie, envs[i].created, envs[i].timestamp, envs[i].remarks);
|
Tempinfo=getQLinfo(cookie, envs[i].created, envs[i].timestamp, envs[i].remarks);
|
||||||
else
|
else
|
||||||
Tempinfo=getQLinfo(cookie, envs[i].createdAt, envs[i].timestamp, envs[i].remarks);
|
if(envs[i].updatedAt)
|
||||||
|
Tempinfo=getQLinfo(cookie, envs[i].createdAt, envs[i].updatedAt, envs[i].remarks);
|
||||||
|
else
|
||||||
|
Tempinfo=getQLinfo(cookie, envs[i].createdAt, envs[i].timestamp, envs[i].remarks);
|
||||||
if (Tempinfo) {
|
if (Tempinfo) {
|
||||||
$.Remark += Tempinfo;
|
$.Remark += Tempinfo;
|
||||||
}
|
}
|
||||||
@ -1715,7 +1720,10 @@ async function sendNotifybyWxPucher(text, desp, PtPin, author = '\n\n本通知 B
|
|||||||
if(tempEnv.created)
|
if(tempEnv.created)
|
||||||
Tempinfo=getQLinfo(cookie, tempEnv.created, tempEnv.timestamp, tempEnv.remarks);
|
Tempinfo=getQLinfo(cookie, tempEnv.created, tempEnv.timestamp, tempEnv.remarks);
|
||||||
else
|
else
|
||||||
Tempinfo=getQLinfo(cookie, tempEnv.createdAt, tempEnv.timestamp, tempEnv.remarks);
|
if(tempEnv.updatedAt)
|
||||||
|
Tempinfo=getQLinfo(cookie, tempEnv.createdAt, tempEnv.updatedAt, tempEnv.remarks);
|
||||||
|
else
|
||||||
|
Tempinfo=getQLinfo(cookie, tempEnv.createdAt, tempEnv.timestamp, tempEnv.remarks);
|
||||||
|
|
||||||
if (Tempinfo) {
|
if (Tempinfo) {
|
||||||
Tempinfo = $.nickName + Tempinfo;
|
Tempinfo = $.nickName + Tempinfo;
|
||||||
|
Loading…
Reference in New Issue
Block a user