Compare commits

...

4 Commits

Author SHA1 Message Date
zhx
92d5fad37d Merge branch 'main' of gitea.haiyihy.com:hy/chatapp3-admin 2026-05-15 16:32:07 +08:00
zhx
6d0daf6919 声网错误日志 2026-05-15 16:31:56 +08:00
zhx
49953ddd5a fix: allow 100mb admin uploads through nginx 2026-05-15 14:21:25 +08:00
zhx
143752c86c 火箭份数配置 2026-05-15 12:19:48 +08:00
10 changed files with 514 additions and 68 deletions

View File

@ -130,6 +130,26 @@ export interface AppHomePopupItem {
version?: number;
}
export interface AppAgoraErrorLogItem {
agoraUid?: string;
bannedByServer?: boolean;
clientIp?: string;
connectionChangedReasonType?: string;
createTime?: string;
errorCodeType?: string;
id?: string;
isTimeout?: boolean;
networkType?: string;
rawPayload?: string;
reqAppIntel?: string;
reqClient?: string;
roomId?: string;
sysOrigin?: string;
tokenRequestSuccess?: boolean | null;
userAgent?: string;
userId?: string;
}
export async function loginLoggerPage(params: Record<string, any>) {
return requestClient.get<LegacyPageResult>('/user/login/logger/page', {
params,
@ -250,6 +270,13 @@ export async function deleteAppHomePopup(id: number | string) {
return requestClient.delete(`/go/app-system/home-popups/configs/${id}`);
}
export async function pageAgoraErrorLogs(params: Record<string, any>) {
return requestClient.get<LegacyPageResult<AppAgoraErrorLogItem>>(
'/go/app-system/error-logs/agora/page',
{ params },
);
}
export async function getEnumConfigByGroup(group: string) {
return requestClient.get<{ result: LegacyEnumConfigItem[] }>(
`/sys/enum/config/list/${group}`,

View File

@ -68,6 +68,10 @@ const LOCAL_RESIDENT_ACTIVITY_FALLBACK_ROUTES = new Set([
'ResidentVoiceRoomRocket',
]);
const LOCAL_APP_SYSTEM_FALLBACK_ROUTES = new Set([
'AppSystemAgoraErrorLog',
]);
function normalizeRoutePath(path?: string | null) {
return String(path || '')
.trim()
@ -115,6 +119,7 @@ function buildAuthorizedMenuMatcher(menus: LegacyMenu[]) {
const aliasSet = new Set<string>();
const routerSet = new Set<string>();
const titleSet = new Set<string>();
let hasAppSystemAccess = false;
let hasResidentActivityAccess = false;
const queue = [...menus];
@ -142,6 +147,14 @@ function buildAuthorizedMenuMatcher(menus: LegacyMenu[]) {
) {
hasResidentActivityAccess = true;
}
if (
String(item.alias || '') === 'AppSystemManager' ||
menuName === 'App系统管理' ||
normalizedRouter === 'app/sys/mamange' ||
normalizedRouter.startsWith('app/sys/mamange/')
) {
hasAppSystemAccess = true;
}
if (Array.isArray(item.childrens) && item.childrens.length > 0) {
queue.push(...item.childrens);
}
@ -154,6 +167,12 @@ function buildAuthorizedMenuMatcher(menus: LegacyMenu[]) {
) {
return true;
}
if (
hasAppSystemAccess &&
LOCAL_APP_SYSTEM_FALLBACK_ROUTES.has(String(route.name || ''))
) {
return true;
}
for (const alias of collectRouteAliases(route)) {
if (aliasSet.has(alias)) {
return true;

View File

@ -34,6 +34,20 @@ const routes: RouteRecordRaw[] = [
component: () => import('#/views/app-system/request-log.vue'),
meta: { title: '请求日志' },
},
{
name: 'AppSystemErrorLog',
path: 'error-log',
redirect: '/app/sys/mamange/error-log/agora',
meta: { title: '错误日志' },
children: [
{
name: 'AppSystemAgoraErrorLog',
path: 'agora',
component: () => import('#/views/app-system/agora-error-log.vue'),
meta: { title: '声网' },
},
],
},
{
name: 'AppSystemSpecialId',
path: 'userSpecialId',

View File

@ -0,0 +1,346 @@
<script lang="ts" setup>
import type { AppAgoraErrorLogItem } from '#/api/legacy/app-system';
import { computed, reactive, ref, watch } from 'vue';
import { Page } from '@vben/common-ui';
import { useAccessStore } from '@vben/stores';
import {
Button,
Card,
DateRangePicker,
Input,
Modal,
Pagination,
Select,
Space,
Table,
Tag,
} from 'antdv-next';
import { pageAgoraErrorLogs } from '#/api/legacy/app-system';
import SysOriginSelect from '#/components/sys-origin-select.vue';
import InlineFilterField from '#/views/_shared/inline-filter-field.vue';
import InlineFilterToolbar from '#/views/_shared/inline-filter-toolbar.vue';
import { formatDate, getAllowedSysOrigins } from '#/views/system/shared';
defineOptions({ name: 'AppSystemAgoraErrorLog' });
const categoryOptions = [{ label: '声网', value: 'AGORA' }];
const bannedOptions = [
{ label: '全部', value: '' },
{ label: '仅 BannedByServer', value: 'true' },
];
const columns = [
{ dataIndex: 'createTime', key: 'createTime', title: '上报时间', width: 170 },
{ dataIndex: 'userId', key: 'userId', title: '用户ID', width: 150 },
{ dataIndex: 'roomId', key: 'roomId', title: '房间ID', width: 150 },
{ dataIndex: 'agoraUid', key: 'agoraUid', title: 'Agora UID', width: 140 },
{ dataIndex: 'errorCodeType', key: 'errorCodeType', title: 'ErrorCodeType', width: 220 },
{
dataIndex: 'connectionChangedReasonType',
key: 'connectionChangedReasonType',
title: 'ConnectionChangedReasonType',
width: 260,
},
{ dataIndex: 'networkType', key: 'networkType', title: '网络', width: 110 },
{ dataIndex: 'flags', key: 'flags', title: '状态', width: 220 },
{ dataIndex: 'reqClient', key: 'reqClient', title: '客户端', width: 120 },
{ dataIndex: 'actions', fixed: 'right' as const, key: 'actions', title: '操作', width: 100 },
];
const accessStore = useAccessStore();
const sysOriginOptions = computed(() => {
const options = getAllowedSysOrigins(accessStore.accessCodes || []);
return options.length > 0 ? options : getAllowedSysOrigins([]);
});
const loading = ref(false);
const detailsOpen = ref(false);
const detailsText = ref('');
const list = ref<AppAgoraErrorLogItem[]>([]);
const total = ref(0);
const rangeDate = ref<[string, string] | null>(null);
const query = reactive<Record<string, any>>({
agoraUid: '',
bannedOnly: '',
category: 'AGORA',
cursor: 1,
endTime: '',
errorCodeType: '',
limit: 20,
networkType: '',
reasonType: '',
roomId: '',
startTime: '',
sysOrigin: '',
userId: '',
});
watch(rangeDate, (value) => {
query.startTime = value?.[0] || '';
query.endTime = value?.[1] || '';
});
watch(
sysOriginOptions,
(options) => {
if (!query.sysOrigin) {
query.sysOrigin = String(options[0]?.value || '');
}
},
{ immediate: true },
);
watch(
() => query.sysOrigin,
(value) => {
if (value) {
void loadData(true);
}
},
{ immediate: true },
);
async function loadData(reset = false) {
if (!query.sysOrigin) {
return;
}
if (reset) {
query.cursor = 1;
}
loading.value = true;
try {
const result = await pageAgoraErrorLogs({
agoraUid: query.agoraUid,
bannedOnly: query.bannedOnly,
cursor: query.cursor,
endTime: query.endTime,
errorCodeType: query.errorCodeType,
limit: query.limit,
networkType: query.networkType,
reasonType: query.reasonType,
roomId: query.roomId,
startTime: query.startTime,
sysOrigin: query.sysOrigin,
userId: query.userId,
});
list.value = result.records || [];
total.value = Number(result.total || 0);
} finally {
loading.value = false;
}
}
function handlePageChange(page: number, pageSize: number) {
query.cursor = page;
query.limit = pageSize;
void loadData();
}
function showDetails(record: AppAgoraErrorLogItem) {
const payload = record.rawPayload || '{}';
try {
detailsText.value = JSON.stringify(JSON.parse(payload), null, 2);
} catch {
detailsText.value = payload;
}
detailsOpen.value = true;
}
function tokenText(value: boolean | null | undefined) {
if (value === true) {
return 'Token成功';
}
if (value === false) {
return 'Token失败';
}
return 'Token未知';
}
function tokenColor(value: boolean | null | undefined) {
if (value === true) {
return 'green';
}
if (value === false) {
return 'red';
}
return 'default';
}
</script>
<template>
<Page title="错误日志 - 声网">
<Card>
<InlineFilterToolbar class="toolbar">
<InlineFilterField label="分类">
<Select
v-model:value="query.category"
:options="categoryOptions"
disabled
style="width: 120px"
/>
</InlineFilterField>
<InlineFilterField label="系统">
<SysOriginSelect
v-model:value="query.sysOrigin"
:options="sysOriginOptions"
style="width: 140px"
/>
</InlineFilterField>
<InlineFilterField label="用户ID">
<Input
v-model:value="query.userId"
allow-clear
placeholder="用户ID"
style="width: 160px"
/>
</InlineFilterField>
<InlineFilterField label="房间ID">
<Input
v-model:value="query.roomId"
allow-clear
placeholder="房间ID"
style="width: 160px"
/>
</InlineFilterField>
<InlineFilterField label="Agora UID" :label-width="92">
<Input
v-model:value="query.agoraUid"
allow-clear
placeholder="Agora UID"
style="width: 160px"
/>
</InlineFilterField>
<InlineFilterField label="ErrorCode" :label-width="92">
<Input
v-model:value="query.errorCodeType"
allow-clear
placeholder="ErrorCodeType"
style="width: 180px"
/>
</InlineFilterField>
<InlineFilterField label="Reason" :label-width="76">
<Input
v-model:value="query.reasonType"
allow-clear
placeholder="ConnectionChangedReasonType"
style="width: 220px"
/>
</InlineFilterField>
<InlineFilterField label="踢出规则" :label-width="84">
<Select
v-model:value="query.bannedOnly"
:options="bannedOptions"
style="width: 170px"
/>
</InlineFilterField>
<InlineFilterField label="网络">
<Input
v-model:value="query.networkType"
allow-clear
placeholder="wifi / mobile"
style="width: 140px"
/>
</InlineFilterField>
<InlineFilterField label="时间范围" :control-width="360">
<DateRangePicker
v-model:value="rangeDate"
show-time
value-format="YYYY-MM-DD HH:mm:ss"
/>
</InlineFilterField>
<Button :loading="loading" type="primary" @click="loadData(true)">
搜索
</Button>
</InlineFilterToolbar>
<Table
:columns="columns"
:data-source="list"
:loading="loading"
:pagination="false"
row-key="id"
:scroll="{ x: 1700 }"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'createTime'">
{{ formatDate(record.createTime) }}
</template>
<template v-else-if="column.key === 'connectionChangedReasonType'">
<Space wrap>
<span>{{ record.connectionChangedReasonType || '-' }}</span>
<Tag v-if="record.bannedByServer" color="red">
BannedByServer
</Tag>
</Space>
</template>
<template v-else-if="column.key === 'flags'">
<Space wrap>
<Tag :color="record.isTimeout ? 'orange' : 'default'">
{{ record.isTimeout ? 'Timeout' : '非Timeout' }}
</Tag>
<Tag :color="tokenColor(record.tokenRequestSuccess)">
{{ tokenText(record.tokenRequestSuccess) }}
</Tag>
</Space>
</template>
<template v-else-if="column.key === 'actions'">
<Button size="small" type="link" @click="showDetails(record)">
详情
</Button>
</template>
</template>
</Table>
<div class="pagination">
<Pagination
:current="query.cursor"
:page-size="query.limit"
:total="total"
show-size-changer
@change="handlePageChange"
@showSizeChange="handlePageChange"
/>
</div>
</Card>
<Modal
:open="detailsOpen"
destroy-on-close
title="原始上报内容"
width="760"
@cancel="detailsOpen = false"
@ok="detailsOpen = false"
>
<pre class="json-box">{{ detailsText }}</pre>
</Modal>
</Page>
</template>
<style scoped>
.toolbar {
margin-bottom: 16px;
}
.pagination {
display: flex;
justify-content: flex-end;
margin-top: 16px;
}
.json-box {
background: #0f172a;
border-radius: 8px;
color: #e2e8f0;
margin: 0;
max-height: 60vh;
overflow: auto;
padding: 16px;
white-space: pre-wrap;
word-break: break-word;
}
</style>

View File

@ -2,8 +2,20 @@
import { computed, reactive, ref, watch } from 'vue';
import {
OSS_FILE_BUCKETS,
Button,
Form,
FormItem,
Image,
Input,
message,
Modal,
Select,
Switch,
} from 'antdv-next';
import {
getAccessImgUrl,
OSS_FILE_BUCKETS,
simpleUploadFile,
} from '#/api/legacy/oss';
import {
@ -11,21 +23,9 @@ import {
updatePropsSource,
} from '#/api/legacy/props';
import {
Button,
Form,
FormItem,
Image,
Input,
Modal,
Select,
Switch,
message,
} from 'antdv-next';
import {
NOBLE_VIP_OPTIONS,
PROPS_TYPES,
PROPS_RESOURCE_CONFIG_TYPES,
} from '../shared';
const props = defineProps<{
@ -63,17 +63,26 @@ const form = reactive<Record<string, any>>({
const isUpdate = computed(() => Boolean(form.id));
const isImageSourceType = computed(() =>
['THEME', 'LAYOUT', 'CHAT_BUBBLE'].includes(form.type),
['CHAT_BUBBLE', 'LAYOUT', 'THEME'].includes(form.type),
);
const isAmountRequired = computed(
() => !['CUSTOMIZE', 'FRAGMENTS'].includes(form.type),
);
const isSourceRequired = computed(
const showSourceUpload = computed(
() => !['CUSTOMIZE', 'FRAGMENTS'].includes(form.type),
);
const isSourceRequired = computed(
() => !['BADGE', 'CUSTOMIZE', 'FRAGMENTS'].includes(form.type),
);
const showExpandUpload = computed(() => form.type === 'CHAT_BUBBLE');
const sourceUploadLabel = computed(() => {
if (showExpandUpload.value) {
return 'iOS资源';
}
return isSourceRequired.value ? '资源' : '资源(选填)';
});
const title = computed(() => (isUpdate.value ? '修改资源' : '新增资源'));
const propsTypeOptions = PROPS_TYPES.map((item) => ({
const propsTypeOptions = PROPS_RESOURCE_CONFIG_TYPES.map((item) => ({
label: item.name,
value: item.value as any,
}));
@ -92,7 +101,7 @@ function resetForm() {
form.name = '';
form.sourceUrl = '';
form.sysOrigin = props.sysOriginOptions[0]?.value ?? 'LIKEI';
form.type = PROPS_TYPES[0]?.value ?? '';
form.type = PROPS_RESOURCE_CONFIG_TYPES[0]?.value ?? '';
}
watch(
@ -235,11 +244,7 @@ async function handleSubmit() {
...form,
amount: isAmountRequired.value ? Number(form.amount) : 0,
};
if (isUpdate.value) {
await updatePropsSource(payload);
} else {
await addPropsSource(payload);
}
await (isUpdate.value ? updatePropsSource(payload) : addPropsSource(payload));
message.success('保存成功');
emit('success');
emit('close');
@ -261,9 +266,10 @@ async function handleSubmit() {
>
<Form layout="vertical">
<FormItem label="系统">
<SysOriginSelect v-model:value="form.sysOrigin"
<SysOriginSelect
v-model:value="form.sysOrigin"
:options="sysOriginOptions"
></SysOriginSelect>
/>
</FormItem>
<FormItem label="类型">
<Select
@ -290,7 +296,7 @@ async function handleSubmit() {
</Button>
</div>
</FormItem>
<FormItem v-if="isSourceRequired" :label="showExpandUpload ? 'iOS资源' : '资源'">
<FormItem v-if="showSourceUpload" :label="sourceUploadLabel">
<input
ref="sourceInputRef"
:accept="isImageSourceType ? 'image/*' : '.svga,.pag,.mp4'"

View File

@ -3,9 +3,6 @@ import { computed, reactive, ref, watch } from 'vue';
import { useAccessStore } from '@vben/stores';
import { getPropsSale } from '#/api/legacy/statistics';
import { getAllowedSysOrigins } from '#/views/system/shared';
import {
DatePicker,
Descriptions,
@ -16,10 +13,13 @@ import {
Table,
} from 'antdv-next';
import { getPropsSale } from '#/api/legacy/statistics';
import { getAllowedSysOrigins } from '#/views/system/shared';
import {
ACTIVITY_DATE_TYPE_MAP,
ACTIVITY_DATE_TYPE_OPTIONS,
PROPS_TYPES,
PROPS_RESOURCE_CONFIG_TYPES,
} from '../shared';
defineOptions({ name: 'PropsResourceOverviewModal' });
@ -45,7 +45,7 @@ const summary = ref<Record<string, any>>({});
const query = reactive({
date: '',
dateType: 'MONTH',
propsType: PROPS_TYPES[0]?.value ?? 'AVATAR_FRAME',
propsType: PROPS_RESOURCE_CONFIG_TYPES[0]?.value ?? 'AVATAR_FRAME',
sysOrigin: '',
});
@ -66,7 +66,7 @@ const dateTypeOptions = ACTIVITY_DATE_TYPE_OPTIONS.map((item) => ({
label: item.label,
value: item.value as any,
}));
const propsTypeOptions = PROPS_TYPES.map((item) => ({
const propsTypeOptions = PROPS_RESOURCE_CONFIG_TYPES.map((item) => ({
label: item.name,
value: item.value as any,
}));
@ -97,7 +97,7 @@ watch(
}
query.sysOrigin = sysOriginOptions.value[0]?.value || 'LIKEI';
query.dateType = 'MONTH';
query.propsType = PROPS_TYPES[0]?.value ?? 'AVATAR_FRAME';
query.propsType = PROPS_RESOURCE_CONFIG_TYPES[0]?.value ?? 'AVATAR_FRAME';
query.date = ACTIVITY_DATE_TYPE_MAP.MONTH.defaultDate;
void loadData();
},
@ -123,9 +123,12 @@ watch(
@cancel="emit('close')"
>
<Space class="toolbar" wrap>
<SysOriginSelect v-model:value="query.sysOrigin" style="width: 140px" @change="loadData"
<SysOriginSelect
v-model:value="query.sysOrigin"
style="width: 140px"
:options="sysOriginOptions"
></SysOriginSelect>
@change="loadData"
/>
<Select
option-label-prop="label"
v-model:value="query.dateType"

View File

@ -2,38 +2,39 @@
import {
computed,
reactive,
ref } from 'vue';
ref,
} from 'vue';
import { Page } from '@vben/common-ui';
import { useAccessStore } from '@vben/stores';
import {
offShelfPropsSource,
pagePropsSource,
} from '#/api/legacy/props';
import InlineFilterField from '#/views/_shared/inline-filter-field.vue';
import InlineFilterToolbar from '#/views/_shared/inline-filter-toolbar.vue';
import { getAllowedSysOrigins } from '#/views/system/shared';
import {
Button,
Card,
Empty,
Input,
message,
Pagination,
Select,
Space,
Switch,
Table,
Tag,
message
} from 'antdv-next';
import RewardIcon from './components/reward-icon.vue';
import {
offShelfPropsSource,
pagePropsSource,
} from '#/api/legacy/props';
import InlineFilterField from '#/views/_shared/inline-filter-field.vue';
import InlineFilterToolbar from '#/views/_shared/inline-filter-toolbar.vue';
import { getAllowedSysOrigins } from '#/views/system/shared';
import ResourceConfigModal from './components/resource-config-modal.vue';
import ResourceOverviewModal from './components/resource-overview-modal.vue';
import ResourceSalesModal from './components/resource-sales-modal.vue';
import { PROPS_DEL_OPTIONS, PROPS_TYPES } from './shared';
import RewardIcon from './components/reward-icon.vue';
import { PROPS_DEL_OPTIONS, PROPS_RESOURCE_CONFIG_TYPES } from './shared';
defineOptions({ name: 'PropsResourceConfig' });
@ -62,7 +63,7 @@ const list = ref<Array<Record<string, any>>>([]);
const formOpen = ref(false);
const salesOpen = ref(false);
const overviewOpen = ref(false);
const activeRow = ref<Record<string, any> | null>(null);
const activeRow = ref<null | Record<string, any>>(null);
const query = reactive({
cursor: 1,
@ -71,7 +72,7 @@ const query = reactive({
limit: 20,
name: '',
sysOrigin: sysOriginOptions.value[0]?.value ?? 'LIKEI',
type: PROPS_TYPES[0]?.value ?? 'AVATAR_FRAME',
type: PROPS_RESOURCE_CONFIG_TYPES[0]?.value ?? 'AVATAR_FRAME',
});
const columns = [
@ -150,24 +151,24 @@ loadData(true);
@change="loadData(true)"
:options="sysOriginOptions"
></SysOriginSelect>
/>
</InlineFilterField>
<InlineFilterField label="类型">
<Select option-label-prop="label"
<Select
option-label-prop="label"
v-model:value="query.type"
style="width: 140px"
@change="loadData(true)"
:options="PROPS_TYPES.map((item) => ({ label: `${item.name}`, value: item.value as any }))"
:options="PROPS_RESOURCE_CONFIG_TYPES.map((item) => ({ label: `${item.name}`, value: item.value as any }))"
/>
</InlineFilterField>
<InlineFilterField label="状态">
<Select option-label-prop="label"
<Select
option-label-prop="label"
v-model:value="query.del"
allow-clear
style="width: 120px"
@change="loadData(true)"
:options="PROPS_DEL_OPTIONS.map((item) => ({ label: `${item.name}`, value: item.value as any }))"
/>
</InlineFilterField>
@ -246,7 +247,7 @@ loadData(true);
:total="total"
show-size-changer
@change="handlePageChange"
@showSizeChange="handlePageChange"
@show-size-change="handlePageChange"
/>
</div>
</Card>

View File

@ -19,6 +19,11 @@ export const PROPS_TYPES: OptionItem[] = [
{ value: 'CUSTOMIZE', name: '自定义(只读)' },
];
export const PROPS_RESOURCE_CONFIG_TYPES: OptionItem[] = [
...PROPS_TYPES,
{ value: 'BADGE', name: '徽章' },
];
export const PROPS_TICKET_TYPES: OptionItem[] = [
{ value: 'AVATAR_FRAME', name: '头像框' },
{ value: 'RIDE', name: '座驾' },
@ -276,14 +281,15 @@ export function isBadgeRewardType(type?: null | string) {
export function isPropsSourceType(type?: null | string) {
return [
'AVATAR_FRAME',
'RIDE',
'NOBLE_VIP',
'THEME',
'BADGE',
'CHAT_BUBBLE',
'CUSTOMIZE',
'DATA_CARD',
'FLOAT_PICTURE',
'FRAGMENTS',
'DATA_CARD',
'CUSTOMIZE',
'NOBLE_VIP',
'RIDE',
'THEME',
].includes(String(type || ''));
}
@ -328,8 +334,9 @@ export function createActivityRuleDraft(type = '') {
case 'FIRST_CHARGE_REWARD': {
return { productId: '' };
}
case 'SVIP_REWARD': {
return { mark: '', quantity: '' };
case 'GAME_FRUIT_BOX_REWARD_TIMES':
case 'GAME_FRUIT_BOX_REWARD_WIN': {
return { quantity: '', status: true };
}
case 'LUCKY_BOX': {
return [
@ -338,13 +345,12 @@ export function createActivityRuleDraft(type = '') {
{ id: 3, opportunityNumber: '', quantity: '' },
];
}
case 'SVIP_REWARD': {
return { mark: '', quantity: '' };
}
case 'WEEKLY_GAME_TASKS': {
return { gameConfId: '', target: '' };
}
case 'GAME_FRUIT_BOX_REWARD_WIN':
case 'GAME_FRUIT_BOX_REWARD_TIMES': {
return { quantity: '', status: true };
}
default: {
return { quantity: '' };
}

View File

@ -62,6 +62,7 @@ type RewardRow = {
rewardName: string;
rewardScene: string;
rewardType: string;
rewardCopies: number;
sort: number;
weight: number;
};
@ -201,6 +202,7 @@ const rewardColumns = [
{ dataIndex: 'rewardCover', key: 'rewardCover', title: '封面', width: 220 },
{ dataIndex: 'rewardAmount', key: 'rewardAmount', title: '数量/金币/天数', width: 150 },
{ dataIndex: 'expireDays', key: 'expireDays', title: '有效天数', width: 130 },
{ dataIndex: 'rewardCopies', key: 'rewardCopies', title: '份数', width: 110 },
{ dataIndex: 'weight', key: 'weight', title: '权重', width: 110 },
{ dataIndex: 'enabled', key: 'enabled', title: '启用', width: 90 },
{ dataIndex: 'sort', key: 'sort', title: '排序', width: 100 },
@ -319,6 +321,7 @@ function normalizeRewardRows(rows: Array<Record<string, any>> | undefined) {
rewardName: String(row.rewardName || ''),
rewardScene: String(row.rewardScene || 'TOP1'),
rewardType: String(row.rewardType || 'GOLD'),
rewardCopies: toNumber(row.rewardCopies, 1),
sort: toNumber(row.sort, index + 1),
weight: toNumber(row.weight, 1),
}));
@ -407,6 +410,7 @@ function handleRewardSceneChange(row: Record<string, any>) {
row.rewardType = 'GOLD';
handleRewardTypeChange(row);
}
row.rewardCopies = row.rewardScene === 'IN_ROOM' ? toNumber(row.rewardCopies, 1) : 1;
}
function handleResourceSelect(item: ResourceOption) {
@ -553,6 +557,7 @@ function addRewardRow(scene = 'TOP1', rewardType = 'GOLD') {
rewardName: isNone ? '轮空' : rewardType === 'GOLD' ? '金币' : '',
rewardScene: scene,
rewardType,
rewardCopies: 1,
sort: rewardRows.value.length + 1,
weight: 1,
});
@ -604,6 +609,12 @@ function validateRewards() {
message.warning('轮空只能配置在房用户奖励');
return false;
}
if (row.rewardScene !== 'IN_ROOM') {
row.rewardCopies = 1;
} else if (toNumber(row.rewardCopies, 0) <= 0) {
message.warning('在房用户奖励份数必须大于 0');
return false;
}
if (!String(row.rewardName || '').trim()) {
message.warning('请输入奖励名称');
return false;
@ -646,6 +657,8 @@ async function saveRewards() {
rewardName: row.rewardType === 'NONE' ? '轮空' : row.rewardName.trim(),
rewardScene: row.rewardScene,
rewardType: row.rewardType,
rewardCopies:
row.rewardScene === 'IN_ROOM' ? toNumber(row.rewardCopies, 1) : 1,
sort: toNumber(row.sort, 1),
weight: toNumber(row.weight, 1),
})),
@ -960,7 +973,7 @@ watch(rewardLevel, () => {
:data-source="rewardRows"
:loading="rewardLoading"
:pagination="false"
:scroll="{ x: 1660 }"
:scroll="{ x: 1770 }"
row-key="localKey"
>
<template #bodyCell="{ column, record, index }">
@ -1045,6 +1058,15 @@ watch(rewardLevel, () => {
class="table-number"
/>
</template>
<template v-else-if="column.key === 'rewardCopies'">
<InputNumber
v-model:value="record.rewardCopies"
:disabled="record.rewardScene !== 'IN_ROOM'"
:min="1"
:precision="0"
class="table-number"
/>
</template>
<template v-else-if="column.key === 'weight'">
<InputNumber
v-model:value="record.weight"

View File

@ -15,6 +15,8 @@ events {
http {
client_max_body_size 105m;
include mime.types;
default_type application/octet-stream;