feat(topup): add admin-only audit info to top-up logs

Thread caller IP from webhook/admin controllers through model recharge
functions and record a new RecordTopupLog entry with admin_info (server
IP, caller IP, order payment method, callback payment method, system
version). Frontend shows these fields in the expanded log row and the
IP column for admins on top-up logs, while non-admins continue to see
admin_info stripped by formatUserLogs.
This commit is contained in:
CaIon
2026-04-17 23:51:30 +08:00
parent e2807c5f95
commit 209d90e861
15 changed files with 3570 additions and 1617 deletions
@@ -876,7 +876,12 @@ export const getLogsColumns = ({
),
dataIndex: 'ip',
render: (text, record, index) => {
return (record.type === 2 || record.type === 5) && text ? (
const showIp =
(record.type === 2 ||
record.type === 5 ||
(isAdminUser && record.type === 1)) &&
text;
return showIp ? (
<Tooltip content={text}>
<span>
<Tag
+35 -2
View File
@@ -695,13 +695,13 @@ export const useLogsData = () => {
),
});
}
if (isAdminUser && logs[i].type !== 6) {
if (isAdminUser && logs[i].type !== 6 && logs[i].type !== 1) {
expandDataLocal.push({
key: t('请求转换'),
value: requestConversionDisplayValue(other?.request_conversion),
});
}
if (isAdminUser && logs[i].type !== 6) {
if (isAdminUser && logs[i].type !== 6 && logs[i].type !== 1) {
let localCountMode = '';
if (other?.admin_info?.local_count_tokens) {
localCountMode = t('本地计费');
@@ -713,6 +713,39 @@ export const useLogsData = () => {
value: localCountMode,
});
}
if (isAdminUser && logs[i].type === 1 && other?.admin_info) {
const adminInfo = other.admin_info;
if (adminInfo.payment_method) {
expandDataLocal.push({
key: t('订单支付方式'),
value: adminInfo.payment_method,
});
}
if (adminInfo.callback_payment_method) {
expandDataLocal.push({
key: t('回调支付方式'),
value: adminInfo.callback_payment_method,
});
}
if (adminInfo.caller_ip) {
expandDataLocal.push({
key: t('回调调用者IP'),
value: adminInfo.caller_ip,
});
}
if (adminInfo.server_ip) {
expandDataLocal.push({
key: t('服务器IP'),
value: adminInfo.server_ip,
});
}
if (adminInfo.version) {
expandDataLocal.push({
key: t('系统版本'),
value: adminInfo.version,
});
}
}
expandDatesLocal[logs[i].key] = expandDataLocal;
}
+343 -193
View File
File diff suppressed because it is too large Load Diff
+368 -205
View File
File diff suppressed because it is too large Load Diff
+342 -191
View File
File diff suppressed because it is too large Load Diff
+374 -205
View File
File diff suppressed because it is too large Load Diff
+343 -195
View File
File diff suppressed because it is too large Load Diff
+1052 -438
View File
File diff suppressed because it is too large Load Diff
+655 -165
View File
File diff suppressed because it is too large Load Diff