From 62b3b9e9a4add4ff0f3d8173aecc66e259e1d2c6 Mon Sep 17 00:00:00 2001
From: YuanHuakk <1751826683@qq.com>
Date: Thu, 25 Jan 2024 22:45:30 +0800
Subject: [PATCH] =?UTF-8?q?feat(custom):=20=E6=96=B0=E5=A2=9E=E8=AE=B0?=
=?UTF-8?q?=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 48 +++--
.../sidebar/components/SideMenu.vue | 50 ++---
src/views/business/mer_list/api.js | 2 +
src/views/business/mer_list/index.vue | 116 +++++++++++
src/views/game/api.js | 20 +-
src/views/game/balloon/data/index.vue | 150 +++++++++++++-
src/views/game/balloon/statistics/index.vue | 4 +-
src/views/game/balloon/zs/index.vue | 189 ++++++++++++++++++
8 files changed, 519 insertions(+), 60 deletions(-)
create mode 100644 src/views/game/balloon/zs/index.vue
diff --git a/.env.development b/.env.development
index 569fa74..38c86b7 100644
--- a/.env.development
+++ b/.env.development
@@ -1,22 +1,26 @@
-# 资源公共路径,需要以 /开头和结尾
-VITE_PUBLIC_PATH='/'
-
-# 是否启用MOCK
-VITE_USE_MOCK=false
-
-# 是否启用代理
-VITE_USE_PROXY=true
-
-# base api
-VITE_BASE_API='https://test.wanzhuanyongcheng.cn/admin'
-
-VITE_WS1_URL='game.wanzhuanyongcheng.cn/dice/home'
-
-VITE_WS_URL='test.wanzhuanyongcheng.cn/admin/data'
-
-VITE_MER_LOGIN_URL='//localhost:3100/login'
-
-VITE_GAME_API='https://www.jdt168.com'
-
-# 是否启用监控
-VITE_SENTRY=false
+# 资源公共路径,需要以 /开头和结尾
+VITE_PUBLIC_PATH='/'
+
+# 是否启用MOCK
+VITE_USE_MOCK=false
+
+# 是否启用代理
+VITE_USE_PROXY=true
+
+# base api
+VITE_BASE_API='https://test.wanzhuanyongcheng.cn/admin'
+
+VITE_WS1_URL='game.wanzhuanyongcheng.cn/dice/home'
+
+VITE_WS_URL='test.wanzhuanyongcheng.cn/admin/data'
+
+VITE_MER_LOGIN_URL='//localhost:3100/login'
+
+VITE_GAME_API='https://www.jdt168.com'
+
+# 转盘相关
+VITE_TRUN_WS_URL='test.wanzhuanyongcheng.cn/admin/turntable'
+VITE_TRUN_WS1_URL='game2.wanzhuanyongcheng.cn/turntable/home'
+
+# 是否启用监控
+VITE_SENTRY=false
diff --git a/src/layout/components/sidebar/components/SideMenu.vue b/src/layout/components/sidebar/components/SideMenu.vue
index a7d9d0e..cf54a9e 100644
--- a/src/layout/components/sidebar/components/SideMenu.vue
+++ b/src/layout/components/sidebar/components/SideMenu.vue
@@ -58,32 +58,32 @@ function getMenuItem(route, basePath = '') {
if (!visibleChildren.length) return menuItem
- if (visibleChildren.length === 1) {
- // 单个子路由处理
- const singleRoute = visibleChildren[0]
- menuItem = {
- ...menuItem,
- label: singleRoute.meta?.title || singleRoute.name,
- key: singleRoute.name,
- path: resolvePath(menuItem.path, singleRoute.path),
- icon: getIcon(singleRoute.meta),
- }
- const visibleItems = singleRoute.children
- ? singleRoute.children.filter((item) => item.name && !item.isHidden)
- : []
+ // if (visibleChildren.length === 1) {
+ // // 单个子路由处理
+ // const singleRoute = visibleChildren[0]
+ // menuItem = {
+ // ...menuItem,
+ // label: singleRoute.meta?.title || singleRoute.name,
+ // key: singleRoute.name,
+ // path: resolvePath(menuItem.path, singleRoute.path),
+ // icon: getIcon(singleRoute.meta),
+ // }
+ // const visibleItems = singleRoute.children
+ // ? singleRoute.children.filter((item) => item.name && !item.isHidden)
+ // : []
- if (visibleItems.length === 1) {
- menuItem = getMenuItem(visibleItems[0], menuItem.path)
- } else if (visibleItems.length > 1) {
- menuItem.children = visibleItems
- .map((item) => getMenuItem(item, menuItem.path))
- .sort((a, b) => a.order - b.order)
- }
- } else {
- menuItem.children = visibleChildren
- .map((item) => getMenuItem(item, menuItem.path))
- .sort((a, b) => a.order - b.order)
- }
+ // if (visibleItems.length === 1) {
+ // menuItem = getMenuItem(visibleItems[0], menuItem.path)
+ // } else if (visibleItems.length > 1) {
+ // menuItem.children = visibleItems
+ // .map((item) => getMenuItem(item, menuItem.path))
+ // .sort((a, b) => a.order - b.order)
+ // }
+ // } else {
+ menuItem.children = visibleChildren
+ .map((item) => getMenuItem(item, menuItem.path))
+ .sort((a, b) => a.order - b.order)
+ // }
return menuItem
}
diff --git a/src/views/business/mer_list/api.js b/src/views/business/mer_list/api.js
index e68cff8..c2afdb3 100644
--- a/src/views/business/mer_list/api.js
+++ b/src/views/business/mer_list/api.js
@@ -6,4 +6,6 @@ export default {
getMerType: () => request.post('/store/getOther'),
// 一键登录
login: (data) => request.post('/store/easy/login', data),
+ // 退积分
+ outJf: (data) => request.post('/store/set/integral', data),
}
diff --git a/src/views/business/mer_list/index.vue b/src/views/business/mer_list/index.vue
index 2e460f4..543efac 100644
--- a/src/views/business/mer_list/index.vue
+++ b/src/views/business/mer_list/index.vue
@@ -153,6 +153,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 提交
+
+ 取消
+
+
+
+
+
@@ -165,12 +198,67 @@ const vPerms = resolveDirective('perms')
const isEdit = computed(() => drawerTitle.value === '编辑商户')
+const showModalJf = ref(false)
+
+const formRefJf = ref(null)
+
+const model = ref({
+ name: '',
+ bid: null,
+ number: null,
+})
+
+const rulesJf = ref({
+ number: {
+ required: true,
+ type: 'number',
+ message: '请输入退积分',
+ trigger: 'blur',
+ },
+})
+
+const handleOutClick = (e) => {
+ e.preventDefault()
+ formRefJf.value?.validate(async (errors) => {
+ if (!errors) {
+ try {
+ await api.outJf({
+ bid: model.value.bid,
+ number: model.value.number,
+ })
+ $message.success('成功')
+ handleClearOutClick()
+ await getMertype()
+ await getList()
+ showModalJf.value = false
+ } catch (error) {
+ $message.error(error.msg)
+ }
+ } else {
+ $message.error('Invalid')
+ }
+ })
+}
+
+const handleClearOutClick = () => {
+ formRefJf.value?.restoreValidation()
+ model.value = {
+ number: null,
+ }
+ showModalJf.value = false
+}
+
const columns = ref([
{
title: '商户名称',
align: 'center',
key: 'name',
},
+ {
+ title: '电话',
+ align: 'center',
+ key: 'phone',
+ },
{
title: '状态',
align: 'center',
@@ -179,6 +267,16 @@ const columns = ref([
return h('span', row.status === 1 ? '正常' : '禁用')
},
},
+ {
+ title: '积分',
+ align: 'center',
+ key: 'integral',
+ },
+ {
+ title: '创建时间',
+ align: 'center',
+ key: 'add_time',
+ },
{
title: '操作',
align: 'center',
@@ -202,6 +300,24 @@ const columns = ref([
),
[[vPerms, ['/admin/store/edit']]]
),
+ withDirectives(
+ h(
+ NButton,
+ {
+ class: 'ml-10',
+ type: 'primary',
+ text: true,
+ size: 'small',
+ onClick: () => {
+ model.value.name = row.name
+ model.value.bid = row.bid
+ showModalJf.value = true
+ },
+ },
+ () => '退积分'
+ ),
+ [[vPerms, ['/admin/store/set/integral']]]
+ ),
withDirectives(
h(
NButton,
diff --git a/src/views/game/api.js b/src/views/game/api.js
index 6106309..9ebd69a 100644
--- a/src/views/game/api.js
+++ b/src/views/game/api.js
@@ -27,17 +27,23 @@ export default {
// 全部投注用户
allUser: () => request.post('/all/draw/user', {}),
- // 吹气球相关
+ // 转盘相关
// 游戏状态
- getisBalloonStart: () => request.post('/getisBalloonStart'),
+ getisBalloonStart: () => request.post('/getisTurntableStart'),
// 修改游戏状态
- setisBalloonStart: (data) => request.post('/isBalloonStart', data),
+ setisBalloonStart: (data) => request.post('/isTurntableStart', data),
+ // 你猜
+ setZsNum: () => request.post('/setTurntable'),
// 全部开奖记录
- getBalloonList: () => request.post('/balloon/draw'),
+ getBalloonList: () => request.post('/turntable/draw'),
// 本局投注记录
- getBalloonUser: () => request.post('/now/balloon/draw/user'),
+ getBalloonUser: () => request.post('/now/turntable/draw/user'),
// 全部投注记录
- getAllBalloonUser: () => request.post('/all/balloon/draw/user'),
+ getAllBalloonUser: () => request.post('/all/turntable/draw/user'),
// 统计全部投注和中奖列表
- getUserList: () => request.post('/user/balloon/list'),
+ getTjList: () => request.post('/user/turntable/list'),
+ // 宙斯记录
+ getZsBalloon: (data) => request.post('/turntable/log', data),
+ // 宙斯中奖
+ getZsBalloonUser: (data) => request.post('/log/turntable/list', data),
}
diff --git a/src/views/game/balloon/data/index.vue b/src/views/game/balloon/data/index.vue
index 52139e8..65298c5 100644
--- a/src/views/game/balloon/data/index.vue
+++ b/src/views/game/balloon/data/index.vue
@@ -7,7 +7,7 @@
v-model:value="gameStatus"
:checked-value="1"
:unchecked-value="2"
- @update:value="handleUpdateValue"
+ @update:value="handleUpdateValue1"
/>
@@ -19,6 +19,69 @@
预览
+
+
+ 预开期数:
+ {{ list[0]?.Periods || 0 }}
+
+
+ 剩余开奖时间:
+ {{ time || 0 }}
+
+
+ 本局总下注:
+ {{ totalA || 0 }}
+
+
+
+
+
+ 第
+ {{ data[0]?.Periods || 0 }}
+ 期开奖结果:
+ {{ data[0]?.Name || 0 }}
+
+
+
+
+
+
+ {{ item.count }}
+
+
+
+
+
+
+
+
+
+
+ {{ item.Total }}
+
+
+
+ 你猜
+
+ 一切都将一去杳然,任何人都无法将其捕获。
+
+
+
+
+
+
+
+
import api from '../../api'
+import { getToken } from '@/utils'
+
+const ws = new WebSocket(`wss://${import.meta.env.VITE_TRUN_WS_URL}`)
+
+const ws1 = new WebSocket(`wss://${import.meta.env.VITE_TRUN_WS1_URL}`)
const gameStatus = ref(2)
+const t_1 = ref()
+const t_2 = ref()
+
+const show = ref(true)
+const show1 = ref(true)
+
+const list = ref([])
+const list1 = ref([])
+const totalA = ref(0)
+
+const time = ref(0)
+
+const data = ref([])
+
+onBeforeUnmount(() => {
+ clearInterval(t_1.value)
+ clearInterval(t_2.value)
+})
+
+ws.onopen = () => {
+ t_1.value = setInterval(() => {
+ ws.send('ping')
+ }, 2500)
+}
+
+ws1.onopen = () => {
+ t_2.value = setInterval(() => {
+ ws1.send('ping')
+ }, 2500)
+}
+
+ws.onmessage = (e) => {
+ const res = JSON.parse(e.data)
+ 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.onmessage = (e) => {
+ const res = JSON.parse(e.data)
+ switch (res.code) {
+ case 200:
+ // let num = res.data
+ time.value = res.data
+ break
+ case 301:
+ $message.error(res.msg)
+ break
+ }
+}
+
onMounted(() => {
get_status()
+ get_kj_jl()
})
+const get_kj_jl = async () => {
+ try {
+ const res = await api.getBalloonList()
+ data.value = res.data.data
+ } catch (error) {
+ $message.error(error.msg)
+ throw error
+ }
+}
+
const get_status = async () => {
const res = await api.getisBalloonStart()
- gameStatus.value = res.data.balloonStart
+ gameStatus.value = res.data.diceStart
}
const handleUpdateValue = async (e) => {
+ const res = await api.setDS({
+ status: 1,
+ id: e,
+ user_id: getToken(),
+ Periods: list.value[0]?.Periods,
+ })
+ $message.success(res.msg)
+}
+
+const handleUpdateValue1 = async (e) => {
await api.setisBalloonStart({
- Start: e,
+ start: e,
})
$message.success('修改成功')
get_status()
@@ -144,7 +286,7 @@ const { value: tempCol } = ref([
sortOrder: false,
},
{
- title: '购买秒数',
+ title: '购买选项',
key: 'DrawTime',
align: 'center',
},
diff --git a/src/views/game/balloon/statistics/index.vue b/src/views/game/balloon/statistics/index.vue
index 23f79f0..bc4ca26 100644
--- a/src/views/game/balloon/statistics/index.vue
+++ b/src/views/game/balloon/statistics/index.vue
@@ -127,7 +127,7 @@ const columns = ref([
align: 'center',
},
{
- title: '开奖秒数',
+ title: '开奖号码',
key: 'Name',
align: 'center',
},
@@ -167,7 +167,7 @@ const getList = async () => {
dataObj.StartTime = range.value[0]
dataObj.EndTime = range.value[1]
}
- const res = await api.getUserList(dataObj)
+ const res = await api.getTjList(dataObj)
const newData = res.data.data || []
data.value = newData
option.value.xAxis.data = []
diff --git a/src/views/game/balloon/zs/index.vue b/src/views/game/balloon/zs/index.vue
new file mode 100644
index 0000000..46c6499
--- /dev/null
+++ b/src/views/game/balloon/zs/index.vue
@@ -0,0 +1,189 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+