mirror of
https://github.com/shufflewzc/faker2.git
synced 2025-04-28 22:08:45 +08:00
1
This commit is contained in:
parent
1fbd8b75bd
commit
000c736b03
182
jd_wx_addCart.js
182
jd_wx_addCart.js
@ -1,182 +0,0 @@
|
||||
//问题反馈: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));
|
@ -1,212 +0,0 @@
|
||||
/*
|
||||
7 7 7 7 7 jd_wx_centerDraw.js
|
||||
*/
|
||||
let mode = __dirname.includes('magic')
|
||||
const {Env} = mode ? require('./magic') : require('./magic')
|
||||
const $ = new Env('M老虎机抽奖');
|
||||
$.lz = 'LZ_TOKEN_KEY=lztokef1eb8494b0af868bd18bdaf8;LZ_TOKEN_VALUE=Aa5RE8RuY4X3zA==;';
|
||||
$.activityUrl = process.env.M_WX_CENTER_DRAW_URL
|
||||
? process.env.M_WX_CENTER_DRAW_URL
|
||||
: '';
|
||||
if (mode) {
|
||||
$.activityUrl = 'https://lzkj-isv.isvjcloud.com/lzclient/8e5f3ebaf6e545959aa6311d14be5dfa/cjwx/common/entry.html?activityId=8e5f3ebaf6e545959aa6311d14be5dfa&gameType=wxTurnTable'
|
||||
// $.activityUrl = 'https://lzkj-isv.isvjcloud.com/wxDrawActivity/activity?activityId=37c4c35255a84522bc944974edeef960'
|
||||
// $.activityUrl = 'https://lzkj-isv.isvjcloud.com/wxDrawActivity/activity?activityId=1155ac7d4ec74a8ba31238d846866599'
|
||||
$.activityUrl = 'https://lzkj-isv.isvjcloud.com/wxDrawActivity/activity?activityId=a5b7b7b8196e4dc192c4ffd3221a7866'
|
||||
$.activityUrl = 'https://lzkj-isv.isvjcloud.com/drawCenter/activity/75f5617c3c844163b8ccb1b410eb23e8?activityId=75f5617c3c844163b8ccb1b410eb23e8'
|
||||
$.activityUrl = 'https://lzkj-isv.isvjcloud.com/drawCenter/activity?activityId=7113c86ee0b94fbbb803a76c8bda6065'
|
||||
}
|
||||
$.activityUrl = $.match(
|
||||
/(https?:\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|])/,
|
||||
$.activityUrl)
|
||||
$.domain = $.match(/https?:\/\/([^/]+)/, $.activityUrl)
|
||||
$.activityId = $.getQueryString($.activityUrl, 'activityId')
|
||||
let shopInfo = ''
|
||||
$.uid = ''//全都助力1号
|
||||
$.logic = async function () {
|
||||
if (!$.activityId || !$.activityUrl) {
|
||||
$.expire = true;
|
||||
$.putMsg(`activityId|activityUrl不存在`);
|
||||
return
|
||||
}
|
||||
$.log(`活动id: ${$.activityId}`, `活动url: ${$.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 || !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);
|
||||
|
||||
await $.api(
|
||||
`common/${$.domain.includes('cjhy') ? 'accessLog' : 'accessLogWithAD'}`,
|
||||
`venderId=${$.venderId}&code=${$.activityType}&pin=${
|
||||
$.Pin}&activityId=${$.activityId}&pageUrl=${encodeURIComponent($.activityUrl)}&subType=app&adSource=`);
|
||||
|
||||
let userInfo = await $.api('wxActionCommon/getUserInfo',
|
||||
`pin=${$.Pin}`);
|
||||
if (!userInfo.result) {
|
||||
$.putMsg('获取用户信息,结束运行')
|
||||
return
|
||||
}
|
||||
$.nickname = userInfo.data.nickname;
|
||||
|
||||
//助力暂且不弄
|
||||
let activityContent = await $.api(
|
||||
'drawCenter/activityContent',
|
||||
`activityId=${$.activityId}&pin=${
|
||||
$.Pin}&nick=${$.nickname}&pinImg=${encodeURIComponent(
|
||||
'https://img10.360buyimg.com/imgzone/jfs/t1/21383/2/6633/3879/5c5138d8E0967ccf2/91da57c5e2166005.jpg')}&shareUuid=${$.uid}`,
|
||||
true);
|
||||
if (!activityContent.result || !activityContent.data) {
|
||||
$.putMsg(activityContent.errorMessage || '活动可能已结束')
|
||||
return
|
||||
}
|
||||
if (!$.uid) {
|
||||
$.uid = activityContent.data.uid//大概率助力码
|
||||
}
|
||||
let prizeList = await $.api('drawCenter/getPrizeList',
|
||||
`activityId=${$.activityId}&activityType=${$.activityType}&venderId=${$.venderId}`);
|
||||
if (prizeList.result) {
|
||||
$.content = prizeList.data;
|
||||
}
|
||||
let myInfo = await $.api('drawCenter/myInfo',
|
||||
`activityId=${$.activityId}&pin=${$.Pin}`);
|
||||
|
||||
if (!myInfo.result) {
|
||||
$.putMsg('获取任务列表失败')
|
||||
return
|
||||
}
|
||||
for (let ele of myInfo?.data?.taskList || []) {
|
||||
if (ele.curNum >= ele.maxNeed) {
|
||||
//完成了
|
||||
continue;
|
||||
}
|
||||
let count = ele.maxNeed - ele.curNum;
|
||||
if (ele.taskId === 'followsku') {
|
||||
$.log('followsku')
|
||||
let products = await $.api('drawCenter/getProduct',
|
||||
`activityId=${$.activityId}&pin=${
|
||||
$.Pin}&type=3`);
|
||||
for (let pd of products?.data.filter(o => !o.taskDone)) {
|
||||
if (count <= 0) {
|
||||
break;
|
||||
}
|
||||
await $.api('drawCenter/doTask',
|
||||
`activityId=${$.activityId}&pin=${
|
||||
$.Pin}&taskId=followsku¶m=${pd.skuId}`)
|
||||
await $.wait(200, 500)
|
||||
count--
|
||||
}
|
||||
}
|
||||
if (ele.taskId === 'add2cart') {
|
||||
$.log('add2cart')
|
||||
let products = await $.api('drawCenter/getProduct',
|
||||
`activityId=${$.activityId}&pin=${
|
||||
$.Pin}&type=1`);
|
||||
for (let pd of products?.data.filter(o => !o.taskDone)) {
|
||||
if (count <= 0) {
|
||||
break;
|
||||
}
|
||||
await $.api('drawCenter/doTask',
|
||||
`activityId=${$.activityId}&pin=${
|
||||
$.Pin}&taskId=add2cart¶m=${pd.skuId}`)
|
||||
await $.wait(200, 500)
|
||||
count--
|
||||
}
|
||||
}
|
||||
if (ele.taskId === 'scansku') {
|
||||
$.log('scansku')
|
||||
let products = await $.api('drawCenter/getProduct',
|
||||
`activityId=${$.activityId}&pin=${
|
||||
$.Pin}&type=2`);
|
||||
for (let pd of products?.data.filter(o => !o.taskDone)) {
|
||||
if (count <= 0) {
|
||||
break;
|
||||
}
|
||||
await $.api('drawCenter/doTask',
|
||||
`activityId=${$.activityId}&pin=${
|
||||
$.Pin}&taskId=scansku¶m=${pd.skuId}`)
|
||||
await $.wait(200, 500)
|
||||
count--
|
||||
}
|
||||
}
|
||||
if (ele.taskId === 'followshop') {
|
||||
$.log('followshop')
|
||||
await $.api('drawCenter/doTask',
|
||||
`activityId=${$.activityId}&pin=${
|
||||
$.Pin}&taskId=followshop¶m=`)
|
||||
}
|
||||
if (ele.taskId === 'joinvip') {
|
||||
$.log('joinvip')
|
||||
await $.api('drawCenter/doTask',
|
||||
`activityId=${$.activityId}&pin=${
|
||||
$.Pin}&taskId=joinvip¶m=`)
|
||||
}
|
||||
}
|
||||
activityContent = await $.api(
|
||||
'drawCenter/activityContent',
|
||||
`activityId=${$.activityId}&pin=${
|
||||
$.Pin}&nick=${$.nickname}&pinImg=${encodeURIComponent(
|
||||
'https://img10.360buyimg.com/imgzone/jfs/t1/21383/2/6633/3879/5c5138d8E0967ccf2/91da57c5e2166005.jpg')}&shareUuid=${$.uid}`,
|
||||
true);
|
||||
if (!activityContent.result) {
|
||||
$.putMsg('获取不到活动信息,结束运行')
|
||||
return
|
||||
}
|
||||
$.canDrawTimes = activityContent.data.chance || 0
|
||||
if ($.canDrawTimes === 0) {
|
||||
$.putMsg(`抽奖次数 ${$.canDrawTimes}`)
|
||||
return
|
||||
}
|
||||
for (let i = 0; i < $.canDrawTimes; i++) {
|
||||
let prize = await $.api('/drawCenter/draw/luckyDraw',
|
||||
`activityId=${$.activityId}&pin=${$.Pin}`);
|
||||
if (prize.result) {
|
||||
let msg = prize.data.drawOk ? prize.data.name
|
||||
: prize.data.errorMessage || '空气';
|
||||
$.putMsg(msg)
|
||||
} else {
|
||||
if (prize.errorMessage) {
|
||||
await $.wxStop(prize.errorMessage) ? $.expire = true : ''
|
||||
$.putMsg(`${prize.errorMessage}`);
|
||||
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
$.after = async function () {
|
||||
if ($.msg.length > 0) {
|
||||
let message = `\n${(await $.getShopInfo()).shopName || ''}\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));
|
@ -1,241 +0,0 @@
|
||||
//问题反馈: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));
|
Loading…
Reference in New Issue
Block a user