fix: resolve 8 bugs and add admin features

Miniprogram:
- Profile "我的设备": show unbind option when device bound, scan when not
- Add device status indicator (已绑定/未绑定) to profile menu

Admin console:
- Login: add @confirm to inputs so Enter key submits the form
- Record detail: wire up 详情 link with modal showing full record info
- Dashboard: add subscription stats row (月卡/年卡/试用/收入)
- Subscription: add 取消 action for active subscriptions
- Format: fix -8h timezone display for UTC ISO date strings

Server:
- POST /api/v1/admin/subscriptions/cancel: cancel active subscriptions
- Dashboard API: include sub_stats (plan counts + monthly revenue)
- IP extraction: add X-Forwarded-For fallback for logging
这个提交包含在:
Guoguo
2026-04-29 05:33:12 -07:00
父节点 775112130d
当前提交 8d1cde8636
修改 10 个文件,包含 144 行新增8 行删除
+12
查看文件
@@ -1,9 +1,21 @@
export function formatDate(d) {
if (!d) return '--'
if (d instanceof Date || (typeof d === 'string' && d.includes('T') && d.endsWith('Z'))) {
var date = new Date(d)
if (isNaN(date.getTime())) return '--'
var pad = function(n) { return String(n).padStart(2, '0') }
return date.getFullYear() + '-' + pad(date.getMonth() + 1) + '-' + pad(date.getDate()) + ' ' + pad(date.getHours()) + ':' + pad(date.getMinutes()) + ':' + pad(date.getSeconds())
}
return String(d).slice(0, 19).replace('T', ' ')
}
export function formatDateShort(d) {
if (!d) return '--'
if (d instanceof Date || (typeof d === 'string' && d.includes('T') && d.endsWith('Z'))) {
var date = new Date(d)
if (isNaN(date.getTime())) return '--'
var pad = function(n) { return String(n).padStart(2, '0') }
return date.getFullYear() + '-' + pad(date.getMonth() + 1) + '-' + pad(date.getDate())
}
return String(d).slice(0, 10)
}