小程序接入支付功能

This commit is contained in:
Yeomai committed 2026-09-29 01:14:24 +08:00
1 parent edf1e51846
commit 07a90e860d
38 files changed
+3644 -90

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
// 激活码生成:16 位、4 组、80 位随机
// 字符表去掉了容易看错的 I/L/O/U,正好 32 个,刚好整除 256,取模不偏
const crypto = require('crypto')
const ALPHABET = '0123456789ABCDEFGHJKMNPQRSTVWXYZ'
function newActivationCode() {
const raw = Array.from(crypto.randomBytes(16), (b) => ALPHABET[b % ALPHABET.length]).join('')
return (raw.match(/.{4}/g) || []).join('-')
}
module.exports = { newActivationCode, ALPHABET }