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 行删除
+26 -1
查看文件
@@ -31,7 +31,32 @@ Page({
},
onManageDevice: function () {
wx.navigateTo({ url: '/pages/scan/scan' })
var self = this
if (this.data.deviceCount > 0) {
wx.showActionSheet({
itemList: ['解绑当前设备'],
success: function (res) {
if (res.tapIndex === 0) {
wx.showModal({
title: '确认解绑',
content: '解绑后将无法使用该设备,确定要解绑吗?',
success: function (modalRes) {
if (modalRes.confirm) {
http.post('/api/v1/device/unbind', {}).then(function () {
wx.showToast({ title: '已解绑', icon: 'success' })
self.loadProfile()
}).catch(function (err) {
wx.showToast({ title: err.message || '解绑失败', icon: 'none' })
})
}
}
})
}
}
})
} else {
wx.navigateTo({ url: '/pages/scan/scan' })
}
},
onViewSubscription: function () {
+2
查看文件
@@ -20,6 +20,8 @@
<view class="menu-item" bindtap="onManageDevice">
<view class="menu-icon">📱</view>
<view class="menu-text">我的设备</view>
<text class="menu-device-status" wx:if="{{deviceCount > 0}}">已绑定</text>
<text class="menu-device-status menu-device-unbound" wx:else>未绑定</text>
<text class="menu-arrow"></text>
</view>
<view class="menu-item" bindtap="onViewHistory">
+9
查看文件
@@ -98,6 +98,15 @@
font-size: 32rpx;
}
.menu-device-status {
font-size: 24rpx;
color: #52c41a;
margin-right: 8rpx;
}
.menu-device-unbound {
color: #999;
}
.logout-btn {
text-align: center;
color: #ff4d4f;