|
|
@@ -74,6 +74,10 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+
|
|
|
+ <div class="data-table">
|
|
|
+ <vue-json-pretty :data="prettyData" :indent="prettyIndent" :deep="prettyDeep"></vue-json-pretty>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -81,11 +85,19 @@
|
|
|
import { ref, onMounted } from 'vue';
|
|
|
import { requestClient } from '#/api/request';
|
|
|
|
|
|
+import dayjs from 'dayjs';
|
|
|
+import VueJsonPretty from 'vue-json-pretty';
|
|
|
+import 'vue-json-pretty/lib/styles.css';
|
|
|
+
|
|
|
const currentTime = ref('');
|
|
|
const gamesRelation = ref([]);
|
|
|
const gamesSolution = ref({});
|
|
|
const selectedTestMode = ref('1');
|
|
|
|
|
|
+const prettyData = ref(null);
|
|
|
+const prettyIndent = ref(2);
|
|
|
+const prettyDeep = ref(0);
|
|
|
+
|
|
|
const updateTime = () => {
|
|
|
currentTime.value = new Date().toLocaleString('zh-CN')
|
|
|
}
|
|
|
@@ -104,20 +116,27 @@ const refreshData = () => {
|
|
|
}
|
|
|
|
|
|
const runTest = () => {
|
|
|
+ const gamesList = gamesRelation.value.map(item => {
|
|
|
+ const { eventId, leagueId, leagueName, teamHomeName, teamAwayName, timestamp } = item?.rel?.ps ?? {};
|
|
|
+ const datetime = dayjs(timestamp).format('YYYY-MM-DD HH:mm:ss');
|
|
|
+ return { eventId, leagueId, leagueName, teamHomeName, teamAwayName, datetime };
|
|
|
+ });
|
|
|
gamesSolution.value.solutions.forEach((solution) => {
|
|
|
- const { info: { id }} = solution;
|
|
|
- const relation = gamesRelation.value.find((relation) => relation.id === id);
|
|
|
- if (!relation) {
|
|
|
- console.log('relation not found', id);
|
|
|
+ const { sid, info: { id }} = solution;
|
|
|
+ const currentGame = gamesList.find(game => game.eventId === id);
|
|
|
+ if (!currentGame) {
|
|
|
+ console.log('game not found', id);
|
|
|
}
|
|
|
else {
|
|
|
- if (!relation.solutions) {
|
|
|
- relation.solutions = [];
|
|
|
+ if (!currentGame.solutions) {
|
|
|
+ currentGame.solutions = [];
|
|
|
}
|
|
|
- relation.solutions.push(solution);
|
|
|
+ currentGame.solutions.push(sid);
|
|
|
}
|
|
|
});
|
|
|
- console.log('gamesRelation', gamesRelation);
|
|
|
+ prettyData.value = gamesList;
|
|
|
+ prettyDeep.value = 2;
|
|
|
+ // console.log('gamesRelation', gamesList);
|
|
|
}
|
|
|
|
|
|
const verifyData = () => {
|
|
|
@@ -129,7 +148,9 @@ const verifyData = () => {
|
|
|
invalidSolutions.push(solution)
|
|
|
}
|
|
|
});
|
|
|
- console.log('invalidSolutions', invalidSolutions);
|
|
|
+ prettyData.value = invalidSolutions;
|
|
|
+ prettyDeep.value = 2;
|
|
|
+ // console.log('invalidSolutions', invalidSolutions);
|
|
|
}
|
|
|
|
|
|
const filterLive = () => {
|
|
|
@@ -138,7 +159,9 @@ const filterLive = () => {
|
|
|
const { info: { ob, hg, ps } } = solution;
|
|
|
return ps.stage;
|
|
|
});
|
|
|
- console.log('liveSolutions', liveSolutions);
|
|
|
+ prettyData.value = liveSolutions;
|
|
|
+ prettyDeep.value = 2;
|
|
|
+ // console.log('liveSolutions', liveSolutions);
|
|
|
}
|
|
|
|
|
|
// const currentTime = ref('')
|
|
|
@@ -283,4 +306,7 @@ onMounted(() => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+.data-table {
|
|
|
+ padding: 20px;
|
|
|
+}
|
|
|
</style>
|