初始化足球投注平台 MVP Monorepo

包含 NestJS 后端、三端前端、Prisma 数据模型、结算引擎测试与 PRD 文档。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-02 14:35:48 +08:00
commit 14e49374ac
118 changed files with 15944 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import api from '../api';
import { ElMessage } from 'element-plus';
const agents = ref<unknown[]>([]);
const form = ref({ username: '', password: 'Agent@123', creditLimit: 50000 });
onMounted(load);
async function load() {
const { data } = await api.get('/admin/agents');
agents.value = data.data;
}
async function create() {
await api.post('/admin/agents', form.value);
ElMessage.success('创建成功');
load();
}
async function adjustCredit(agent: { userId: string }, amount: number) {
await api.post(`/admin/agents/${agent.userId}/credit`, {
amount,
requestId: `credit-${Date.now()}`,
});
ElMessage.success('额度已调整');
load();
}
</script>
<template>
<h2>代理管理</h2>
<el-form inline style="margin: 16px 0">
<el-input v-model="form.username" placeholder="用户名" style="width: 120px" />
<el-input-number v-model="form.creditLimit" placeholder="额度" />
<el-button type="primary" @click="create">创建一级代理</el-button>
</el-form>
<el-table :data="agents">
<el-table-column label="用户名">
<template #default="{ row }">{{ (row as { user?: { username: string } }).user?.username }}</template>
</el-table-column>
<el-table-column prop="level" label="层级" />
<el-table-column prop="creditLimit" label="授信额度" />
<el-table-column prop="usedCredit" label="已用额度" />
<el-table-column label="操作">
<template #default="{ row }">
<el-button size="small" @click="adjustCredit(row as { userId: string }, 10000)">+10000</el-button>
</template>
</el-table-column>
</el-table>
</template>