haptear 3 years ago
parent
commit
1ca5178e14
  1. 3
      app_kyin.js
  2. 145
      csh.js

3
app_kyin.js

@ -35,6 +35,9 @@ cron 0-59/10 6-20 * * *
脚本地址:https://gitee.com/soy-tool/app-script/raw/master/app_kyin.js 脚本地址:https://gitee.com/soy-tool/app-script/raw/master/app_kyin.js
http://h5.kaixinyf.cn/api/invite/get_share_info
通过分享/邀请页面 可以抓包
邀请码 2CHAQM
*/ */

145
csh.js

@ -1,4 +1,4 @@
/* /*
潮生活(小程序) 潮生活(小程序)
export cshCookie='token=xxxxx&openId=yyyyy' export cshCookie='token=xxxxx&openId=yyyyy'
@ -35,10 +35,12 @@ class UserInfo {
this.param = $.str2json(str) this.param = $.str2json(str)
this.stopFlag = false this.stopFlag = false
this.pageLimit = 3 this.articlePageLimit = 3
this.prizePageLimit = 1
this.prizeList = []
} }
async getUserInfo() { async getUserInfo(isNotify=false) {
try { try {
let url = `https://dh.wbgj.cn/integral_applet_2/integral/user/info` let url = `https://dh.wbgj.cn/integral_applet_2/integral/user/info`
let bodyParam = { let bodyParam = {
@ -55,10 +57,14 @@ class UserInfo {
this.valid = true this.valid = true
this.name = result.info.wxUser.nickName this.name = result.info.wxUser.nickName
this.integral = result.info.wxUser.integral this.integral = result.info.wxUser.integral
console.log(`昵称:${this.name}`) if(isNotify) {
console.log(`积分:${this.integral}`) $.logAndNotify(`[${this.name}] 积分:${this.integral}`)
} else {
console.log(`昵称:${this.name}`)
console.log(`积分:${this.integral}`)
}
} else { } else {
console.log(`账号[${this.index}]CK失效: ${result.message}`) $.logAndNotify(`账号[${this.name}]CK失效: ${result.message}`)
} }
} catch(e) { } catch(e) {
console.log(e) console.log(e)
@ -84,19 +90,19 @@ class UserInfo {
if(!result) return if(!result) return
//console.log(result) //console.log(result)
if(result.state==0) { if(result.state==0) {
this.pageLimit = result.info.page.totalPage this.articlePageLimit = result.info.page.totalPage
console.log(`账号[${this.index}]获取到第${page}${result.info.weixinArtivleList.length}篇文章,共${result.info.page.totalPage}`) console.log(`账号[${this.name}]获取到第${page}${result.info.weixinArtivleList.length}篇文章,共${result.info.page.totalPage}`)
for(let item of result.info.weixinArtivleList) { for(let item of result.info.weixinArtivleList) {
if(!item.read) { if(!item.read) {
await this.visit(item,result.info.readToken) await this.visit(item,result.info.readToken)
if(this.stopFlag) break; if(this.stopFlag) break;
let rndwaittime = Math.floor(Math.random()*RANDOM_WAIT_TIME) + ROUND_WAIT_TIME let rndwaittime = Math.floor(Math.random()*RANDOM_WAIT_TIME) + ROUND_WAIT_TIME
console.log(`账号[${this.index}]等待${rndwaittime/1000}秒继续阅读...`) console.log(`账号[${this.name}]等待${rndwaittime/1000}秒继续阅读...`)
await $.wait(rndwaittime) await $.wait(rndwaittime)
} }
} }
} else { } else {
console.log(`账号[${this.index}]获取文章列表失败: ${result.message}`) console.log(`账号[${this.name}]获取文章列表失败: ${result.message}`)
} }
} catch(e) { } catch(e) {
console.log(e) console.log(e)
@ -123,7 +129,7 @@ class UserInfo {
if(result.state==0) { if(result.state==0) {
await this.award(item,readToken) await this.award(item,readToken)
} else { } else {
console.log(`账号[${this.index}]开始阅读文章[${item.tag}]失败: ${result.message}`) console.log(`账号[${this.name}]开始阅读文章[${item.tag}]失败: ${result.message}`)
} }
} catch(e) { } catch(e) {
console.log(e) console.log(e)
@ -150,9 +156,9 @@ class UserInfo {
if(!result) return if(!result) return
//console.log(result) //console.log(result)
if(result.state==0) { if(result.state==0) {
console.log(`账号[${this.index}]阅读文章[${item.tag}]成功`) console.log(`账号[${this.name}]阅读文章[${item.tag}]成功`)
} else { } else {
console.log(`账号[${this.index}]阅读文章[${item.tag}]失败: ${result.message}`) console.log(`账号[${this.name}]阅读文章[${item.tag}]失败: ${result.message}`)
if(result.message.indexOf('用户处于锁定时间') > -1) { if(result.message.indexOf('用户处于锁定时间') > -1) {
this.stopFlag = true this.stopFlag = true
} }
@ -164,15 +170,99 @@ class UserInfo {
} }
} }
async getPrizeList(page) {
try {
let url = `https://dh.wbgj.cn/integral_applet_2/integral/convert_center/prize`
let bodyParam = {
token: this.param.token,
openId: this.param.openId,
page: page,
}
let body = getSign(bodyParam)
let urlObject = populateUrlObject(url,body)
await httpRequest('post',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.state==0) {
this.prizePageLimit = result.info.page.totalPage
for(let item of result.info.prizeList) {
this.prizeList.push(item)
}
} else {
console.log(`账号[${this.name}]获取第${page}页提现列表失败: ${result.message}`)
}
} catch(e) {
console.log(e)
} finally {
return Promise.resolve(1);
}
}
async exchange(item) {
try {
let url = `https://dh.wbgj.cn/integral_applet_2/integral/convert_center/exchange/prize`
let bodyParam = {
token: this.param.token,
openId: this.param.openId,
code: '',
convertId: item.convertId,
phone: '',
account: '',
}
let body = getSign(bodyParam)
let urlObject = populateUrlObject(url,body)
await httpRequest('post',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.state==0) {
this.integral -= item.integral
$.logAndNotify(`账号[${this.name}]提现[${item.prizeName}]成功`)
} else {
$.logAndNotify(`账号[${this.name}]提现[${item.prizeName}]失败: ${result.message}`)
}
} catch(e) {
console.log(e)
} finally {
return Promise.resolve(1);
}
}
async userExchangeTask() {
try {
await this.getUserInfo(true);
await this.getPrizeList(1);
if(this.prizePageLimit > 1) {
for(let i=2; i<=this.prizePageLimit; i++) {
await this.getPrizeList(i);
}
}
if(this.prizeList.length > 0) {
for(let item of this.prizeList.sort(function(a,b) {return b.prizeWorth-a.prizeWorth})) {
if(this.integral < item.integral) continue;
if(item.prizeCount - item.drawCount <= 0) continue;
await this.exchange(item)
}
} else {
$.logAndNotify(`账号[${this.name}]没有获取到提现选项`)
}
} catch(e) {
console.log(e)
} finally {
return Promise.resolve(1);
}
}
async userTask() { async userTask() {
try { try {
await this.articleList(1); await this.articleList(1);
if(this.pageLimit > 1) { if(this.articlePageLimit > 1) {
for(let i=2; i<=this.pageLimit && !this.stopFlag; i++) { for(let i=2; i<=this.articlePageLimit && !this.stopFlag; i++) {
await this.articleList(i); await this.articleList(i);
} }
} }
console.log(`账号[${this.index}]已完成阅读`) console.log(`账号[${this.name}]已完成阅读`)
} catch(e) { } catch(e) {
console.log(e) console.log(e)
} finally { } finally {
@ -295,15 +385,26 @@ function getSign(e) {
for(let user of userList) { for(let user of userList) {
console.log(`\n============= 账号[${user.index}] =============`) console.log(`\n============= 账号[${user.index}] =============`)
await user.getUserInfo(); await user.getUserInfo(false);
} }
console.log(`\n============= 开始阅读 =============`) let validUserList = userList.filter(x => x.valid)
let taskall = []
for(let user of userList.filter(x => x.valid)) { if(validUserList.length > 0) {
taskall.push(user.userTask()) console.log(`\n============= 开始阅读 =============`)
let taskall = []
for(let user of validUserList) {
taskall.push(user.userTask())
}
await Promise.all(taskall);
console.log(`\n============= 提现 =============`)
for(let user of validUserList) {
await user.userExchangeTask(true);
}
} }
await Promise.all(taskall);
await $.showmsg();
} }
})() })()
.catch((e) => console.log(e)) .catch((e) => console.log(e))

Loading…
Cancel
Save