|
|
@@ -92,7 +92,7 @@ import { mapGetters } from 'vuex'
|
|
|
import Breadcrumb from '@/components/Breadcrumb'
|
|
|
import Hamburger from '@/components/Hamburger'
|
|
|
import setPassword from './setPassword.vue'
|
|
|
-import { getPaymentOrderUnProcessed, getOnlineUsers } from '@/api/data'
|
|
|
+import { getPaymentOrderUnProcessed, getPlatformCount } from '@/api/data'
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
@@ -174,18 +174,15 @@ export default {
|
|
|
},
|
|
|
// 拉取在线用户并按平台统计
|
|
|
fetchOnlineCounts() {
|
|
|
- getOnlineUsers({ page: 1, limit: 200 })
|
|
|
+ getPlatformCount()
|
|
|
.then(res => {
|
|
|
- const counts = { mobile: 0, pc: 0, ios: 0, android: 0 }
|
|
|
- const rows = (res.data && res.data.data) || []
|
|
|
- rows.forEach(r => {
|
|
|
- const p = String(r.platform || '').toLowerCase()
|
|
|
- if (p === 'pc') counts.pc++
|
|
|
- else if (p === 'ios') counts.ios++
|
|
|
- else if (p === 'android') counts.android++
|
|
|
- else counts.mobile++ // Mobile / WeChat 等归入移动
|
|
|
- })
|
|
|
- this.onlineCounts = counts
|
|
|
+ const d = (res.data) || {}
|
|
|
+ this.onlineCounts = {
|
|
|
+ mobile: Number(d.mobile || 0) + Number(d.wechat || 0) + Number(d.unknown || 0),
|
|
|
+ pc: Number(d.pc || 0),
|
|
|
+ ios: Number(d.apple || 0),
|
|
|
+ android: Number(d.android || 0)
|
|
|
+ }
|
|
|
})
|
|
|
.catch(() => {})
|
|
|
},
|