西海岸版本不调用能力云图中的组件服务的调用趋势和总调用次数接口

This commit is contained in:
851673013@qq.com 2022-07-01 18:59:46 +08:00
parent 6550188e13
commit 40804a7b9d
1 changed files with 43 additions and 32 deletions

View File

@ -121,6 +121,7 @@
totalCallsSnum, totalCallsSnum,
} from '@/api/capabilityCloud' } from '@/api/capabilityCloud'
import * as moment from 'moment' import * as moment from 'moment'
let xinhaianIsShow = whoShow.itShowXiHaiAn //西
let snum = ref([ let snum = ref([
{ title: '上架总量', num: '0000' }, { title: '上架总量', num: '0000' },
{ title: '总调用次数(API)', num: '0' }, { title: '总调用次数(API)', num: '0' },
@ -153,18 +154,22 @@
(Date.parse(new Date()) - 168 * 60 * 60 * 1000) / 1000 (Date.parse(new Date()) - 168 * 60 * 60 * 1000) / 1000
) )
const end = Date.parse(new Date()) / 1000 const end = Date.parse(new Date()) / 1000
callTheTrendPort(start, end, 86400).then((res) => { if (!xinhaianIsShow) {
if (res.data.data.result) { callTheTrendPort(start, end, 86400).then((res) => {
res.data.data.result[0].values.splice(0, 1) if (res.data.data.result) {
res.data.data.result[0].values.map((item) => { res.data.data.result[0].values.splice(0, 1)
callTheTrendData.value.snum.push(parseInt(item[1])) res.data.data.result[0].values.map((item) => {
}) callTheTrendData.value.snum.push(parseInt(item[1]))
callTheTrend(callTheTrendData.value) })
} else { callTheTrend(callTheTrendData.value)
callTheTrendData.value.snum = ['0', '0', '0', '0', '0', '0', '0'] } else {
callTheTrend(callTheTrendData.value) callTheTrendData.value.snum = ['0', '0', '0', '0', '0', '0', '0']
} callTheTrend(callTheTrendData.value)
}) }
})
} else {
callTheTrend(callTheTrendData.value)
}
} else { } else {
for (let i = 0; i < 31; i++) { for (let i = 0; i < 31; i++) {
let time = moment() let time = moment()
@ -177,24 +182,28 @@
(Date.parse(new Date()) - 720 * 60 * 60 * 1000) / 1000 (Date.parse(new Date()) - 720 * 60 * 60 * 1000) / 1000
) )
const end = Date.parse(new Date()) / 1000 const end = Date.parse(new Date()) / 1000
callTheTrendPort(start, end, 86400).then((res) => { if (!xinhaianIsShow) {
if (res.data.data.result) { callTheTrendPort(start, end, 86400).then((res) => {
// res.data.data.result.splice(0, 1) if (res.data.data.result) {
callTheTrendData.value.snum = [] // res.data.data.result.splice(0, 1)
res.data.data.result[0].values.map((item) => { callTheTrendData.value.snum = []
callTheTrendData.value.snum.push( res.data.data.result[0].values.map((item) => {
moment(item[0] * 1000).format('MM-DD') callTheTrendData.value.snum.push(
) moment(item[0] * 1000).format('MM-DD')
callTheTrendData.value.snum.push(parseInt(item[1])) )
}) callTheTrendData.value.snum.push(parseInt(item[1]))
callTheTrend(callTheTrendData.value) })
} else { callTheTrend(callTheTrendData.value)
for (let i = 0; i < 30; i++) { } else {
callTheTrendData.value.snum.push('0') for (let i = 0; i < 30; i++) {
callTheTrendData.value.snum.push('0')
}
callTheTrend(callTheTrendData.value)
} }
callTheTrend(callTheTrendData.value) })
} } else {
}) callTheTrend(callTheTrendData.value)
}
} }
} }
//echarts //echarts
@ -355,9 +364,11 @@
// //
const TotalCallsAPI = () => { const TotalCallsAPI = () => {
const end = Date.parse(new Date()) / 1000 const end = Date.parse(new Date()) / 1000
totalCallsSnum(end).then((res) => { if (!xinhaianIsShow) {
snum.value[1].num = res.data.data.result[0].value[1] totalCallsSnum(end).then((res) => {
}) snum.value[1].num = res.data.data.result[0].value[1]
})
}
} }
const init = () => { const init = () => {
timeSwitch(timeSwitchindex.value) timeSwitch(timeSwitchindex.value)