Skip to content

Commit

Permalink
✨ feat: 新用户默认使用昵称作为备注
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonBegonia committed Jul 28, 2021
1 parent 0e0a394 commit 427cf85
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ Ninja 仅支持 qinglong 2.8+

- [x] 扫码,跳转登录添加/更新 cookie
- [x] 添加/更新 cookie 后发送通知
- [x] 扫码发送通知可关闭
- [x] 添加备注并将通知中的 pt_pin nickName 修改为备注
- [x] 默认备注为昵称
- [ ] 替换 cookie 失效通知
- [ ] 添加扫码关注通知
- [ ] 扫码发送通知可关闭
- [ ] 添加扫码推送卡片
- [ ] 登录界面展示自定义标语

## 文档

Expand Down Expand Up @@ -86,7 +88,8 @@ Ninja 仅支持 qinglong 2.8+

```bash
cd /ql/ninja/backend
git pull -f
git checkout .
git pull
pnpm install
pm2 start
cp sendNotify.js /ql/scripts/sendNotify.js
Expand All @@ -98,6 +101,8 @@ Ninja 仅支持 qinglong 2.8+

- `ALLOW_ADD`: 是否允许添加账号 不允许添加时则只允许已有账号登录(默认 `true`
- `ALLOW_NUM`: 允许添加账号的最大数量(默认 `40`
- `PORT`: Ninja 运行端口(默认 `5700`
- `NOTIFY`: 是否开启通知功能(默认 `true`

配置方式:

Expand Down
3 changes: 2 additions & 1 deletion backend/ql.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports.getEnvsCount = async () => {
return data.length;
};

module.exports.addEnv = async (cookie) => {
module.exports.addEnv = async (cookie, remarks) => {
const token = await getToken();
const body = await api({
method: 'post',
Expand All @@ -48,6 +48,7 @@ module.exports.addEnv = async (cookie) => {
json: {
name: 'JD_COOKIE',
value: cookie,
remarks,
},
headers: {
Accept: 'application/json',
Expand Down
3 changes: 2 additions & 1 deletion backend/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ module.exports = class User {
} else if (poolInfo.marginCount === 0) {
throw new UserError('本站已到达注册上限,你来晚啦', 211, 200);
} else {
const body = await addEnv(this.cookie);
const remarks = `remark=${this.nickName};`;
const body = await addEnv(this.cookie, remarks);
if (body.code !== 200) {
throw new UserError(body.message || '添加账户错误,请重试', 220, body.code || 200);
}
Expand Down

0 comments on commit 427cf85

Please sign in to comment.