Skip to content

Commit

Permalink
confidential printing
Browse files Browse the repository at this point in the history
  • Loading branch information
vv314 committed Oct 8, 2024
1 parent 7a94aba commit 8cee522
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Notifier from './src/notifier/index.js'
import { parseToken } from './src/user.js'
import updateNotifier from './src/update-notifier.js'
import { grabCoupons } from './src/coupons/index.js'
import { readPkgJson } from './src/util/index.js'
import { maskNickName, readPkgJson } from './src/util/index.js'

const { version: currentVersion } = readPkgJson()

Expand Down Expand Up @@ -167,7 +167,7 @@ async function doJob(account, progress) {
const { coupons, userInfo } = res.data

console.log(...coupons)
console.log(`\n红包已放入账号:${userInfo.nickName}`)
console.log(`\n红包已放入账号:${maskNickName(userInfo.nickName)}`)
console.log(`\n🎉 领取成功!`)

const message = stringifyCoupons(coupons)
Expand Down
4 changes: 2 additions & 2 deletions src/coupons/gundam.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fetch from '../fetch.js'
import { dateFormat } from '../util/index.js'
import { dateFormat, removePhoneRestriction } from '../util/index.js'
import { getTemplateData, matchMoudleData } from '../template.js'
import { ECODE } from './const.js'

Expand Down Expand Up @@ -72,7 +72,7 @@ function formatCoupons(coupons, actName) {
etime,
amount: item.couponAmount,
amountLimit,
useCondition: item.useCondition,
useCondition: removePhoneRestriction(item.useCondition),
actName: actName
}
})
Expand Down
17 changes: 16 additions & 1 deletion src/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,19 @@ function dateFormat(date) {
})
}

export { dateFormat, groupBy, readPkgJson, replacePhoneNumber }
function maskNickName(nickName) {
return nickName.replace(/^(.).*(.)$/, '$1***$2')
}

function removePhoneRestriction(text) {
return text.replace(/限登录手机号为\d{3}\*\*\*\*\d{4}使用。/, '')
}

export {
dateFormat,
groupBy,
readPkgJson,
replacePhoneNumber,
maskNickName,
removePhoneRestriction
}

0 comments on commit 8cee522

Please sign in to comment.