5 Commits
4.0.0 ... 4.0.1

Author SHA1 Message Date
zzc
4bb09a0fb1 fix: system
All checks were successful
continuous-integration/drone/tag Build is passing
2026-04-22 21:51:49 +08:00
zzc
90bbed91f0 fix: message obj 2026-04-22 19:20:32 +08:00
zzc
6b8e8ab5d8 fix: message obj 2026-04-22 19:13:28 +08:00
zzc
f86e4b5b9a fix: add black 2026-04-21 23:09:36 +08:00
zzc
b52d832986 fix: add black 2026-04-21 22:46:53 +08:00
21 changed files with 541 additions and 16 deletions

25
src/api/system/ipBlack.js Normal file
View File

@@ -0,0 +1,25 @@
import request from '@/utils/request'
export function getList(data) {
return request({
url: 'management/api/system/blacklist/ip/list',
method: 'get',
params: data,
})
}
export function doAdd(data) {
return request({
url: 'management/api/system/blacklist/ip',
method: 'post',
data,
})
}
export function doRemove(data) {
return request({
url: 'management/api/system/blacklist/ip/remove',
method: 'post',
data,
})
}

View File

@@ -0,0 +1,25 @@
import request from '@/utils/request'
export function getList(data) {
return request({
url: 'management/api/system/blacklist/user/list',
method: 'get',
params: data,
})
}
export function doAdd(data) {
return request({
url: 'management/api/system/blacklist/user',
method: 'post',
data,
})
}
export function doRemove(data) {
return request({
url: 'management/api/system/blacklist/user/remove',
method: 'post',
data,
})
}

View File

