dsh-tokenbank 0.1.23 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +23 -14
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -425,9 +425,22 @@ window.__ModuleLoader__.load({
|
|
|
425
425
|
return String(Math.round(Number(n) || 0)).replace(/\B(?=(\d{3})+(?!\d))/g, ',')
|
|
426
426
|
}
|
|
427
427
|
/** 当前档位提示:用户固定的四组文案。 */
|
|
428
|
-
var RECHARGE_HINTS = { 1000:
|
|
429
|
-
function
|
|
430
|
-
|
|
428
|
+
var RECHARGE_HINTS = { 1000: 38460000, 5000: 192300000, 10000: 384600000, 30000: 1154000000 }
|
|
429
|
+
function pickedCredit(fen) {
|
|
430
|
+
var list = packs[0] || []
|
|
431
|
+
for (var i = 0; i < list.length; i++) {
|
|
432
|
+
if (list[i].fen === fen && typeof list[i].creditNano === 'number') return list[i].creditNano
|
|
433
|
+
}
|
|
434
|
+
return undefined
|
|
435
|
+
}
|
|
436
|
+
function rechargeHint(fen, creditNano) {
|
|
437
|
+
var tokens = (typeof creditNano === 'number' && creditNano > 0) ? Math.round(creditNano / 1e6) : RECHARGE_HINTS[fen]
|
|
438
|
+
// tokens 单位:万。creditNano 是 nanoUSD,1 TOKEN≈1e6 nano
|
|
439
|
+
var usd = (creditNano ? creditNano / 1e9 : (fen / 100 / 6.5)).toFixed(2)
|
|
440
|
+
return '获得 $' + usd + ' | 约 ' + humanTokens(tokens) + ' TOKEN'
|
|
441
|
+
}
|
|
442
|
+
function humanTokens(wan) {
|
|
443
|
+
return wan >= 10000 ? (wan / 10000).toFixed(1).replace(/\.0$/, '') + '亿' : Math.round(wan) + '万'
|
|
431
444
|
}
|
|
432
445
|
|
|
433
446
|
/** 词元数 → "1.2亿"/"3.4万"/"5000"。 */
|
|
@@ -455,7 +468,7 @@ window.__ModuleLoader__.load({
|
|
|
455
468
|
if (!list || !list.length || !price || price <= 0) return
|
|
456
469
|
packs[1](list.map(function (pk) {
|
|
457
470
|
var nano = Number(pk.credit_nano_usd || 0) + Number(pk.bonus_nano_usd || 0)
|
|
458
|
-
return { fen: Number(pk.cny_fen), usd: nano / 1e9, tokens: nano / price }
|
|
471
|
+
return { fen: Number(pk.cny_fen), usd: nano / 1e9, tokens: nano / price, creditNano: nano }
|
|
459
472
|
}).filter(function (pk) { return pk.fen !== 50000 }))
|
|
460
473
|
}).catch(function () {})
|
|
461
474
|
return function () { stopped = true }
|
|
@@ -520,11 +533,7 @@ window.__ModuleLoader__.load({
|
|
|
520
533
|
{ fen: 1000 }, { fen: 5000 }, { fen: 10000 }, { fen: 30000 },
|
|
521
534
|
]).map(function (pk) {
|
|
522
535
|
var label
|
|
523
|
-
|
|
524
|
-
label = '¥' + (pk.fen / 100) + '($' + pk.usd.toFixed(2) + ')'
|
|
525
|
-
} else {
|
|
526
|
-
label = '¥' + (pk.fen / 100)
|
|
527
|
-
}
|
|
536
|
+
label = '¥' + (pk.fen / 100)
|
|
528
537
|
return h('button', {
|
|
529
538
|
key: pk.fen, type: 'button',
|
|
530
539
|
style: Object.assign({}, buttonStyle, {
|
|
@@ -542,7 +551,7 @@ window.__ModuleLoader__.load({
|
|
|
542
551
|
err[0] ? h('span', { style: { color: '#d54941' } }, err[0]) : null,
|
|
543
552
|
) : null,
|
|
544
553
|
h('div', { style: { fontSize: 12, color: 'var(--dsw-alias-label-secondary, #888)', textAlign: 'center' } },
|
|
545
|
-
rechargeHint(picked[0])),
|
|
554
|
+
rechargeHint(picked[0], pickedCredit(picked[0]))),
|
|
546
555
|
h('div', {
|
|
547
556
|
style: {
|
|
548
557
|
padding: 10, borderRadius: 8,
|
|
@@ -558,7 +567,7 @@ window.__ModuleLoader__.load({
|
|
|
558
567
|
'$1 = ¥6.50',
|
|
559
568
|
h('span', { style: { background: '#ff4f1f', color: '#fff', borderRadius: 4, padding: '1px 5px', fontSize: 11, fontWeight: 700 } }, '最优惠'))),
|
|
560
569
|
h('div', { style: { display: 'flex', justifyContent: 'space-between' } },
|
|
561
|
-
h('span', null, 'OpenAI/Anthropic
|
|
570
|
+
h('span', null, 'OpenAI/Anthropic'),
|
|
562
571
|
h('span', null, '$1 = ¥7.25 ~ 7.45')),
|
|
563
572
|
h('div', { style: { display: 'flex', justifyContent: 'space-between' } },
|
|
564
573
|
h('span', null, '国内中转站均价'),
|
|
@@ -643,7 +652,7 @@ window.__ModuleLoader__.load({
|
|
|
643
652
|
h('span', { style: { flex: 1 } }),
|
|
644
653
|
data && data.loggedIn ? h('button', {
|
|
645
654
|
type: 'button', title: pageT('depositManageTip'),
|
|
646
|
-
style: Object.assign({}, buttonStyle, { height: 24, padding: '0 10px', fontSize: 12 }),
|
|
655
|
+
style: Object.assign({}, buttonStyle, { height: 24, padding: '0 10px', fontSize: 12, borderColor: 'var(--dsw-alias-border-l2, #c9ccd1)' }),
|
|
647
656
|
onClick: function () { tbStore.set({ authOpen: false }); openSettingsPage() },
|
|
648
657
|
}, pageT('depositManage')) : null,
|
|
649
658
|
data && data.loggedIn ? h('button', {
|
|
@@ -677,7 +686,7 @@ window.__ModuleLoader__.load({
|
|
|
677
686
|
data.account && typeof data.account.balance_nano_usd === 'number'
|
|
678
687
|
? '$' + (data.account.balance_nano_usd / 1e9).toFixed(2) : '—'),
|
|
679
688
|
h('span', { style: { display: 'inline-flex', gap: 6 } },
|
|
680
|
-
h('button', {
|
|
689
|
+
checkin[0].done && !(data.account && typeof data.account.balance_nano_usd === 'number' && data.account.balance_nano_usd < 1e9) ? null : h('button', {
|
|
681
690
|
type: 'button', disabled: checkin[0].busy || checkin[0].done,
|
|
682
691
|
style: Object.assign({}, buttonStyle, {
|
|
683
692
|
height: 26, padding: '0 12px', fontSize: 12,
|
|
@@ -703,7 +712,7 @@ window.__ModuleLoader__.load({
|
|
|
703
712
|
}
|
|
704
713
|
},
|
|
705
714
|
}, checkin[0].done ? pageT('checkinDone') : pageT('checkin')),
|
|
706
|
-
(data.account && typeof data.account.balance_nano_usd === 'number' && data.account.balance_nano_usd < 1e9)
|
|
715
|
+
(checkin[0].done || (data.account && typeof data.account.balance_nano_usd === 'number' && data.account.balance_nano_usd < 1e9))
|
|
707
716
|
? h('button', {
|
|
708
717
|
type: 'button',
|
|
709
718
|
style: Object.assign({}, primaryButtonStyle, { height: 26, padding: '0 12px', fontSize: 12 }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-tokenbank",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.25",
|
|
4
4
|
"description": "DSH 免费模型:一键注册 TokenBank 领免费 APIKey 送 $5 体验金,免费 GLM 模型直接进模型列表;自带余额查询、API Key 密钥托管(临时额度转永久)、每日签到、充值入口(支付宝),获取免费模型无需自建中转。致敬 dsh-our-free-model。官网 https://bank.skillpie.cn",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|