mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-07-22 21:13:47 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fdee933ca4 | ||
|
|
53ae976caf | ||
|
|
de88467c03 |
+1
-1
@@ -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
@@ -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
@@ -115,6 +115,24 @@ const Util = {
|
||||
}
|
||||
return RandomOne
|
||||
},
|
||||
/**
|
||||
* Fisher–Yates 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;
|
||||
},
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**多账号状态还原 */
|
||||
|
||||
@@ -84,7 +84,7 @@ module.exports = {
|
||||
* - 循环等待时间(指所有操作完毕后的休眠时间)
|
||||
* - 单位毫秒
|
||||
*/
|
||||
lottery_loop_wait: 60 * 60 * 1000,
|
||||
lottery_loop_wait: 0,
|
||||
check_loop_wait: 0,
|
||||
clear_loop_wait: 0,
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
cd ..
|
||||
cd ..
|
||||
npm i
|
||||
npm run check
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
cd ..
|
||||
cd ..
|
||||
npm i
|
||||
npm run clear
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
cd ..
|
||||
cd ..
|
||||
npm i
|
||||
npm run start
|
||||
@@ -1,9 +0,0 @@
|
||||
chcp 65001
|
||||
|
||||
cd ..
|
||||
cd ..
|
||||
npm i
|
||||
npm run check
|
||||
|
||||
# 暂停
|
||||
pause
|
||||
@@ -1,9 +0,0 @@
|
||||
chcp 65001
|
||||
|
||||
cd ..
|
||||
cd ..
|
||||
npm i
|
||||
npm run clear
|
||||
|
||||
# 暂停
|
||||
pause
|
||||
@@ -1,9 +0,0 @@
|
||||
chcp 65001
|
||||
|
||||
cd ..
|
||||
cd ..
|
||||
npm i
|
||||
npm run start
|
||||
|
||||
# 暂停
|
||||
pause
|
||||
Reference in New Issue
Block a user