提交roll日创建

This commit is contained in:
2026-07-14 18:32:14 +08:00
parent 09883eacdb
commit 6971daf9a7
16 changed files with 1119 additions and 52 deletions
@@ -0,0 +1,209 @@
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="用户ID" prop="userId">
<el-input
v-model="queryParams.userId"
placeholder="请输入用户ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="昵称" prop="nickName">
<el-input
v-model="queryParams.nickName"
placeholder="请输入机器人昵称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号码" prop="phoneNumber">
<el-input
v-model="queryParams.phoneNumber"
placeholder="请输入手机号码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
icon="el-icon-circle-plus-outline"
type="primary"
plain
size="mini"
@click="addRobot = true"
>生成机器人</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="ID" align="center" prop="userId" />
<el-table-column label="机器人昵称" align="center" prop="nickName" />
<el-table-column label="头像" align="center" prop="avatar">
<template slot-scope="scope">
<image-preview :src="scope.row.avatar" :width="50" :height="50" />
</template>
</el-table-column>
<el-table-column label="手机号码" align="center" prop="phoneNumber" />
<el-table-column label="账户金额" align="center" prop="accountAmount" />
<el-table-column label="VIP等级" align="center" prop="vipLevel">
<template slot-scope="scope">VIP{{ scope.row.vipLevel }}</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d} {h}:{i}:{s}") }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 生成机器人 -->
<el-dialog title="生成机器人" :visible.sync="addRobot" width="600px">
<el-form>
<el-form-item label="请选择数量:" style="margin-bottom: 2px;">
<el-input-number size="mini" v-model="newNumber" :min="1" :max="10" label="描述文字"></el-input-number>
</el-form-item>
<div style="font-size:14px;color:#797979;">
<i class="el-icon-info"></i> 要生成的机器人数量每次最多10个
</div>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="addRobot = false"> </el-button>
<el-button type="primary" @click="generateRobot"> </el-button>
</div>
</el-dialog>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { listUser, delUser, generateRobot } from "@/api/skins/ttuser/api";
export default {
name: "RobotUser",
data() {
return {
loading: true,
showSearch: true,
// 选中数组
ids: [],
// 非多个禁用
multiple: true,
total: 0,
userList: [],
addRobot: false,
newNumber: 1,
queryParams: {
userId: null,
nickName: null,
phoneNumber: null,
// 固定只查机器人(userType=03
userType: "03",
pageNum: 1,
pageSize: 10
}
};
},
created() {
this.getList();
},
methods: {
/** 查询机器人列表 */
getList() {
this.loading = true;
this.queryParams.userType = "03";
listUser(this.queryParams).then(response => {
this.userList = response.rows;
this.total = response.total;
this.loading = false;
});
},
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
resetQuery() {
this.queryParams = {
userId: null,
nickName: null,
phoneNumber: null,
userType: "03",
pageNum: 1,
pageSize: 10
};
this.handleQuery();
},
handleSelectionChange(selection) {
this.ids = selection.map(item => item.userId);
this.multiple = !selection.length;
},
/** 生成机器人 */
generateRobot() {
generateRobot(this.newNumber).then(res => {
this.getList();
(this.newNumber = 1), (this.addRobot = false);
const blob = new Blob([res], {
type: "text/plain;charset=utf-8"
});
const objectURL = URL.createObjectURL(blob);
const aTag = document.createElement("a");
aTag.href = objectURL;
aTag.download = `机器人账号数据_${new Date().getTime()}.txt`;
aTag.click();
URL.revokeObjectURL(objectURL);
});
},
/** 删除机器人 */
handleDelete(row) {
const userIds = row.userId || this.ids;
this.$modal
.confirm('是否确认删除机器人编号为"' + userIds + '"的数据项?')
.then(() => {
return delUser(userIds);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
}
}
};
</script>
+18 -3
View File
@@ -318,6 +318,14 @@
</template>
</el-table-column>
</el-table>
<pagination
v-show="cdkTotal > 0"
:total="cdkTotal"
:page.sync="cdkQueryParams.pageNum"
:limit.sync="cdkQueryParams.pageSize"
@pagination="loadCdkList"
small
/>
<div slot="footer" class="dialog-footer">
<el-button @click="cdkDialogVisible = false"> </el-button>
</div>
@@ -401,7 +409,12 @@ export default {
cdkList: [],
cdkLoading: false,
cdkGenCount: 10,
currentCdkRollId: null
currentCdkRollId: null,
cdkTotal: 0,
cdkQueryParams: {
pageNum: 1,
pageSize: 10
}
};
},
mounted() {
@@ -577,14 +590,16 @@ export default {
// 打开CDK管理弹窗
handleCdk(row) {
this.currentCdkRollId = row.id;
this.cdkQueryParams.pageNum = 1;
this.cdkDialogVisible = true;
this.loadCdkList();
},
// 加载CDK列表
loadCdkList() {
this.cdkLoading = true;
getRollCdkList(this.currentCdkRollId).then(res => {
this.cdkList = res.data || [];
getRollCdkList(this.currentCdkRollId, this.cdkQueryParams).then(res => {
this.cdkList = res.rows || [];
this.cdkTotal = res.total || 0;
this.cdkLoading = false;
});
},
@@ -0,0 +1,279 @@
<template>
<div class="home">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item label="配置名称" prop="configName">
<el-input
v-model="queryParams.configName"
placeholder="请输入配置名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-option label="启用" value="0"></el-option>
<el-option label="停用" value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-plus"
size="mini"
@click="handleCreat"
>新增</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table :data="tableData" style="width: 100%" v-loading="loading">
<el-table-column align="center" prop="id" label="ID" width="60"></el-table-column>
<el-table-column align="center" prop="configName" label="配置名称"></el-table-column>
<el-table-column align="center" prop="jackpotId" label="奖池" width="140">
<template slot-scope="scope">
{{ jackpotName(scope.row.jackpotId) }}
</template>
</el-table-column>
<el-table-column align="center" prop="roomName" label="房间名"></el-table-column>
<el-table-column align="center" prop="robotNum" label="机器人数量" width="100"></el-table-column>
<el-table-column align="center" prop="cdkCount" label="CDK数量" width="90"></el-table-column>
<el-table-column align="center" prop="peopleNum" label="人数上限" width="90"></el-table-column>
<el-table-column align="center" prop="rollPassword" label="密码" width="80"></el-table-column>
<el-table-column align="center" prop="status" label="状态" width="90">
<template slot-scope="scope">
<el-switch
:value="scope.row.status === '0'"
active-color="#13ce66"
inactive-color="#ff4949"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column align="center" prop="lastGenerateTime" label="上次生成时间" width="160"></el-table-column>
<el-table-column align="center" label="操作" width="140">
<template slot-scope="scope">
<el-button type="text" size="mini" icon="el-icon-edit" @click="handleChange(scope.row)">编辑</el-button>
<el-button type="text" size="mini" icon="el-icon-delete" @click="handleDelete(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="35%">
<el-form :model="form" :rules="rules" label-width="120px" ref="ruleForm">
<el-form-item label="配置名称" prop="configName">
<el-input v-model="form.configName" autocomplete="off" placeholder="请输入配置名称(内部标识)"></el-input>
</el-form-item>
<el-form-item label="奖池" prop="jackpotId">
<el-select v-model="form.jackpotId" filterable placeholder="请选择奖池" clearable>
<el-option
v-for="item in JackpotList"
:key="item.jackpotId"
:label="item.jackpotName"
:value="item.jackpotId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="房间名" prop="roomName">
<el-input v-model="form.roomName" autocomplete="off" placeholder="请输入生成房间的名称"></el-input>
</el-form-item>
<el-form-item label="房间描述" prop="description">
<el-input type="textarea" v-model="form.description" placeholder="请输入房间描述"></el-input>
</el-form-item>
<el-form-item label="机器人数量" prop="robotNum">
<el-input-number v-model="form.robotNum" :min="0" :max="100000" label="机器人数量"></el-input-number>
<span style="font-size: 12px;">
<i class="el-icon-info"></i> 每天自动创建房间后加入的机器人数量为0则不加机器人
</span>
</el-form-item>
<el-form-item label="人数上限" prop="peopleNum">
<el-input-number v-model="form.peopleNum" :min="1" :max="100000" label="人数上限"></el-input-number>
</el-form-item>
<el-form-item label="房间密码" prop="rollPassword">
<el-input v-model="form.rollPassword" autocomplete="off" placeholder="请输入房间密码"></el-input>
<span style="font-size: 12px;">
<i class="el-icon-info"></i> 为空表示无密码
</span>
</el-form-item>
<el-form-item label="CDK数量" prop="cdkCount">
<el-input-number v-model="form.cdkCount" :min="0" :max="500" label="CDK数量"></el-input-number>
<span style="font-size: 12px;">
<i class="el-icon-info"></i> 填0则不启用CDK模式使用普通密码
</span>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio label="0">启用</el-radio>
<el-radio label="1">停用</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="submitForm('ruleForm')"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
officialRollConfigList,
officialRollConfigAdd,
officialRollConfigChange,
officialRollConfigDel,
officialRollConfigChangeStatus,
rollJackpotList
} from "@/api/skins/ttRoll/api";
export default {
name: "OfficialRollConfig",
data() {
return {
total: 0,
loading: false,
showSearch: true,
dialogFormVisible: false,
title: "",
isEdit: false,
tableData: [],
JackpotList: [],
queryParams: {
configName: null,
periodType: null,
status: null,
pageNum: 1,
pageSize: 10
},
form: this.emptyForm(),
rules: {
configName: [{ required: true, message: "请输入配置名称", trigger: "blur" }],
jackpotId: [{ required: true, message: "请选择奖池", trigger: "change" }],
roomName: [{ required: true, message: "请输入房间名", trigger: "blur" }],
peopleNum: [{ required: true, message: "请输入人数上限", trigger: "blur" }]
}
};
},
mounted() {
this.getList();
this.loadJackpot();
},
methods: {
emptyForm() {
return {
id: null,
configName: null,
periodType: "DAILY",
jackpotId: null,
roomName: null,
description: null,
minRecharge: 0,
robotNum: 0,
cdkCount: 0,
peopleNum: 100,
rollPassword: null,
sortBy: 0,
status: "0"
};
},
jackpotName(jackpotId) {
const j = this.JackpotList.find(item => item.jackpotId == jackpotId);
return j ? j.jackpotName : jackpotId;
},
loadJackpot() {
rollJackpotList({ pageNum: 1, pageSize: 9999 }).then(res => {
this.JackpotList = res.rows || [];
});
},
getList() {
this.loading = true;
officialRollConfigList(this.queryParams).then(res => {
this.tableData = res.rows || [];
this.total = res.total || 0;
this.loading = false;
}).catch(() => {
this.loading = false;
});
},
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
resetQuery() {
this.queryParams = {
configName: null,
periodType: null,
status: null,
pageNum: 1,
pageSize: 10
};
this.handleQuery();
},
handleCreat() {
this.form = this.emptyForm();
this.isEdit = false;
this.title = "新增官方周期Roll配置";
this.dialogFormVisible = true;
},
handleChange(row) {
this.form = Object.assign(this.emptyForm(), row);
this.isEdit = true;
this.title = "编辑官方周期Roll配置";
this.dialogFormVisible = true;
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (!valid) return false;
const api = this.isEdit ? officialRollConfigChange : officialRollConfigAdd;
api(this.form).then(() => {
this.$modal.msgSuccess(this.isEdit ? "编辑成功" : "新增成功");
this.dialogFormVisible = false;
this.getList();
});
});
},
handleStatusChange(row) {
const newStatus = row.status === "0" ? "1" : "0";
const text = newStatus === "0" ? "启用" : "停用";
this.$modal
.confirm(`确认要${text}配置"${row.configName}"吗?`)
.then(() => {
return officialRollConfigChangeStatus({ id: row.id, status: newStatus });
})
.then(() => {
row.status = newStatus;
this.$modal.msgSuccess(text + "成功");
})
.catch(() => {});
},
handleDelete(id) {
this.$modal
.confirm('是否确认删除ID为"' + id + '"的配置?')
.then(() => {
return officialRollConfigDel(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
}
}
};
</script>
<style scoped lang="scss">
.home {
padding: 20px;
}
</style>
-41
View File
@@ -71,14 +71,6 @@
v-hasPermi="['admin:user:export']"
>导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button
icon="el-icon-circle-plus-outline"
type="primary"
size="mini"
@click="addRobot = true"
>生成机器人</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -114,21 +106,6 @@
<el-button type="primary" @click="generateAccount"> </el-button>
</div>
</el-dialog>
<!-- 生成机器人 -->
<el-dialog title="生成机器人" :visible.sync="addRobot" width="600px">
<el-form>
<el-form-item label="请选择数量:" style="margin-bottom: 2px;">
<el-input-number size="mini" v-model="newNumber" :min="1" :max="10" label="描述文字"></el-input-number>
</el-form-item>
<div style="font-size:14px;color:#797979;">
<i class="el-icon-info"></i> 要生成的账号数量
</div>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="addRobot = false"> </el-button>
<el-button type="primary" @click="generateRobot"> </el-button>
</div>
</el-dialog>
<pagination
v-show="total > 0"
@@ -284,7 +261,6 @@ import {
delUser,
updateUser,
generateAccount,
generateRobot,
getUserProfitStatistics,
resetUserBalance,
forceDeleteUser
@@ -300,7 +276,6 @@ export default {
openView: false,
newNumber: 1,
addNewUser: false,
addRobot: false,
// 遮罩层
loading: true,
// 选中数组
@@ -467,22 +442,6 @@ export default {
URL.revokeObjectURL(objectURL);
});
},
/* 生成账号 */
generateRobot() {
generateRobot(this.newNumber).then(res => {
this.getList();
(this.newNumber = null), (this.addRobot = false);
const blob = new Blob([res], {
type: "text/plain;charset=utf-8"
});
const objectURL = URL.createObjectURL(blob);
const aTag = document.createElement("a");
aTag.href = objectURL;
aTag.download = `账号数据_${new Date().getTime()}.txt`;
aTag.click();
URL.revokeObjectURL(objectURL);
});
},
/** 查询注册用户列表 */
getList() {
this.loading = true;