feat: update service port and points display
This commit is contained in:
1 parent
804e539932
commit
2553e482a9
6 files changed
+14
-10
No files matched your search
@@ -1,4 +1,4 @@
|
||||
PORT=3000
|
||||
PORT=9000
|
||||
HOST=127.0.0.1
|
||||
EXTERNAL_POSTGRES_HOST=localhost
|
||||
EXTERNAL_POSTGRES_PORT=5432
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
PORT=3000
|
||||
PORT=9000
|
||||
HOST=0.0.0.0
|
||||
APP_BASE_URL=http://localhost:3000
|
||||
APP_BASE_URL=http://localhost:9000
|
||||
ADMIN_USERNAME=admin
|
||||
ADMIN_PASSWORD=admin123456
|
||||
# 首次启动后,管理员密码以数据库中的值为准。
|
||||
|
||||
@@ -29,8 +29,8 @@ bun run start
|
||||
& 'C:\Users\11937\.bun\bin\bun.exe' run start
|
||||
```
|
||||
|
||||
- 收银台:<http://localhost:3000/pay>
|
||||
- 管理后台:<http://localhost:3000/admin>
|
||||
- 收银台:<http://localhost:9000/pay>
|
||||
- 管理后台:<http://localhost:9000/admin>
|
||||
- 初始账户:`admin`
|
||||
- 初始密码:`admin123456`
|
||||
|
||||
@@ -41,7 +41,7 @@ bun run start
|
||||
把用户重定向到:
|
||||
|
||||
```text
|
||||
http://localhost:3000/pay?user_id=USER10001&merchant_order_no=ORDER202610310001&subject=账户充值¬ify_url=https%3A%2F%2Fmerchant.example.com%2Fpayment%2Fnotify&return_url=https%3A%2F%2Fmerchant.example.com%2Fresult
|
||||
http://localhost:9000/pay?user_id=USER10001&merchant_order_no=ORDER202610310001&subject=账户充值¬ify_url=https%3A%2F%2Fmerchant.example.com%2Fpayment%2Fnotify&return_url=https%3A%2F%2Fmerchant.example.com%2Fresult
|
||||
```
|
||||
|
||||
参数:
|
||||
|
||||
@@ -48,6 +48,6 @@
|
||||
<div class="history-table-wrap"><table><thead><tr><th>充值时间</th><th>订单号</th><th>支付渠道</th><th>充值金额</th><th>获得积分</th></tr></thead><tbody id="historyBody"></tbody></table></div>
|
||||
</section>
|
||||
<footer class="checkout-footer"><span>支付过程受签名验证与金额校验保护</span><span>如有疑问请联系商户</span></footer>
|
||||
<script src="/assets/checkout.js?v=20261102-cashierqr" defer></script>
|
||||
<script src="/assets/checkout.js?v=20261102-quota5000" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
+6
-2
@@ -14,6 +14,10 @@ function showInvalidUser(value) { $('#userGate').classList.add('hidden'); $('#ch
|
||||
function channelName(channel) { return ({ alipay: '支付宝', wechat: '微信支付', mock: '本地模拟' })[channel] || channel; }
|
||||
function channelIcon(channel) { return channel === 'alipay' ? '支' : channel === 'wechat' ? '微' : 'M'; }
|
||||
function formatTime(value) { return new Date(value).toLocaleString('zh-CN', { hour12: false }); }
|
||||
function formatAvailablePoints(value) {
|
||||
const quota = Number(value ?? 0);
|
||||
return Math.ceil((Number.isFinite(quota) ? quota : 0) / 5000).toLocaleString('zh-CN');
|
||||
}
|
||||
|
||||
function syncAmount() {
|
||||
const amount = state.selectedPackage ? (state.selectedPackage.amount_cents / 100).toFixed(2) : '0.00';
|
||||
@@ -59,7 +63,7 @@ async function init() {
|
||||
const response = await fetch(`/api/checkout/users/${encodeURIComponent(userId)}`); const data = await response.json();
|
||||
if (!response.ok) return showInvalidUser(userId);
|
||||
state.user = data.user; state.packages = data.packages;
|
||||
$('#userName').textContent = data.user.username || data.user.displayName; $('#userAvatar').textContent = (data.user.username || data.user.displayName || data.user.id).slice(0, 1).toUpperCase(); $('#pointsBalance').textContent = Number(data.user.quota ?? 0).toLocaleString('zh-CN');
|
||||
$('#userName').textContent = data.user.username || data.user.displayName; $('#userAvatar').textContent = (data.user.username || data.user.displayName || data.user.id).slice(0, 1).toUpperCase(); $('#pointsBalance').textContent = formatAvailablePoints(data.user.quota);
|
||||
renderPackages(); renderHistory(data.history); await loadGateways(); syncAmount();
|
||||
$('#userGate').classList.add('hidden'); $('#checkoutMain').classList.remove('hidden'); $('#historyPanel').classList.remove('hidden');
|
||||
} catch { showInvalidUser(userId); }
|
||||
@@ -97,7 +101,7 @@ async function checkStatus() {
|
||||
async function refreshUserBalance() {
|
||||
try {
|
||||
const data = await fetch(`/api/checkout/users/${encodeURIComponent(state.user.id)}`).then((response) => response.json());
|
||||
if (data.user) { state.user = { ...state.user, ...data.user }; $('#pointsBalance').textContent = Number(data.user.quota ?? 0).toLocaleString('zh-CN'); }
|
||||
if (data.user) { state.user = { ...state.user, ...data.user }; $('#pointsBalance').textContent = formatAvailablePoints(data.user.quota); }
|
||||
} catch { /* 保留最后一次已加载的额度 */ }
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import { creditExternalUserQuota, getExternalUser, refundExternalUserQuota, sear
|
||||
await initializeDatabase();
|
||||
|
||||
const host = process.env.HOST || "0.0.0.0";
|
||||
const port = Number(process.env.PORT || 3000);
|
||||
const port = Number(process.env.PORT || 9000);
|
||||
const appBaseUrl = (process.env.APP_BASE_URL || `http://localhost:${port}`).replace(/\/$/, "");
|
||||
const publicDir = `${process.cwd()}\\public`;
|
||||
const providerQueryTimes = new Map<string, number>();
|
||||
|
||||
Reference in new issue
Block a user