fix: resolve quality audit issues

- utils.js: force UTC+8 output to match MySQL timezone on SCF
- admin subscriptions: return stats (plan counts + revenue) in response
- admin devices: implement keyword search filter
- device-detail: fix binding history field names (bind_time/unbind_time/bind_status)
- user-detail: fix treatment time field (start_time not started_at)
- dashboard: show actual mode per treatment, use sub_stats from dashboard API
这个提交包含在:
Guoguo
2026-04-29 05:37:36 -07:00
父节点 8d1cde8636
当前提交 9f0e629c82
修改 5 个文件,包含 28 行新增15 行删除
+4 -6
查看文件
@@ -64,7 +64,7 @@
<text class="t-td" style="flex:2">{{ item.nickname || item.user_id || '-' }}</text>
<text class="t-td" style="flex:2">{{ item.device_id || '-' }}</text>
<text class="t-td" style="flex:1">
<text class="badge badge-blue"> 智能模式</text>
<text :class="item.mode === 1 ? 'badge badge-blue' : 'badge badge-warning'">{{ item.mode === 1 ? '✨ 智能' : '🔄 普通' }}</text>
</text>
<text class="t-td" style="flex:1">{{ Math.floor((item.total_duration_ms || 0) / 60000) }}</text>
<text class="t-td" style="flex:2">{{ formatDate(item.start_time || item.started_at) }}</text>
@@ -128,7 +128,9 @@ export default {
methods: {
async loadDashboard() {
try {
this.stats = await get('/api/v1/admin/dashboard')
const dashboard = await get('/api/v1/admin/dashboard')
this.stats = dashboard
if (dashboard.sub_stats) this.subStats = dashboard.sub_stats
} catch (e) {
uni.showToast({ title: '加载失败', icon: 'none' })
}
@@ -138,10 +140,6 @@ export default {
} catch (e) {
this.recentTreatments = []
}
try {
const subData = await get('/api/v1/admin/subscriptions', { page: 1, page_size: 1, tab: 'all' })
if (subData.stats) this.subStats = subData.stats
} catch (e) {}
},
formatDate: formatDateUtil,
onNav(path) {
@@ -61,11 +61,11 @@
<view class="t-body">
<view class="t-row" v-for="(b, idx) in device.binding_history" :key="idx">
<text class="t-td flex2">{{ b.nickname || '-' }}</text>
<text class="t-td flex2">{{ formatDate(b.bound_at) }}</text>
<text class="t-td flex2">{{ b.unbound_at ? formatDate(b.unbound_at) : '-' }}</text>
<text class="t-td flex2">{{ formatDate(b.bind_time) }}</text>
<text class="t-td flex2">{{ b.unbind_time ? formatDate(b.unbind_time) : '-' }}</text>
<text class="t-td flex1">
<text :class="b.status === 1 ? 'badge badge-success' : 'badge badge-default'">
{{ b.status === 1 ? '有效' : '已解绑' }}
<text :class="b.bind_status === 1 ? 'badge badge-success' : 'badge badge-default'">
{{ b.bind_status === 1 ? '有效' : '已解绑' }}
</text>
</text>
</view>
@@ -67,7 +67,7 @@
</view>
<view class="t-body">
<view class="t-row" v-for="(t, idx) in user.recent_treatments" :key="idx">
<text class="t-td flex2">{{ formatDate(t.started_at) }}</text>
<text class="t-td flex2">{{ formatDate(t.start_time) }}</text>
<text class="t-td flex1">{{ Math.floor((t.total_duration_ms || 0) / 60000) }}分钟</text>
<text class="t-td flex2">{{ t.device_id || '-' }}</text>
</view>