Compare commits

...
3 Commits
Author SHA1 Message Date
shanmite fdee933ca4 pref: 对将要转发的动态洗牌乱序
防止被看出是抽奖号
2021-07-29 22:38:32 +08:00
shanmite 53ae976caf fix: 多账号出错回传错误 2021-07-29 20:18:00 +08:00
shanmite de88467c03 fix: 专栏验重 2021-07-29 13:47:11 +08:00
13 changed files with 35 additions and 54 deletions
+1 -1
View File
@@ -89,7 +89,7 @@ class Monitor extends Public {
log.info('筛选动态', `筛选完毕(${len})`);
if (len) {
for (const Lottery of allLottery) {
for (const Lottery of Util.shuffle(allLottery)) {
let status = 0;
if (Lottery.isOfficialLottery) {
let { ts } = await BiliAPI.getLotteryNotice(Lottery.dyid);
+3 -4
View File
@@ -303,17 +303,16 @@ class Public {
/**判断此专栏是否查看过的权重 */
weight = dyids_set.length / 2;
let { length } = dyids_set;
let { length } = dyids_set,
_weight = 0;
log.info('获取动态', `提取专栏(${cv})中提及的dyid(${length})`)
for (const dyid of dyids_set) {
let _weight = 0;
const isRelayed = await MyStorage.searchDyid(dyid);
if (isRelayed) {
_weight += 1;
}
if (_weight >= weight) {
log.info('获取动态', `1/2动态曾经转过,该专栏或已查看,故中止`)
log.warn('获取动态', `1/2动态曾经转过,该专栏或已查看,故中止`)
dyinfos = []
break
}
+18
View File
@@ -115,6 +115,24 @@ const Util = {
}
return RandomOne
},
/**
* FisherYates shuffle洗牌
* @template T
* @param {Array<T>} array
* @return {Array<T>}
*/
shuffle(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
},
/**
* 是否有指定环境变量
* @param {string} env_name
* @returns
*/
hasEnv(env_name) {
return process.env[env_name] ? true : false;
},
+1
View File
@@ -121,6 +121,7 @@ async function isMe() {
log.info('中奖检测', '--> OK');
}
if (desp) {
desp += '中奖了别忘给脚本(https://github.com/shanmiteko/LotteryAutoScript)点一个Star哦, 赞助一两块也不是不可以‍_(:з」∠)_\n\n'
log.info(desp);
await sendNotify('可能中奖了', desp);
} else {
+7 -3
View File
@@ -10,7 +10,7 @@ const metainfo = [
` __/ | | | `,
` |___/ |_| `,
` `,
` v1.9.9 by shanmite`,
` v2.0.0 by shanmite`,
]
/**多账号存储 */
let multiple_account = [];
@@ -33,8 +33,12 @@ async function main() {
process.env.COOKIE = acco.COOKIE;
process.env.NUMBER = acco.NUMBER;
process.env.CLEAR = acco.CLEAR;
await main();
await delay(acco.WAIT);
const err_msg = await main();
if (err_msg) {
return err_msg
} else {
await delay(acco.WAIT);
}
}
/**多账号状态还原 */
+1 -1
View File
@@ -84,7 +84,7 @@ module.exports = {
* - 循环等待时间(指所有操作完毕后的休眠时间)
* - 单位毫秒
*/
lottery_loop_wait: 60 * 60 * 1000,
lottery_loop_wait: 0,
check_loop_wait: 0,
clear_loop_wait: 0,
+4 -3
View File
@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# 脚本根目录
SCRIPT_FOLDER=lottery
@@ -61,7 +62,7 @@ docker run \
$DOCKER_REPO \
start" \
> start.sh
chmod 777 start.sh
chmod +x start.sh
echo "create check.sh"
echo -e "#!/bin/bash\n\
@@ -72,7 +73,7 @@ docker run \
$DOCKER_REPO \
check" \
> check.sh
chmod 777 check.sh
chmod +x check.sh
echo "create clear.sh"
echo -e "#!/bin/bash\n\
@@ -83,4 +84,4 @@ docker run \
$DOCKER_REPO \
clear" \
> clear.sh
chmod 777 clear.sh
chmod +x clear.sh
-5
View File
@@ -1,5 +0,0 @@
#!/bin/bash
cd ..
cd ..
npm i
npm run check
-5
View File
@@ -1,5 +0,0 @@
#!/bin/bash
cd ..
cd ..
npm i
npm run clear
-5
View File
@@ -1,5 +0,0 @@
#!/bin/bash
cd ..
cd ..
npm i
npm run start
-9
View File
@@ -1,9 +0,0 @@
chcp 65001
cd ..
cd ..
npm i
npm run check
# 暂停
pause
-9
View File
@@ -1,9 +0,0 @@
chcp 65001
cd ..
cd ..
npm i
npm run clear
# 暂停
pause
-9
View File
@@ -1,9 +0,0 @@
chcp 65001
cd ..
cd ..
npm i
npm run start
# 暂停
pause