release(custom): i

This commit is contained in:
2023-10-10 15:01:00 +08:00
parent a9707c6d94
commit 5b33290de6
78 changed files with 13003 additions and 5230 deletions

View File

@@ -1,8 +1,17 @@
import { request } from '@/utils'
export default {
getData: () => request.post('/dice/getisStart'),
setStatus: (data) => request.post('/dice/isStart', data),
getDS: () => request.post('/dice/getBetting'),
setDS: (data) => request.post('/dice/setBetting', data),
getData: () => request.post('/getisStart'),
setStatus: (data) => request.post('/isStart', data),
getDS: () => request.post('/getBetting'),
setDS: (data) => request.post('/setBetting', data),
getKJList: () => request.post('/draw'),
// 获取统计
getStatistics: (data) => request.post('/user/betting/list', data),
// log
getLog: () => request.post('/log'),
// 宙斯详情
getDetail: (data) => request.post('/log/betting/list', data),
}

View File

@@ -1,7 +1,7 @@
<template>
<CommonPage show-footer :title="$route.title">
<div flex>
<div flex>
<div flex items-center>
<div mr-20 flex>
<div>游戏状态</div>
<n-switch
v-model:value="val1"
@@ -10,7 +10,11 @@
@update:value="handleUpdateValue1"
/>
</div>
<div ml-20 flex>
<div flex items-center>
<div>开奖记录</div>
<n-button type="primary" @click="openData">预览</n-button>
</div>
<!-- <div ml-20 flex>
<div>点杀状态</div>
<n-switch
v-model:value="val"
@@ -18,55 +22,119 @@
:unchecked-value="2"
@update:value="handleUpdateValue"
/>
</div>
</div> -->
</div>
<div flex>
<div>
预开期数
<span text-25>{{ list[0]?.periods || 0 }}</span>
<span text-25>{{ list[0]?.Periods || 0 }}</span>
</div>
<div ml-20>
剩余开奖时间
<span text-25>{{ time || 0 }}</span>
</div>
<div ml-20>
本局总下注
<span text-25>{{ totalA || 0 }}</span>
</div>
</div>
<div flex flex-wrap justify-between>
<n-spin size="large" :show="show">
<div flex flex-wrap justify-between>
<n-card
v-for="item in list"
:key="item.ID"
class="mb-10 mt-10 h-120 w-250 flex-shrink-0 cursor-pointer"
:title="item.name"
>
<p text-25 op-60 :style="{ color: item.count === 0 ? 'green' : 'red' }">
{{ item.count }}
</p>
</n-card>
<div h-0 w-250></div>
<div h-0 w-250></div>
</div>
</n-spin>
<n-spin size="large" :show="show1">
<div flex flex-wrap justify-between>
<n-card
v-for="item in list1"
:key="item.ID"
class="mb-10 mt-10 h-150 w-250 flex-shrink-0 cursor-pointer"
:title="`${item.NumName}(${item.Name})`"
>
<p text-25 op-60 :style="{ color: item.Total === 0 ? 'green' : 'red' }">
{{ item.Total }}
</p>
<n-popconfirm @positive-click="handleUpdateValue(item.ID)">
<template #trigger>
<n-button>你猜</n-button>
</template>
一切都将一去杳然任何人都无法将其捕获
</n-popconfirm>
</n-card>
<div h-0 w-250></div>
<div h-0 w-250></div>
<div h-0 w-250></div>
<div h-0 w-250></div>
</div>
</n-spin>
<!-- 开奖记录 -->
<n-modal v-model:show="showModal">
<n-card
v-for="item in list"
:key="item.ID"
class="mb-10 mt-10 w-300 flex-shrink-0 cursor-pointer"
:title="item.name"
style="width: 900px"
title="开奖记录"
:bordered="false"
size="huge"
role="dialog"
aria-modal="true"
>
<p text-25 op-60 :style="{ color: item.count === 0 ? 'green' : 'red' }">{{ item.count }}</p>
<n-data-table
:loading="loading"
:columns="columns"
:data="data"
:max-height="600"
:pagination="false"
:bordered="false"
/>
</n-card>
<div h-0 w-300></div>
<div h-0 w-300></div>
</div>
</n-modal>
</CommonPage>
</template>
<script setup>
import { h } from 'vue'
import api from '../api'
import { getToken } from '@/utils'
const ws = new WebSocket(`wss://${import.meta.env.VITE_WS_URL}`)
const ws1 = new WebSocket(`wss://${import.meta.env.VITE_WS1_URL}`)
const list = ref([])
const list1 = ref([])
const val1 = ref(null)
const val = ref(null)
// const val = ref(null)
const time = ref(null)
const show = ref(true)
const show1 = ref(true)
ws.onopen = () => {
console.log('1连接成功')
}
const totalA = ref(null)
ws.onmessage = (msg) => {
const res = JSON.parse(msg.data)
list.value = res
list.value = res.betting.sort((a, b) => b.Total - a.Total)
show.value = false
list1.value = res.list.sort((a, b) => b.Total - a.Total)
show1.value = false
totalA.value = res.total
}
ws1.onopen = () => {
@@ -87,14 +155,14 @@ ws1.onmessage = (msg) => {
}
onMounted(() => {
get_data()
// get_data()
get_data1()
})
const get_data = async () => {
const res = await api.getDS()
val.value = res.data.diceStatus
}
// const get_data = async () => {
// const res = await api.getDS()
// val.value = res.data.diceStatus
// }
const get_data1 = async () => {
const res = await api.getData()
val1.value = res.data.diceStart
@@ -106,10 +174,13 @@ onBeforeUnmount(() => {
const handleUpdateValue = async (e) => {
const res = await api.setDS({
status: e,
status: 1,
id: e,
user_id: getToken(),
Periods: list.value[0]?.Periods,
})
$message.success(res.msg)
get_data()
// get_data()
}
const handleUpdateValue1 = async (e) => {
@@ -119,6 +190,48 @@ const handleUpdateValue1 = async (e) => {
$message.success(res.msg)
get_data1()
}
const showModal = ref(false)
const loading = ref(false)
const columns = ref([
{
title: '期数',
key: 'Periods',
align: 'center',
},
{
title: '开奖号码',
key: 'Name',
align: 'center',
},
{
title: '开奖时间',
key: 'DrawTime',
align: 'center',
},
{
title: '开奖号码',
slot: 'Num',
align: 'center',
render: (row) => {
return h('p', `${row.Start}-${row.End}`)
},
},
])
const data = ref([])
const openData = async () => {
try {
showModal.value = true
loading.value = true
const res = await api.getKJList()
console.log(res)
data.value = res.data.data
loading.value = false
} catch (error) {
$message.error(error.msg)
throw error
}
}
</script>
<style lang="scss" scoped></style>

View File

@@ -5,6 +5,11 @@ export default {
path: '/game',
component: Layout,
redirect: '/game_data',
meta: {
title: '游戏管理',
icon: 'mdi:account-multiple',
order: 10,
},
children: [
{
name: 'Gamelist',
@@ -12,6 +17,27 @@ export default {
component: () => import('./data/index.vue'),
meta: {
title: '实时数据',
icon: 'mdi:account-multiple',
order: 10,
},
},
{
name: 'statistics',
path: 'game_statistics',
component: () => import('./statistics/index.vue'),
meta: {
title: '数据统计',
icon: 'mdi:account-multiple',
order: 10,
},
},
{
name: 'zs',
path: 'game_zs',
component: () => import('./zs/index.vue'),
meta: {
title: '宙斯统计',
icon: 'mdi:account-multiple',
order: 10,
},
},

View File

@@ -0,0 +1,250 @@
<template>
<CommonPage show-footer :title="$route.title">
<n-grid class="mb-10" x-gap="12" :cols="4">
<n-gi>
<n-date-picker
v-model:formatted-value="range"
value-format="yyyy-MM-dd"
type="daterange"
clearable
/>
</n-gi>
<n-gi>
<n-button type="primary" @click="getList">搜索</n-button>
<n-button ml-10 @click="clear">重置</n-button>
</n-gi>
</n-grid>
<!-- <n-grid class="mb-10" x-gap="12" :cols="3">
<n-gi>
<n-card>
<n-statistic label="总下注">
<n-number-animation :from="0" :to="TYVal.total" />
</n-statistic>
</n-card>
</n-gi>
<n-gi>
<n-card>
<n-statistic label="总赔付">
<n-number-animation :from="0" :to="TYVal.totalNum" />
</n-statistic>
</n-card>
</n-gi>
<n-gi>
<n-card>
<n-statistic label="总盈利">
<n-number-animation :from="0" :to="TYVal.total / 10 - TYVal.totalNum / 100" />
</n-statistic>
</n-card>
</n-gi>
</n-grid> -->
<div w-full flex items-center>
<Echarts :loading="loading" :option="option" />
<Echarts :loading="loading" :option="option1" />
</div>
<div w-full flex items-center justify-between>
<n-card title="开奖记录" :bordered="false" content-style="padding: 0;">
<n-data-table
:max-height="500"
:loading="loading"
:columns="columns"
:data="data"
:bordered="true"
:virtual-scroll="true"
remote
/>
</n-card>
</div>
</CommonPage>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import api from '../api.js'
import Echarts from '@/components/Echarts.vue'
import dayjs from 'dayjs'
const loading = ref(false)
const range = ref(null)
const option = ref({
title: {
text: '单期下注(豆子)/赔付(积分) 统计',
left: 'center',
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
},
// legend: {
// data: ['下注(豆子)', '赔付(积分)'],
// left: 'left',
// type: 'scroll',
// },
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true,
},
xAxis: {
type: 'category',
data: [],
},
yAxis: {
type: 'value',
},
series: [
{
name: '下注(豆子)',
data: [],
type: 'bar',
},
{
name: '赔付(积分)',
data: [],
type: 'bar',
},
],
dataZoom: [
{
type: 'inside',
},
{
type: 'slider',
},
],
})
const option1 = ref({
title: {
text: '总下注(豆子)/总赔付(积分)',
left: 'center',
},
tooltip: {
trigger: 'item',
},
legend: {
orient: 'vertical',
left: 'right',
},
series: [
{
type: 'pie',
radius: '50%',
data: [],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)',
},
},
},
],
})
const data = ref([])
const TYVal = ref({
total: 0,
totalNum: 0,
})
const columns = ref([
{
title: '期数',
key: 'Periods',
align: 'center',
},
{
title: '开奖号码',
key: 'Name',
align: 'center',
},
{
title: '下注',
key: 'NumberSum',
align: 'center',
},
{
title: '赔付',
key: 'TotalCount',
align: 'center',
},
{
title: '时间',
key: 'Date',
align: 'center',
},
])
onMounted(() => {
getList()
})
const clear = () => {
range.value = null
getList()
}
const getList = async () => {
loading.value = true
const dataObj = {
StartTime: dayjs().format('YYYY-MM-DD'),
EndTime: dayjs().format('YYYY-MM-DD'),
}
if (range.value) {
dataObj.StartTime = range.value[0]
dataObj.EndTime = range.value[1]
}
const res = await api.getStatistics(dataObj)
const newData = res.data.data || []
data.value = newData
TYVal.value = {
total: res.data.total,
totalNum: res.data.totalDices,
}
option.value.xAxis.data = []
option.value.series[0].data = []
option.value.series[1].data = []
option1.value.series[0].data = []
if (newData.length > 0) {
res.data.data.forEach((item) => {
const a = (
((res.data.total * 10) / (res.data.total * 10 + res.data.totalDices)) *
100
).toFixed(2)
const b = ((res.data.totalDices / (res.data.total * 10 + res.data.totalDices)) * 100).toFixed(
2
)
option.value.xAxis.data.push(`${item.Periods}期-${item.Name}`)
option.value.series[0].name = `下注(豆子): ${a}%`
option.value.series[0].data.push(item.NumberSum)
option.value.series[1].name = `赔付(积分): ${b}%`
option.value.series[1].data.push(item.TotalCount)
})
const a = (((res.data.total * 10) / (res.data.total * 10 + res.data.totalDices)) * 100).toFixed(
2
)
const b = ((res.data.totalDices / (res.data.total * 10 + res.data.totalDices)) * 100).toFixed(2)
option1.value.series[0].data.push({ value: res.data.total, name: `总下注: ${a}%` })
option1.value.series[0].data.push({
value: res.data.totalDices,
name: `总赔付: ${b}%`,
})
}
loading.value = false
}
</script>
<style lang="scss" scoped>
.chart {
width: 50%;
height: 400px;
}
</style>

189
src/views/game/zs/index.vue Normal file
View File

@@ -0,0 +1,189 @@
<template>
<CommonPage show-footer :title="$route.title">
<n-data-table
:max-height="500"
:loading="loading"
:columns="columns"
:data="data"
:bordered="true"
:virtual-scroll="true"
:pagination="pagination"
remote
/>
<!-- -->
<n-modal v-model:show="showModal">
<n-card
style="width: 800px"
title="宙斯的眷顾"
:bordered="false"
size="huge"
role="dialog"
aria-modal="true"
>
<n-data-table
:loading="zsLoading"
:columns="zsColumns"
:data="zsData"
:pagination="zsPagination"
:bordered="false"
/>
</n-card>
</n-modal>
</CommonPage>
</template>
<script setup>
import api from '../api.js'
import { NButton } from 'naive-ui'
import { h, ref, onMounted } from 'vue'
const loading = ref(false)
const columns = ref([
{
title: '期数',
key: 'periods',
align: 'center',
},
{
title: '开奖号码',
key: 'betting_name',
align: 'center',
},
{
title: '开奖数字',
key: 'betting_number',
align: 'center',
},
{
title: '操作人',
key: 'name',
align: 'center',
},
{
title: '开奖时间',
key: 'draw_time',
align: 'center',
},
{
title: '操作时间',
key: 'add_time',
align: 'center',
},
{
title: '操作IP',
key: 'ip',
align: 'center',
},
{
title: '操作',
slot: 'action',
align: 'center',
render: (row) => {
return [
h(
NButton,
{
strong: true,
secondary: true,
onClick: () => {
openModal(row)
},
},
{ default: () => '查看' }
),
]
},
},
])
const data = ref([])
onMounted(() => {
getData()
})
const pagination = ref({
page: 1,
pageSize: 10,
itemCount: 0,
onChange: (page) => {
pagination.value.page = page
getData()
},
})
const getData = async () => {
const res = await api.getLog({
pageNum: pagination.value.page,
pageSize: pagination.value.pageSize,
})
data.value = res.data.data || []
pagination.value.itemCount = res.data.total
}
const showModal = ref(false)
const zsLoading = ref(false)
const zsColumns = ref([
{
title: '期数',
key: 'Periods',
align: 'center',
},
{
title: '数字',
key: 'PeriodsNum',
align: 'center',
},
{
title: '总投注(豆子)',
key: 'NumberSum',
align: 'center',
},
{
title: '赔付(积分)',
key: 'TotalCount',
align: 'center',
},
{
title: '选中用户',
key: 'User',
align: 'center',
},
{
title: '电话号码',
key: 'Phone',
align: 'center',
},
])
const zsData = ref([])
const zsPagination = ref({
page: 1,
pageSize: 10,
itemCount: 0,
onChange: (page) => {
zsPagination.value.page = page
getData()
},
})
const openModal = async (row) => {
showModal.value = true
zsLoading.value = true
const res = await api.getDetail({
periods: row.periods,
draw_time: row.draw_time,
pageNum: zsPagination.value.page,
pageSize: zsPagination.value.pageSize,
})
zsData.value = res.data.data || []
zsPagination.value.itemCount = res.data.total
zsLoading.value = false
}
</script>
<style lang="scss" scoped></style>