mirror of
https://github.com/shufflewzc/faker2.git
synced 2025-04-19 20:48:03 +08:00
update
This commit is contained in:
parent
baf2b9a8ac
commit
e0914c5caf
@ -20,7 +20,7 @@ const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
//Node.js用户请在jdCookie.js处填写京东ck;
|
||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||
let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送
|
||||
const randomCount = $.isNode() ? 30 : 5;
|
||||
const randomCount = $.isNode() ? 20 : 5;
|
||||
//IOS等用户直接用NobyDa的jd cookie
|
||||
let cookiesArr = [], cookie = '', message;
|
||||
if ($.isNode()) {
|
||||
|
16
jd_dpqd.js
16
jd_dpqd.js
@ -26,13 +26,13 @@ let num=0
|
||||
let shopname=''
|
||||
const token = [
|
||||
"80E78A5F090820E5B1754E17E1485D3F",
|
||||
"B3E1665D2154B1CCF6FA036F53D28707",
|
||||
"2DACD1FEDEB92BEEDBD54E6B926798B1",
|
||||
"02BC0ECE5C47F27DD21BEBB0B0DFDB88",
|
||||
"A0D5832C2A4A942DBFBC0816BA6691C8",
|
||||
"7127A3861F6478043B1BF112803B9A25",
|
||||
"7C513EAE76DCB43D86E0C64762719976",
|
||||
"D88BAFF737E9C4295F973732214F5DE5",
|
||||
"3C40932565A6F6E69237E17773D907AA",
|
||||
"A36F8FDDB5C64DE89061B7DA331E4874",
|
||||
"63F7C22BEBF3EB981821C9188C8EB8EE",
|
||||
"FE30AB00038CFFEF00DA9E9B8E932721",
|
||||
"F0C24D7588D90922393B423C6623F31A",
|
||||
@ -44,7 +44,17 @@ const token = [
|
||||
"37C465E26FCFFCFC72B991036CBC6A79",
|
||||
"7C071F9A6D11D5F26B83CF6BB91D2E89",
|
||||
"3D2F9CF0C806133D3C64949F06CD4A80",
|
||||
"19FC5C93948E015ED82F4740299F95FD"
|
||||
"19FC5C93948E015ED82F4740299F95FD",
|
||||
"868B5F6062E5DD77D3F024EDA1AA94E0",
|
||||
"F26AB04CFB9DA6CC14F40A355E1709DE",
|
||||
"902F208E5868474EE70F3C40BB16F4A2",
|
||||
"CFE83CA731BB8B8395C1016BE7498F7A",
|
||||
"C857A8790C474AB23764165EA056A20E",
|
||||
"351154FDCFF09CD4406A0A9D6FF8B216",
|
||||
"306D23886F4C74F3A44897D06AAEBE2C",
|
||||
"1DF38A60E4FCB9C461B7B68548C75EC1",
|
||||
"99B695DFEF69DD31BB78B58D61B9C6A2",
|
||||
"EBC07F65183699ABACF313CA67B444E4"
|
||||
]
|
||||
|
||||
if ($.isNode()) {
|
||||
|
@ -67,12 +67,9 @@ async function jdsign() {
|
||||
await $.wait(2000)
|
||||
await getInfo("https://pro.m.jd.com/mall/active/kPM3Xedz1PBiGQjY4ZYGmeVvrts/index.html");//陪伴
|
||||
await $.wait(2000)
|
||||
//await getInfo("https://pro.m.jd.com/mall/active/3SC6rw5iBg66qrXPGmZMqFDwcyXi/index.html");//京东图书
|
||||
//await $.wait(2000)
|
||||
await getInfo("https://prodev.m.jd.com/mall/active/hPJiMgUQmc34bamrApLUBRUy82W/index.html");//4.3结束
|
||||
await getInfo("https://prodev.m.jd.com/mall/active/2BspupMr6qenk9JUWpbAnepLHjwy/index.html");//女装馆6.30
|
||||
await $.wait(2000)
|
||||
await getInfo("https://prodev.m.jd.com/mall/active/2FzVtkSfUtvU8YoiTeALkJ68PxAs/index.html");//医疗馆 12.31结束
|
||||
// await getInfo("https://pro.m.jd.com/mall/active/ZrH7gGAcEkY2gH8wXqyAPoQgk6t/index.html");//箱包签到
|
||||
// await $.wait(1000)
|
||||
// await getInfo("https://pro.m.jd.com/mall/active/4RXyb1W4Y986LJW8ToqMK14BdTD/index.html");//鞋靴馆签到
|
||||
|
||||
|
76
jd_wskey.py
76
jd_wskey.py
@ -32,7 +32,15 @@ except Exception as err: # 异常捕捉
|
||||
logger.debug(str(err)) # 调试日志输出
|
||||
logger.info("无推送文件") # 标准日志输出
|
||||
|
||||
ver = 20413 # 版本号
|
||||
ver = 20505 # 版本号
|
||||
|
||||
|
||||
def ql_send(text):
|
||||
try: # 异常捕捉
|
||||
send('WSKEY转换', text) # 消息发送
|
||||
except Exception as err: # 异常捕捉
|
||||
logger.debug(str(err)) # Debug日志输出
|
||||
logger.info("通知发送失败") # 标准日志输出
|
||||
|
||||
|
||||
# 登录青龙 返回值 token
|
||||
@ -50,7 +58,13 @@ def get_qltoken(username, password): # 方法 用于获取青龙 Token
|
||||
} # HTTP请求头 设置为 Json格式
|
||||
try: # 异常捕捉
|
||||
res = requests.post(url=url, headers=headers, data=payload) # 使用 requests模块进行 HTTP POST请求
|
||||
token = json.loads(res.text)["data"]['token'] # 从 res.text 返回值中 取出 Token值
|
||||
if res.status_code == 200 and res.json()["code"] == 200:
|
||||
token = res.json()["data"]['token'] # 从 res.text 返回值中 取出 Token值
|
||||
return token
|
||||
else:
|
||||
logger.info("暂未兼容两步验证")
|
||||
ql_send("青龙登录失败, 请检查是否开启两步验证 脚本暂未兼容两步验证")
|
||||
sys.exit(1) # 脚本退出
|
||||
except Exception as err:
|
||||
logger.debug(str(err)) # Debug日志输出
|
||||
logger.info("使用旧版青龙登录接口")
|
||||
@ -70,17 +84,12 @@ def get_qltoken(username, password): # 方法 用于获取青龙 Token
|
||||
except Exception as err: # 异常捕捉
|
||||
logger.debug(str(err)) # Debug日志输出
|
||||
logger.info("青龙登录失败, 请检查面板状态!") # 标准日志输出
|
||||
text = '青龙面板WSKEY转换登陆面板失败, 请检查面板状态.' # 设置推送内容
|
||||
try: # 异常捕捉
|
||||
send('WSKEY转换', text) # 消息发送
|
||||
except Exception as err: # 异常捕捉
|
||||
logger.debug(str(err)) # Debug日志输出
|
||||
logger.info("通知发送失败") # 标准日志输出
|
||||
ql_send('青龙登陆失败, 请检查面板状态.')
|
||||
sys.exit(1) # 脚本退出
|
||||
else: # 无异常执行分支
|
||||
return token # 返回 token值
|
||||
else: # 无异常执行分支
|
||||
return token # 返回 token值
|
||||
# else: # 无异常执行分支
|
||||
# return token # 返回 token值
|
||||
|
||||
|
||||
# 返回值 Token
|
||||
@ -137,7 +146,7 @@ def get_ck(): # 方法 获取 JD_COOKIE值 [系统变量传递] <! 此方法未
|
||||
else: # 判断分支
|
||||
logger.info("JD_COOKIE变量未启用") # 标准日志输出
|
||||
sys.exit(1) # 脚本退出
|
||||
else: # 判断分支
|
||||
else: # 判断分支
|
||||
logger.info("未添加JD_COOKIE变量") # 标准日志输出
|
||||
sys.exit(0) # 脚本退出
|
||||
|
||||
@ -156,7 +165,7 @@ def check_ck(ck): # 方法 检查 Cookie有效性 使用变量传递 单次调
|
||||
nowTime = time.time() # 获取时间戳 赋值
|
||||
updatedAt = 0.0 # 赋值
|
||||
searchObj = re.search(r'__time=([^;\s]+)', ck, re.M | re.I) # 正则检索 [__time=]
|
||||
if searchObj: # 真值判断
|
||||
if searchObj: # 真值判断
|
||||
updatedAt = float(searchObj.group(1)) # 取值 [float]类型
|
||||
if nowTime - updatedAt >= (updateHour * 60 * 60) - (10 * 60): # 判断时间操作
|
||||
logger.info(str(pin) + ";即将到期或已过期\n") # 标准日志输出
|
||||
@ -182,7 +191,7 @@ def check_ck(ck): # 方法 检查 Cookie有效性 使用变量传递 单次调
|
||||
except Exception as err: # 异常捕捉
|
||||
logger.debug(str(err)) # 调试日志输出
|
||||
logger.info("JD接口错误 请重试或者更换IP") # 标准日志输出
|
||||
return False # 返回 Bool类型 False
|
||||
return False # 返回 Bool类型 False
|
||||
else: # 判断分支
|
||||
if res.status_code == 200: # 判断 JD_API 接口是否为 200 [HTTP_OK]
|
||||
code = int(json.loads(res.text)['retcode']) # 使用 Json模块对返回数据取值 int([retcode])
|
||||
@ -217,13 +226,14 @@ def getToken(wskey): # 方法 获取 Wskey转换使用的 Token 由 JD_API 返
|
||||
url = 'https://api.m.jd.com/client.action' # 设置 URL地址
|
||||
data = 'body=%7B%22to%22%3A%22https%253a%252f%252fplogin.m.jd.com%252fjd-mlogin%252fstatic%252fhtml%252fappjmp_blank.html%22%7D&' # 设置 POST 载荷
|
||||
try: # 异常捕捉
|
||||
res = requests.post(url=url, params=params, headers=headers, data=data, verify=False, timeout=10) # HTTP请求 [POST] 超时 10秒
|
||||
res = requests.post(url=url, params=params, headers=headers, data=data, verify=False,
|
||||
timeout=10) # HTTP请求 [POST] 超时 10秒
|
||||
res_json = json.loads(res.text) # Json模块 取值
|
||||
tokenKey = res_json['tokenKey'] # 取出TokenKey
|
||||
except Exception as err: # 异常捕捉
|
||||
logger.info("JD_WSKEY接口抛出错误 尝试重试 更换IP") # 标准日志输出
|
||||
logger.info(str(err)) # 标注日志输出
|
||||
return False, wskey # 返回 -> False[Bool], Wskey
|
||||
return False, wskey # 返回 -> False[Bool], Wskey
|
||||
else: # 判断分支
|
||||
return appjmp(wskey, tokenKey) # 传递 wskey, Tokenkey 执行方法 [appjmp]
|
||||
|
||||
@ -245,7 +255,8 @@ def appjmp(wskey, tokenKey): # 方法 传递 wskey & tokenKey
|
||||
} # 设置 HTTP_URL 参数
|
||||
url = 'https://un.m.jd.com/cgi-bin/app/appjmp' # 设置 URL地址
|
||||
try: # 异常捕捉
|
||||
res = requests.get(url=url, headers=headers, params=params, verify=False, allow_redirects=False, timeout=20) # HTTP请求 [GET] 阻止跳转 超时 20秒
|
||||
res = requests.get(url=url, headers=headers, params=params, verify=False, allow_redirects=False,
|
||||
timeout=20) # HTTP请求 [GET] 阻止跳转 超时 20秒
|
||||
except Exception as err: # 异常捕捉
|
||||
logger.info("JD_appjmp 接口错误 请重试或者更换IP\n") # 标准日志输出
|
||||
logger.info(str(err)) # 标准日志输出
|
||||
@ -273,20 +284,16 @@ def appjmp(wskey, tokenKey): # 方法 传递 wskey & tokenKey
|
||||
|
||||
|
||||
def update(): # 方法 脚本更新模块
|
||||
up_ver = int(cloud_arg['update']) # 云端参数取值 [int]
|
||||
up_ver = int(cloud_arg['update']) # 云端参数取值 [int]
|
||||
if ver >= up_ver: # 判断版本号大小
|
||||
logger.info("当前脚本版本: " + str(ver)) # 标准日志输出
|
||||
logger.info("--------------------\n") # 标准日志输出
|
||||
else: # 判断分支
|
||||
logger.info("当前脚本版本: " + str(ver) + "新版本: " + str(up_ver)) # 标准日志输出
|
||||
logger.info("当前脚本版本: " + str(ver) + "新版本: " + str(up_ver)) # 标准日志输出
|
||||
logger.info("存在新版本, 请更新脚本后执行") # 标准日志输出
|
||||
logger.info("--------------------\n") # 标准日志输出
|
||||
text = '当前脚本版本: {0}新版本: {1}, 请更新脚本~!'.format(ver, up_ver) # 设置发送内容
|
||||
try: # 异常捕捉
|
||||
send('WSKEY转换', text) # 推送消息
|
||||
except Exception as err: # 异常捕捉
|
||||
logger.debug(str(err)) # 调试日志输出
|
||||
logger.info("通知发送失败") # 标准日志输出
|
||||
ql_send(text)
|
||||
# sys.exit(0) # 退出脚本 [未启用]
|
||||
|
||||
|
||||
@ -386,7 +393,7 @@ def ql_disable(e_id): # 方法 青龙变量禁用 传递 eid
|
||||
|
||||
|
||||
def ql_insert(i_ck): # 方法 插入新变量
|
||||
data = [{"value": i_ck, "name": "JD_COOKIE"}] # POST数据载荷组合
|
||||
data = [{"value": i_ck, "name": "JD_COOKIE"}] # POST数据载荷组合
|
||||
data = json.dumps(data) # Json格式化数据
|
||||
url = 'http://127.0.0.1:{0}/api/envs'.format(port) # 设置 URL地址
|
||||
s.post(url=url, data=data) # HTTP[POST]请求 使用session
|
||||
@ -404,7 +411,7 @@ def cloud_info(): # 方法 云端信息
|
||||
time.sleep(1) # 休眠 1秒
|
||||
continue # 循环继续
|
||||
except requests.exceptions.ReadTimeout: # 异常捕捉
|
||||
logger.info("\n获取云端参数超时, 正在重试!" + str(i)) # 标准日志输出
|
||||
logger.info("\n获取云端参数超时, 正在重试!" + str(i)) # 标准日志输出
|
||||
time.sleep(1) # 休眠 1秒
|
||||
continue # 循环继续
|
||||
except Exception as err: # 异常捕捉
|
||||
@ -423,7 +430,8 @@ def cloud_info(): # 方法 云端信息
|
||||
|
||||
|
||||
def check_cloud(): # 方法 云端地址检查
|
||||
url_list = ['aHR0cDovLzQzLjEzNS45MC4yMy8=', 'aHR0cHM6Ly9zaGl6dWt1Lm1sLw==', 'aHR0cHM6Ly9jZi5zaGl6dWt1Lm1sLw=='] # URL list Encode
|
||||
url_list = ['aHR0cDovLzQzLjEzNS45MC4yMy8=', 'aHR0cHM6Ly9zaGl6dWt1Lm1sLw==',
|
||||
'aHR0cHM6Ly9jZi5zaGl6dWt1Lm1sLw=='] # URL list Encode
|
||||
for i in url_list: # for循环 url_list
|
||||
url = str(base64.b64decode(i).decode()) # 设置 url地址 [str]
|
||||
try: # 异常捕捉
|
||||
@ -436,11 +444,7 @@ def check_cloud(): # 方法 云端地址检查
|
||||
logger.info(str(info[url_list.index(i)]) + " Server Check OK\n--------------------\n") # 标准日志输出
|
||||
return i # 返回 ->i
|
||||
logger.info("\n云端地址全部失效, 请检查网络!") # 标准日志输出
|
||||
try: # 异常捕捉
|
||||
send('WSKEY转换', '云端地址失效. 请联系作者或者检查网络.') # 推送消息
|
||||
except Exception as err: # 异常捕捉
|
||||
logger.debug(str(err)) # 调试日志输出
|
||||
logger.info("通知发送失败") # 标准日志输出
|
||||
ql_send('云端地址失效. 请联系作者或者检查网络.') # 推送消息
|
||||
sys.exit(1) # 脚本退出
|
||||
|
||||
|
||||
@ -465,7 +469,7 @@ def check_port(): # 方法 检查变量传递端口
|
||||
return port # 返回->port
|
||||
|
||||
|
||||
if __name__ == '__main__': # Python主函数执行入口
|
||||
if __name__ == '__main__': # Python主函数执行入口
|
||||
port = check_port() # 调用方法 [check_port] 并赋值 [port]
|
||||
token = ql_login() # 调用方法 [ql_login] 并赋值 [token]
|
||||
s = requests.session() # 设置 request session方法
|
||||
@ -505,7 +509,7 @@ if __name__ == '__main__': # Python主函数执行入口
|
||||
if return_ws[0]: # 判断 [return_ws]返回值 Bool类型
|
||||
nt_key = str(return_ws[1]) # 从 return_ws[1] 取出 -> nt_key
|
||||
# logger.info("wskey转pt_key成功", nt_key) # 标准日志输出 [未启用]
|
||||
logger.info("wskey转换成功") # 标准日志输出
|
||||
logger.info("wskey转换成功") # 标准日志输出
|
||||
eid = return_serch[2] # 从 return_serch 拿到 eid
|
||||
ql_update(eid, nt_key) # 函数 ql_update 参数 eid JD_COOKIE
|
||||
else: # 判断分支
|
||||
@ -517,11 +521,7 @@ if __name__ == '__main__': # Python主函数执行入口
|
||||
logger.info(str(wspin) + "账号禁用") # 标准日志输出
|
||||
ql_disable(eid) # 执行方法[ql_disable] 传递 eid
|
||||
text = "账号: {0} WsKey疑似失效, 已禁用Cookie".format(wspin) # 设置推送内容
|
||||
try: # 异常捕捉
|
||||
send('WsKey转换脚本', text) # 推送消息
|
||||
except Exception as err: # 异常捕捉
|
||||
logger.debug(str(err)) # 调试日志输出
|
||||
logger.info("通知发送失败") # 标准日志输出
|
||||
ql_send(text)
|
||||
else: # 判断分支
|
||||
logger.info(str(wspin) + "账号有效") # 标准日志输出
|
||||
eid = return_serch[2] # 读取 return_serch[2] -> eid
|
||||
|
79
m_jd_farm_automation.js
Normal file
79
m_jd_farm_automation.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
m_jd_follow_shop.js
Normal file
125
m_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;
|
||||
}
|
||||
|
64
m_jd_pet_automation.js
Normal file
64
m_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;
|
||||
}
|
||||
|
182
m_jd_wx_addCart.js
Normal file
182
m_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
m_jd_wx_collectCard.js
Normal file
241
m_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
m_jd_wx_luckDraw.js
Normal file
231
m_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
m_jx_factory_automation.js
Normal file
326
m_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
m_jx_factory_commodity.js
Normal file
97
m_jx_factory_commodity.js
Normal file
File diff suppressed because one or more lines are too long
15
magic.json
Normal file
15
magic.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"user_id": 9513068,
|
||||
"bot_token": "1657567:AAGO7sxIVvhdSHSJt_k_0u_C1w7U",
|
||||
"api_id": "37419",
|
||||
"api_hash": "f81a30b54255566c15b3d578",
|
||||
"//proxy 需要代理 true 不需要道理 false": 1,
|
||||
"proxy": true,
|
||||
"proxy_add": "127.0.0.1",
|
||||
"proxy_port": 7890,
|
||||
"proxy_username": "",
|
||||
"proxy_password": "",
|
||||
"//base_path 填脚本所在目录": 1,
|
||||
"base_path": "填脚本所在目录",
|
||||
"car_group_id": -1001533334185
|
||||
}
|
191
magic.py
Normal file
191
magic.py
Normal file
@ -0,0 +1,191 @@
|
||||
import asyncio
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import urllib.parse
|
||||
|
||||
from cacheout import FIFOCache
|
||||
from pyrogram import Client, filters
|
||||
|
||||
cache = FIFOCache(maxsize=512)
|
||||
|
||||
platform = "v4"
|
||||
if os.path.exists("/jd/config/magic.json"):
|
||||
with open("/jd/config/magic.json", 'r', encoding='utf-8') as f:
|
||||
BOT = json.load(f)
|
||||
|
||||
if os.path.exists("/ql/config/magic.json"):
|
||||
platform = "ql"
|
||||
with open("/ql/config/magic.json", 'r', encoding='utf-8') as f:
|
||||
BOT = json.load(f)
|
||||
|
||||
if os.path.exists("/ql/data/config/magic.json"):
|
||||
platform = "ql2"
|
||||
with open("/ql/data/config/magic.json", 'r', encoding='utf-8') as f:
|
||||
BOT = json.load(f)
|
||||
|
||||
api_id = int(BOT['api_id'])
|
||||
api_hash = BOT['api_hash']
|
||||
my_id = int(BOT['user_id'])
|
||||
my_bot_id = int(BOT['bot_token'].split(":")[0])
|
||||
base_path = BOT['base_path']
|
||||
|
||||
if platform == "v4":
|
||||
_ConfigSH = '/jd/config/config.sh'
|
||||
elif platform == 'ql':
|
||||
_ConfigSH = '/ql/config/config.sh'
|
||||
else:
|
||||
_ConfigSH = '/ql/data/config/config.sh'
|
||||
|
||||
if BOT['proxy']:
|
||||
proxy = {
|
||||
'hostname': BOT['proxy_add'], # 改成自己的
|
||||
'port': int(BOT['proxy_port']),
|
||||
'username': BOT['proxy_username'],
|
||||
'password': BOT['proxy_password']
|
||||
}
|
||||
app = Client('magic', api_id, api_hash, proxy=proxy)
|
||||
else:
|
||||
app = Client('magic', api_id, api_hash)
|
||||
|
||||
# 监控的自动车
|
||||
car_group_id = int(BOT['car_group_id'])
|
||||
|
||||
monitor_flag = 'https://i.walle.com/api?data='
|
||||
|
||||
# 你的脚本配置
|
||||
car_config = [
|
||||
{'name': 'M加购有礼', 'env': 'M_WX_ADD_CART_URL', 'js': 'm_jd_wx_addCart.js', 'cmd': 'now'},
|
||||
{'name': 'M幸运抽奖', 'env': 'M_WX_LUCK_DRAW_URL', 'js': 'm_jd_wx_luckDraw.js', 'cmd': 'now'},
|
||||
{'name': 'M集卡抽奖', 'env': 'M_WX_COLLECT_CARD_URL', 'js': 'm_jd_wx_collectCard.js', 'cmd': 'now'},
|
||||
{'name': 'M关注有礼', 'env': 'M_FOLLOW_SHOP_ARGV', 'js': 'm_jd_follow_shop.js', 'cmd': 'now'}
|
||||
]
|
||||
|
||||
|
||||
@app.on_message(filters.chat(my_bot_id) & filters.regex("在吗"))
|
||||
async def handler(client, message):
|
||||
await message.reply("老板啥事!")
|
||||
|
||||
|
||||
@app.on_message(filters.chat(car_group_id) & filters.text)
|
||||
async def handler(client, message):
|
||||
try:
|
||||
if message.entities is None:
|
||||
return
|
||||
text = message.entities[0]['url']
|
||||
if text is None:
|
||||
return
|
||||
if 'i.walle.com' not in text:
|
||||
return
|
||||
text = urllib.parse.unquote(text.replace(monitor_flag, ''))
|
||||
zd = 1
|
||||
if 'jd_zdjr_activityId' in text:
|
||||
zd = re.search(f'jd_zdjr_activityId="(.*)"', text)[1]
|
||||
if zd != 1:
|
||||
if cache.get(zd) is not None:
|
||||
await client.send_message(my_bot_id, f'跑过 {text}')
|
||||
return
|
||||
cache.set(zd, zd)
|
||||
else:
|
||||
if cache.get(text) is not None:
|
||||
await client.send_message(my_bot_id, f'跑过 {text}')
|
||||
return
|
||||
cache.set(text, text)
|
||||
name = ''
|
||||
js = ''
|
||||
command = ''
|
||||
for v in car_config:
|
||||
if v['env'] in text:
|
||||
name = v['name']
|
||||
js = v['js']
|
||||
command = v['cmd']
|
||||
break
|
||||
if len(name) == 0:
|
||||
await client.send_message(my_bot_id, f'未知变量`{text}`')
|
||||
return
|
||||
messages = text.split("\n")
|
||||
change = ""
|
||||
for message in messages:
|
||||
if "export " not in message:
|
||||
continue
|
||||
kv = message.replace("export ", "")
|
||||
key = kv.split("=")[0]
|
||||
value = re.findall(r'"([^"]*)"', kv)[0]
|
||||
configs = rwcon("str")
|
||||
if kv in configs:
|
||||
continue
|
||||
if key in configs:
|
||||
configs = re.sub(f'{key}=("|\').*("|\')', kv, configs)
|
||||
change += f"【替换】 `{name}` 环境变量成功\n`{kv}\n`"
|
||||
else:
|
||||
if platform == 'v4':
|
||||
end_line = 0
|
||||
configs = rwcon("list")
|
||||
for config in configs:
|
||||
if "第五区域" in config and "↑" in config:
|
||||
end_line = configs.index(config) - 1
|
||||
break
|
||||
configs.insert(end_line, f'export {key}="{value}"\n')
|
||||
else:
|
||||
configs = rwcon("str")
|
||||
configs += f'export {key}="{value}"\n'
|
||||
change += f"【新增】 `{name}` 环境变量成功\n`{kv}\n`"
|
||||
await client.send_message(my_bot_id, change)
|
||||
rwcon(configs)
|
||||
if len(change) == 0:
|
||||
await client.send_message(my_bot_id, f'【取消】{name}环境变量无需改动')
|
||||
return
|
||||
if len(js) > 0:
|
||||
await client.send_message(my_bot_id, f'开始运行 {js}')
|
||||
if platform == 'v4':
|
||||
await cmd(client, f'jtask {base_path}/{js} {command}')
|
||||
else:
|
||||
await cmd(client, f'task {base_path}/{js} {command}')
|
||||
else:
|
||||
await client.send_message(my_bot_id, f'无需执行')
|
||||
except Exception as e:
|
||||
await client.send_message(my_bot_id, f'{str(e)}')
|
||||
|
||||
|
||||
async def cmd(client, cmd_text):
|
||||
'''定义执行cmd命令'''
|
||||
try:
|
||||
p = await asyncio.create_subprocess_shell(
|
||||
cmd_text, stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE)
|
||||
res_bytes, res_err = await p.communicate()
|
||||
res = res_bytes.decode('utf-8')
|
||||
if len(res) > 0:
|
||||
if platform == "v4":
|
||||
base = "/jd"
|
||||
elif platform == "ql":
|
||||
base = "/ql"
|
||||
else:
|
||||
base = "/ql/data"
|
||||
tmp_log = f'{base}/log/bot/{cmd_text.split("/")[-1].split(".js")[0]}-{datetime.datetime.now().strftime("%H-%M-%S.%f")}.log'
|
||||
with open(tmp_log, 'w+', encoding='utf-8') as f:
|
||||
f.write(res)
|
||||
except Exception as e:
|
||||
await client.send_message(my_bot_id, f'日志目录有误,{str(e)}')
|
||||
|
||||
|
||||
# 读写config.sh
|
||||
def rwcon(arg):
|
||||
if arg == "str":
|
||||
with open(_ConfigSH, 'r', encoding='utf-8') as f1:
|
||||
configs = f1.read()
|
||||
return configs
|
||||
elif arg == "list":
|
||||
with open(_ConfigSH, 'r', encoding='utf-8') as f1:
|
||||
configs = f1.readlines()
|
||||
return configs
|
||||
elif isinstance(arg, str):
|
||||
with open(_ConfigSH, 'w', encoding='utf-8') as f1:
|
||||
f1.write(arg)
|
||||
elif isinstance(arg, list):
|
||||
with open(_ConfigSH, 'w', encoding='utf-8') as f1:
|
||||
f1.write("".join(arg))
|
||||
|
||||
|
||||
app.run()
|
8
mount.sh
Normal file
8
mount.sh
Normal file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
ln -s /ql/data/config /ql/config
|
||||
ln -s /ql/data/db /ql/db
|
||||
ln -s /ql/data/jbot /ql/jbot
|
||||
ln -s /ql/data/log /ql/log
|
||||
ln -s /ql/data/scripts /ql/scripts
|
||||
echo "# 旧版青龙目录挂载完成。"
|
34
test.js
Normal file
34
test.js
Normal file
@ -0,0 +1,34 @@
|
||||
const {Env} = require('./magic');
|
||||
const $ = new Env('MTest');
|
||||
|
||||
$.logic = async function () {
|
||||
let activityContent = {
|
||||
"result": true,
|
||||
"data": {
|
||||
"id": "173f89d8cc6d413e81a357b07137d56d",
|
||||
"userId": 197936,
|
||||
"venderType": 0,
|
||||
"endTime": 1649381820000,
|
||||
"list": [{
|
||||
"type": "dq",
|
||||
"takeNum": null,
|
||||
"discount": "20",
|
||||
"quota": "499"
|
||||
}],
|
||||
"hasFollow": false,
|
||||
"openCard": false,
|
||||
"shopMember": false,
|
||||
"shopgiftActivity": null
|
||||
},
|
||||
"count": 0,
|
||||
"errorMessage": ""
|
||||
}
|
||||
$.content = activityContent.data.list
|
||||
let ts = $.content.filter(o => ['jd', 'jf'].includes(o.type));
|
||||
if (ts.length === 0) {
|
||||
$.putMsg(`不是豆子或积分不跑`);
|
||||
}
|
||||
|
||||
};
|
||||
$.run({whitelist: [1]})
|
||||
.catch(reason => $.log(reason));
|
Loading…
Reference in New Issue
Block a user