@@ -308,8 +308,8 @@ export const asyncRoutes = [
meta: { title: '用户签到记录' },
},
{
path: 'userChat',
name: 'UserChat',
path: 'userDevice',
name: 'UserDevice',
component: () => import('@/views/spring/user/device/index'),
meta: { title: '设备' },
},
@@ -378,6 +378,18 @@ export const asyncRoutes = [
component: () => import('@/views/personnelManagement/suspiciousRequest/index'),
meta: { title: '异常请求' },
},
{
path: 'ipBlacklist',
name: 'IPBlacklist',
component: () => import('@/views/systemManagement/ipBlack/index'),
meta: { title: 'IP 黑名单' },
},
{
path: 'userBlacklist',
name: 'UserBlacklist',
component: () => import('@/views/systemManagement/userBlack/index'),
meta: { title: '用户 黑名单' },
},
{
path: 'uploadedFileManagement',
name: 'UploadedFileManagement',
@@ -452,8 +464,8 @@ export const asyncRoutes = [
// meta: { title: '用户' },
// },
// {
// path: 'userChat',
// name: 'UserChat',
// path: 'userDevice',
// name: 'userDevice',
// component: () => import('@/views/maomao/user/chat/index'),
// meta: { title: '聊天' },
// },

View File

@@ -54,6 +54,8 @@ instance.interceptors.request.use(
}
if (store.getters['user/appId']) {
config.headers['x-app-id'] = store.getters['user/appId']
} else {
config.headers['x-app-id'] = '69665538a49b8ae3be50fe5d'
}
if (config.method === 'get' && config.params) {
config.params = Vue.prototype.$baseLodash.pickBy(config.params, Vue.prototype.$baseLodash.identity)

View File

@@ -63,6 +63,9 @@
<el-form-item>
<el-button icon="el-icon-search" type="primary" @click="handleQuery">查询</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
<el-button :type="excludeAcquaintance ? 'primary' : 'default'" @click="toggleExcludeAcquaintance">去掉熟人</el-button>
<el-button :type="onlyUserId === true ? 'primary' : 'default'" @click="toggleOnlyUserId(true)">只显示有用户请求</el-button>
<el-button :type="onlyNoUserId === true ? 'primary' : 'default'" @click="toggleOnlyNoUserId()">只显示无用户请求</el-button>
</el-form-item>
</el-form>
</el-card>
@@ -136,6 +139,14 @@
<el-link type="primary" :underline="false" @click="goToUser(row.userId)">{{ row.userId }}</el-link>
</template>
</el-table-column>
<el-table-column label="Device ID" prop="deviceId" show-overflow-tooltip>
<template slot-scope="{ row }">
<el-link v-if="row.deviceId" type="primary" :underline="false" @click="goToDevice(row.deviceId)">
{{ row.deviceId }}
</el-link>
<span v-else>-</span>
</template>
</el-table-column>
</el-table>
<el-pagination
background
@@ -175,6 +186,9 @@
},
data() {
return {
excludeAcquaintance: false,
onlyUserId: null, // null: all, true: only with user
onlyNoUserId: null, // null: all, true: only without user
eventNameMap,
eventTypeMap,
appMap,
@@ -273,6 +287,16 @@
pageSize: 10000, // 获取足够多的数据进行前端统计,或者应该依赖后端聚合接口
}
if (this.excludeAcquaintance) {
params.excludeAcquaintance = true
}
if (this.onlyUserId !== null) {
params.onlyUserId = this.onlyUserId
}
if (this.onlyNoUserId !== null) {
params.onlyNoUserId = this.onlyNoUserId
}
const { data } = await getTrackingLogsList(params)
this.list = data.list || []
@@ -314,6 +338,28 @@
this.pageSize = val
this.currentPage = 1
},
toggleExcludeAcquaintance() {
this.excludeAcquaintance = !this.excludeAcquaintance
this.fetchData()
},
toggleOnlyUserId(value) {
if (this.onlyUserId === value) {
this.onlyUserId = null // Toggle off if already selected
} else {
this.onlyUserId = value
this.onlyNoUserId = null // 互斥
}
this.fetchData()
},
toggleOnlyNoUserId() {
if (this.onlyNoUserId === true) {
this.onlyNoUserId = null // Toggle off if already selected
} else {
this.onlyNoUserId = true
this.onlyUserId = null // 互斥
}
this.fetchData()
},
handleCurrentChange(val) {
this.currentPage = val
},
@@ -330,6 +376,10 @@
query: { userId },
})
},
goToDevice(deviceId) {
if (!deviceId) return
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
},
handleEventNameClick(params) {
const name = params.name
// name 可能是中文映射名,需要反向查找 key或者在 processData 时把 key 存入

View File

@@ -1,5 +1,9 @@
<template>
<div class="accessLogManagement-container">
<el-tabs v-model="queryForm.appId" type="card" @tab-click="handleTabClick">
<el-tab-pane v-for="item in applicationList" :key="item.id" :label="item.name" :name="item.id" />
</el-tabs>
<vab-query-form>
<vab-query-form-right-panel :span="12">
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
@@ -24,7 +28,7 @@
</el-table-column>
<el-table-column align="center" label="类型" show-overflow-tooltip>
<template #default="{ row }">
<el-tag v-if="row.url.includes('api/v')" type="success">应用</el-tag>
<el-tag v-if="row.platform.includes('weixin')" type="success">微信小程序</el-tag>
<el-tag v-else type="info">后台</el-tag>
</template>
</el-table-column>
@@ -39,8 +43,13 @@
{{ row.userName || row.userId }}
</template>
</el-table-column>
<el-table-column align="center" label="method" prop="method" show-overflow-tooltip width="80" />
<el-table-column align="center" label="statusCode" prop="statusCode" show-overflow-tooltip width="100" />
<el-table-column align="center" label="耗时(ms)" prop="duration" show-overflow-tooltip width="100" />
<el-table-column align="center" label="平台" prop="platform" show-overflow-tooltip width="100" />
<el-table-column align="center" label="userAgent" prop="userAgent" show-overflow-tooltip />
<el-table-column align="center" label="referrer" prop="referrer" show-overflow-tooltip />
<el-table-column align="center" label="body" prop="body" show-overflow-tooltip />
</el-table>
<el-pagination
background
@@ -56,6 +65,7 @@
<script>
import { getList } from '@/api/accessLogManagement'
import { getList as getApplicationList } from '@/api/appManagement'
import { formatTime } from '@/utils'
export default {
@@ -69,14 +79,17 @@
selectRows: '',
elementLoadingText: '正在加载...',
queryForm: {
appId: '',
pageNo: 1,
pageSize: 10,
permission: '',
},
applicationList: [],
timeOutID: null,
}
},
created() {
this.fetchApplicationList()
this.fetchData()
},
@@ -84,6 +97,13 @@
clearTimeout(this.timeOutID)
},
methods: {
async fetchApplicationList() {
const { data } = await getApplicationList({ pageNo: 1, pageSize: 100 })
this.applicationList = data.list
},
handleTabClick() {
this.queryData()
},
formatTime,
setSelectRows(val) {
this.selectRows = val

View File

@@ -32,9 +32,12 @@
</vab-query-form>
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
<el-table-column align="center" label="IP" prop="ip" show-overflow-tooltip />
<el-table-column align="center" label="地址" prop="address" show-overflow-tooltip />
<el-table-column align="center" label="用户" show-overflow-tooltip>
<template slot-scope="{ row }">
{{ row.userName || row.userId }}
{{ row.userId }}
</template>
</el-table-column>
<el-table-column align="center" label="应用" show-overflow-tooltip>
@@ -42,7 +45,6 @@
{{ row.appName || row.appId }}
</template>
</el-table-column>
<el-table-column align="center" label="IP" prop="ip" show-overflow-tooltip />
<el-table-column align="center" label="路径" prop="path" show-overflow-tooltip />
<el-table-column align="center" label="原因" prop="reason" show-overflow-tooltip />
<el-table-column align="center" label="UserAgent" prop="userAgent" show-overflow-tooltip />

View File

@@ -122,7 +122,7 @@
this.fetchData()
},
goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
},
async fetchData() {
this.listLoading = true

View File

@@ -186,7 +186,7 @@
this.fetchData()
},
goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
},
goToTemplate(templateId) {
this.$router.push({ path: '/spring/blessing/template', query: { templateId } })

View File

@@ -136,7 +136,7 @@
this.fetchData()
},
goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
},
goToCard(cardId) {
// Assuming there is a card detail or list page, but for now just placeholder or link to card list

View File

@@ -139,7 +139,7 @@
this.fetchData()
},
goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
},
async fetchData() {
this.listLoading = true

View File

@@ -199,7 +199,7 @@
this.fetchData()
},
goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
},
goToContent(row) {
if (row.scene === 'card_generate') {

View File

@@ -202,7 +202,7 @@
this.fetchData()
},
goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
},
goToContent(row) {
if (row.type === 1) {

View File

@@ -165,7 +165,7 @@
this.fetchData()
},
goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
},
goToShareRecord(userId) {
this.$router.push({ path: '/spring/user/shareRecord', query: { userId } })

View File

@@ -200,7 +200,7 @@
this.$router.push({ path: '/spring/user/shareRecord', query: { keyword: shareToken } })
},
goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
},
goToTemplate(templateId) {
this.$router.push({ path: '/spring/blessing/template', query: { templateId } })

View File

@@ -214,7 +214,7 @@
this.fetchData()
},
goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
},
goToShareRecord(userId) {
this.$router.push({ path: '/spring/user/shareRecord', query: { userId } })

View File

@@ -69,6 +69,10 @@
}
},
created() {
const { permission } = this.$route.query
if (permission) {
this.queryForm.permission = permission
}
this.fetchData()
},

