|
|
@@ -70,15 +70,33 @@ async function refresh() {
|
|
|
}
|
|
|
|
|
|
async function codeStatistics() {
|
|
|
- tableData.value = await http.get(`/task/codeStatistics`)
|
|
|
- balanceData.value = await http.get(`/task/balanceStatistics`)
|
|
|
- tableData.value.forEach((item) => {
|
|
|
- if (balanceData.value.hasOwnProperty(item.channel)) {
|
|
|
- item.balance = balanceData.value[item.channel]
|
|
|
- } else {
|
|
|
- item.balance = '-'
|
|
|
- }
|
|
|
- })
|
|
|
+ const quantityResponse = await http.get('/task/codeStatistics')
|
|
|
+ const balanceResponse = await http.get('/task/balanceStatistics')
|
|
|
+
|
|
|
+ // 将余额数据转为 Map,方便后续快速查找
|
|
|
+ const balanceMap = new Map(Object.entries(balanceResponse))
|
|
|
+
|
|
|
+ // 遍历数量数据,将数量和余额合并
|
|
|
+ quantityResponse.forEach((item) => {
|
|
|
+ const balance = balanceMap.get(item.channel)
|
|
|
+ tableData.value.push({
|
|
|
+ channel: item.channel,
|
|
|
+ todayData: parseInt(item.todayData, 10) || 0,
|
|
|
+ yesterdayData: parseInt(item.yesterdayData, 10) || 0,
|
|
|
+ balance: balance !== undefined ? parseInt(balance, 10) : '-',
|
|
|
+ });
|
|
|
+
|
|
|
+ balanceMap.delete(item.channel);
|
|
|
+ });
|
|
|
+
|
|
|
+ for (const [channel, balance] of balanceMap) {
|
|
|
+ tableData.value.push({
|
|
|
+ channel,
|
|
|
+ todayData: 0,
|
|
|
+ yesterdayData: 0,
|
|
|
+ balance: parseInt(balance, 10),
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
async function hourSentStatistics() {
|