Skip to content

Commit

Permalink
Merge pull request #32 from iDerekLi/workflows
Browse files Browse the repository at this point in the history
Workflows
  • Loading branch information
iDerekLi authored May 25, 2022
2 parents 2667057 + 6f11f4c commit 815329e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "juejin-helper",
"version": "1.4.0",
"description": "稀土掘金助手:签到、抽奖、沾喜气、海底淘金、自动化工作流。",
"version": "1.5.1",
"description": "稀土掘金助手:签到、抽奖、沾喜气、海底淘金、BugFix、自动化工作流。",
"author": "Derek Li",
"license": "MIT",
"scripts": {
Expand All @@ -11,7 +11,7 @@
},
"dependencies": {
"fast-astar": "^1.0.6",
"juejin-helper": "^0.1.4",
"juejin-helper": "^1.5.1",
"nodemailer": "^6.7.0"
},
"repository": {
Expand Down
24 changes: 24 additions & 0 deletions scripts/checkin.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class CheckIn {
drawLotteryHistory = {};
lotteryCount = 0;
luckyValueProbability = 0;
bugStatus = 0;
collectBugCount = 0;
userOwnBug = 0;

calledSdkSetting = false;
calledTrackGrowthEvent = false;
Expand Down Expand Up @@ -99,6 +102,23 @@ class CheckIn {

this.luckyValueProbability = getProbabilityOfWinning(this.sumPoint);

// 收集bug
const bugfix = juejin.bugfix();

const competition = await bugfix.getCompetition();
const bugfixInfo = await bugfix.getUser(competition);
this.userOwnBug = bugfixInfo.user_own_bug;

try {
const notCollectBugList = await bugfix.getNotCollectBugList();
await bugfix.collectBugBatch(notCollectBugList);
this.bugStatus = 1;
this.collectBugCount = notCollectBugList.length;
this.userOwnBug += this.collectBugCount;
} catch (e) {
this.bugStatus = 2;
}

// 调用埋点
const sdk = juejin.sdk();

Expand Down Expand Up @@ -155,9 +175,13 @@ ${this.todayStatus === 1 ? `签到成功 +${this.incrPoint} 矿石` :
this.todayStatus === 2 ? "今日已完成签到" : "签到失败"}
${this.dipStatus === 1 ? `沾喜气 +${this.dipValue} 幸运值` :
this.dipStatus === 2 ? "今日已经沾过喜气" : "沾喜气失败"}
${this.bugStatus === 1 ?
this.collectBugCount > 0 ? `收集Bug +${this.collectBugCount}` : "没有可收集Bug"
: "收集Bug失败"}
连续签到天数 ${this.contCount}
累计签到天数 ${this.sumCount}
当前矿石数 ${this.sumPoint}
当前未消除Bug数量 ${this.userOwnBug}
当前幸运值 ${this.luckyValue}/6000
预测All In矿石累计幸运值比率 ${(this.luckyValueProbability * 100).toFixed(2) + "%"}
抽奖总次数 ${this.lotteryCount}
Expand Down
2 changes: 1 addition & 1 deletion scripts/utils/email.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async function main({ subject, text, html }) {
</main>
<footer style="padding: 10px 0; border-top: 1px solid #f1f1f1; text-align: center; font-size: 12px; color: #6e6e73;">
<span>稀土掘金助手</span> |
<span>Copyright © 2022 Derek Li.</span>
<span>Copyright © ${(new Date()).getFullYear()} Derek Li.</span>
</footer>
</section>
`.trim();
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jsonwebtoken@^8.5.1:
ms "^2.1.1"
semver "^5.6.0"

juejin-helper@^0.1.4:
version "0.1.4"
resolved "https://registry.npmmirror.com/juejin-helper/-/juejin-helper-0.1.4.tgz#921933b63cd21276dfd928f953a80fe87b454d45"
integrity sha512-14xMEhYgT+RhtmU13IJfMAeZwGwKwSzr+VjO5tCLtxP/MfrpEzSvmEOCKVRwITfJ3e2+NQyU//i+6jFVL9+9/Q==
juejin-helper@^1.5.1:
version "1.5.1"
resolved "https://registry.npmmirror.com/juejin-helper/-/juejin-helper-1.5.1.tgz#416dd622e18daa03fd5ab68f2fb74ec522ce4e8f"
integrity sha512-CoC4D0hph59eodM2aO7Brj8hURvFuI8PvrSgZQzyjQ/5BqYK2+ewcMNXxhzYWvHZ4ENMFqfwzHbOU4OelfyJ6Q==
dependencies:
jsonwebtoken "^8.5.1"
node-fetch "^2.6.1"
Expand Down

0 comments on commit 815329e

Please sign in to comment.