View File

@@ -0,0 +1,63 @@
<template>
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
<el-form ref="form" label-width="80px" :model="form" :rules="rules">
<el-form-item label="IP地址" prop="ip">
<el-input v-model.trim="form.ip" autocomplete="off" placeholder="请输入需要拉黑的IP地址" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="close"> </el-button>
<el-button type="primary" @click="save"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { doAdd } from '@/api/system/ipBlack'
export default {
name: 'IPBlacklistEdit',
data() {
return {
form: {
ip: '',
},
rules: {
ip: [{ required: true, trigger: 'blur', message: '请输入IP地址' }],
},
title: '新增',
dialogFormVisible: false,
}
},
methods: {
showEdit() {
this.title = '新增'
this.form = this.$options.data().form
this.dialogFormVisible = true
},
close() {
this.$refs['form'].resetFields()
this.form = this.$options.data().form
this.dialogFormVisible = false
},
save() {
this.$refs['form'].validate(async (valid) => {
if (valid) {
try {
const { msg } = await doAdd(this.form)
this.$baseMessage(msg, 'success')
this.$refs['form'].resetFields()
this.dialogFormVisible = false
this.$emit('fetch-data')
this.form = this.$options.data().form
} catch (error) {
console.error(error)
}
} else {
return false
}
})
},
},
}
</script>

View File

@@ -0,0 +1,130 @@
<template>
<div class="ip-blacklist-container">
<vab-query-form>
<vab-query-form-left-panel :span="12">
<el-button icon="el-icon-plus" type="primary" @click="handleAdd">新增</el-button>
<el-button icon="el-icon-delete" type="danger" @click="handleDelete">移除选中</el-button>
</vab-query-form-left-panel>
<vab-query-form-right-panel :span="12">
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
<el-form-item>
<el-input v-model.trim="queryForm.ip" clearable placeholder="请输入查询的IP" />
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
</el-form-item>
</el-form>
</vab-query-form-right-panel>
</vab-query-form>
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText" @selection-change="setSelectRows">
<el-table-column align="center" show-overflow-tooltip type="selection" width="55" />
<el-table-column align="center" label="IP" prop="ip" show-overflow-tooltip />
<el-table-column align="center" label="地址" prop="address" show-overflow-tooltip />
<el-table-column align="center" fixed="right" label="操作" show-overflow-tooltip width="200">
<template #default="{ row }">
<el-button type="text" @click="handleDelete(row)">移除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
:current-page="queryForm.pageNo"
:layout="layout"
:page-size="queryForm.pageSize"
:total="total"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
/>
<edit ref="edit" @fetch-data="fetchData" />
</div>
</template>
<script>
import { getList, doRemove } from '@/api/system/ipBlack'
import Edit from './components/IPBlacklistEdit'
export default {
name: 'IPBlacklist',
components: { Edit },
data() {
return {
list: [],
listLoading: true,
layout: 'total, sizes, prev, pager, next, jumper',
total: 0,
selectRows: [],
elementLoadingText: '正在加载...',
queryForm: {
pageNo: 1,
pageSize: 10,
ip: '',
},
}
},
created() {
this.fetchData()
},
methods: {
setSelectRows(val) {
this.selectRows = val
},
handleAdd() {
this.$refs['edit'].showEdit()
},
handleDelete(row) {
if (row.ip) {
this.$baseConfirm('你确定要将当前IP从黑名单中移除吗', null, async () => {
const { msg } = await doRemove({ ips: [row.ip] })
this.$baseMessage(msg, 'success')
this.fetchData()
})
} else {
if (this.selectRows.length > 0) {
const ips = this.selectRows.map((item) => item.ip)
this.$baseConfirm('你确定要将选中的IP从黑名单中移除吗', null, async () => {
const { msg } = await doRemove({ ips })
this.$baseMessage(msg, 'success')
this.fetchData()
})
} else {
this.$baseMessage('未选中任何行', 'error')
return false
}
}
},
handleSizeChange(val) {
this.queryForm.pageSize = val
this.fetchData()
},
handleCurrentChange(val) {
this.queryForm.pageNo = val
this.fetchData()
},
queryData() {
this.queryForm.pageNo = 1
this.fetchData()
},
async fetchData() {
this.listLoading = true
try {
const { data } = await getList(this.queryForm)
this.list = data.list
this.total = data.totalCount
} catch (error) {
console.error(error)
} finally {
this.listLoading = false
}
},
},
}
</script>
<style scoped>
.ip-blacklist-container {
padding: 20px;
}
</style>

View File

@@ -0,0 +1,63 @@
<template>
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
<el-form ref="form" label-width="80px" :model="form" :rules="rules">
<el-form-item label="用户ID" prop="userId">
<el-input v-model.trim="form.userId" autocomplete="off" placeholder="请输入需要拉黑的用户ID" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="close"> </el-button>
<el-button type="primary" @click="save"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { doAdd } from '@/api/system/userBlack'
export default {
name: 'UserBlacklistEdit',
data() {
return {
form: {
userId: '',
},
rules: {
userId: [{ required: true, trigger: 'blur', message: '请输入用户ID' }],
},
title: '新增',
dialogFormVisible: false,
}
},
methods: {
showEdit() {
this.title = '新增'
this.form = this.$options.data().form
this.dialogFormVisible = true
},
close() {
this.$refs['form'].resetFields()
this.form = this.$options.data().form
this.dialogFormVisible = false
},
save() {
this.$refs['form'].validate(async (valid) => {
if (valid) {
try {
const { msg } = await doAdd(this.form)
this.$baseMessage(msg, 'success')
this.$refs['form'].resetFields()
this.dialogFormVisible = false
this.$emit('fetch-data')
this.form = this.$options.data().form
} catch (error) {
console.error(error)
}
} else {
return false
}
})
},
},
}
</script>

View File

@@ -0,0 +1,129 @@
<template>
<div class="user-blacklist-container">
<vab-query-form>
<vab-query-form-left-panel :span="12">
<el-button icon="el-icon-plus" type="primary" @click="handleAdd">新增</el-button>
<el-button icon="el-icon-delete" type="danger" @click="handleDelete">移除选中</el-button>
</vab-query-form-left-panel>
<vab-query-form-right-panel :span="12">
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
<el-form-item>
<el-input v-model.trim="queryForm.userId" clearable placeholder="请输入查询的用户ID" />
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
</el-form-item>
</el-form>
</vab-query-form-right-panel>
</vab-query-form>
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText" @selection-change="setSelectRows">
<el-table-column align="center" show-overflow-tooltip type="selection" width="55" />
<el-table-column align="center" label="用户ID" prop="userId" show-overflow-tooltip />
<el-table-column align="center" fixed="right" label="操作" show-overflow-tooltip width="200">
<template #default="{ row }">
<el-button type="text" @click="handleDelete(row)">移除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
:current-page="queryForm.pageNo"
:layout="layout"
:page-size="queryForm.pageSize"
:total="total"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
/>
<edit ref="edit" @fetch-data="fetchData" />
</div>
</template>
<script>
import { getList, doRemove } from '@/api/system/userBlack'
import Edit from './components/UserBlacklistEdit'
export default {
name: 'UserBlacklist',
components: { Edit },
data() {
return {
list: [],
listLoading: true,
layout: 'total, sizes, prev, pager, next, jumper',
total: 0,
selectRows: [],
elementLoadingText: '正在加载...',
queryForm: {
pageNo: 1,
pageSize: 10,
userId: '',
},
}
},
created() {
this.fetchData()
},
methods: {
setSelectRows(val) {
this.selectRows = val
},
handleAdd() {
this.$refs['edit'].showEdit()
},
handleDelete(row) {
if (row.userId) {
this.$baseConfirm('你确定要将当前用户从黑名单中移除吗?', null, async () => {
const { msg } = await doRemove({ userIds: [row.userId] })
this.$baseMessage(msg, 'success')
this.fetchData()
})
} else {
if (this.selectRows.length > 0) {
const userIds = this.selectRows.map((item) => item.userId)
this.$baseConfirm('你确定要将选中的用户从黑名单中移除吗?', null, async () => {
const { msg } = await doRemove({ userIds })
this.$baseMessage(msg, 'success')
this.fetchData()
})
} else {
this.$baseMessage('未选中任何行', 'error')
return false
}
}
},
handleSizeChange(val) {
this.queryForm.pageSize = val
this.fetchData()
},
handleCurrentChange(val) {
this.queryForm.pageNo = val
this.fetchData()
},
queryData() {
this.queryForm.pageNo = 1
this.fetchData()
},
async fetchData() {
this.listLoading = true
try {
const { data } = await getList(this.queryForm)
this.list = data.list
this.total = data.totalCount
} catch (error) {
console.error(error)
} finally {
this.listLoading = false
}
},
},
}
</script>
<style scoped>
.user-blacklist-container {
padding: 20px;
}
</style>