⚡️ improve: channel add used
This commit is contained in:
parent
3c302279ef
commit
3cf92daef5
@ -263,8 +263,8 @@ func GetChannelExpensesByPeriod(startTimestamp, endTimestamp int64) (LogStatisti
|
||||
JOIN channels ON logs.channel_id = channels.id
|
||||
WHERE logs.type=2
|
||||
AND logs.created_at BETWEEN ? AND ?
|
||||
GROUP BY date, channels.name
|
||||
ORDER BY date, channels.name
|
||||
GROUP BY date, channels.id
|
||||
ORDER BY date, channels.id
|
||||
`, startTimestamp, endTimestamp).Scan(&LogStatistics).Error
|
||||
|
||||
return LogStatistics, err
|
||||
|
@ -37,7 +37,7 @@ import { IconDotsVertical, IconEdit, IconTrash, IconCopy, IconWorldWww } from '@
|
||||
import { styled, alpha } from '@mui/material/styles';
|
||||
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
||||
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
|
||||
import { copy } from 'utils/common';
|
||||
import { copy, renderQuota } from 'utils/common';
|
||||
|
||||
const StyledMenu = styled((props) => (
|
||||
<Menu
|
||||
@ -233,6 +233,7 @@ export default function ChannelTableRow({ item, manageChannel, handleOpenModal,
|
||||
{renderBalance(item.type, itemBalance)}
|
||||
</Tooltip>
|
||||
</TableCell>
|
||||
<TableCell>{renderQuota(item.used_quota)}</TableCell>
|
||||
<TableCell>
|
||||
<TextField
|
||||
id={`priority-${item.id}`}
|
||||
@ -350,7 +351,7 @@ export default function ChannelTableRow({ item, manageChannel, handleOpenModal,
|
||||
))}
|
||||
</StyledMenu>
|
||||
<TableRow>
|
||||
<TableCell style={{ paddingBottom: 0, paddingTop: 0, textAlign: 'left' }} colSpan={11}>
|
||||
<TableCell style={{ paddingBottom: 0, paddingTop: 0, textAlign: 'left' }} colSpan={12}>
|
||||
<Collapse in={openRow} timeout="auto" unmountOnExit>
|
||||
<Grid container spacing={1}>
|
||||
<Grid item xs={12}>
|
||||
|
@ -387,6 +387,7 @@ export default function ChannelPage() {
|
||||
{ id: 'status', label: '状态', disableSort: false },
|
||||
{ id: 'response_time', label: '响应时间', disableSort: false },
|
||||
{ id: 'balance', label: '余额', disableSort: false },
|
||||
{ id: 'used', label: '已使用', disableSort: false },
|
||||
{ id: 'priority', label: '优先级', disableSort: false, width: '80px' },
|
||||
{ id: 'weight', label: '权重', disableSort: false, width: '80px' },
|
||||
{ id: 'action', label: '操作', disableSort: true }
|
||||
|
@ -100,53 +100,6 @@ export default function TableToolBar({ filterName, handleFilterName, userIsAdmin
|
||||
/>
|
||||
</LocalizationProvider>
|
||||
</FormControl>
|
||||
</Stack>
|
||||
|
||||
<Stack direction={{ xs: 'column', sm: 'row' }} spacing={{ xs: 3, sm: 2, md: 4 }} padding={'24px'}>
|
||||
{userIsAdmin && (
|
||||
<FormControl>
|
||||
<InputLabel htmlFor="channel-channel-label">渠道ID</InputLabel>
|
||||
<OutlinedInput
|
||||
id="channel"
|
||||
name="channel"
|
||||
sx={{
|
||||
minWidth: '100%'
|
||||
}}
|
||||
label="渠道ID"
|
||||
value={filterName.channel}
|
||||
onChange={handleFilterName}
|
||||
placeholder="渠道ID"
|
||||
startAdornment={
|
||||
<InputAdornment position="start">
|
||||
<IconSitemap stroke={1.5} size="20px" color={grey500} />
|
||||
</InputAdornment>
|
||||
}
|
||||
/>
|
||||
</FormControl>
|
||||
)}
|
||||
|
||||
{userIsAdmin && (
|
||||
<FormControl>
|
||||
<InputLabel htmlFor="channel-username-label">用户名称</InputLabel>
|
||||
<OutlinedInput
|
||||
id="username"
|
||||
name="username"
|
||||
sx={{
|
||||
minWidth: '100%'
|
||||
}}
|
||||
label="用户名称"
|
||||
value={filterName.username}
|
||||
onChange={handleFilterName}
|
||||
placeholder="用户名称"
|
||||
startAdornment={
|
||||
<InputAdornment position="start">
|
||||
<IconUser stroke={1.5} size="20px" color={grey500} />
|
||||
</InputAdornment>
|
||||
}
|
||||
/>
|
||||
</FormControl>
|
||||
)}
|
||||
|
||||
<FormControl sx={{ minWidth: '22%' }}>
|
||||
<InputLabel htmlFor="channel-type-label">类型</InputLabel>
|
||||
<Select
|
||||
@ -176,6 +129,50 @@ export default function TableToolBar({ filterName, handleFilterName, userIsAdmin
|
||||
</Select>
|
||||
</FormControl>
|
||||
</Stack>
|
||||
|
||||
{userIsAdmin && (
|
||||
<Stack direction={{ xs: 'column', sm: 'row' }} spacing={{ xs: 3, sm: 2, md: 4 }} padding={'24px'}>
|
||||
<FormControl>
|
||||
<InputLabel htmlFor="channel-channel-label">渠道ID</InputLabel>
|
||||
<OutlinedInput
|
||||
id="channel"
|
||||
name="channel"
|
||||
sx={{
|
||||
minWidth: '100%'
|
||||
}}
|
||||
label="渠道ID"
|
||||
value={filterName.channel}
|
||||
onChange={handleFilterName}
|
||||
placeholder="渠道ID"
|
||||
startAdornment={
|
||||
<InputAdornment position="start">
|
||||
<IconSitemap stroke={1.5} size="20px" color={grey500} />
|
||||
</InputAdornment>
|
||||
}
|
||||
/>
|
||||
</FormControl>
|
||||
|
||||
<FormControl>
|
||||
<InputLabel htmlFor="channel-username-label">用户名称</InputLabel>
|
||||
<OutlinedInput
|
||||
id="username"
|
||||
name="username"
|
||||
sx={{
|
||||
minWidth: '100%'
|
||||
}}
|
||||
label="用户名称"
|
||||
value={filterName.username}
|
||||
onChange={handleFilterName}
|
||||
placeholder="用户名称"
|
||||
startAdornment={
|
||||
<InputAdornment position="start">
|
||||
<IconUser stroke={1.5} size="20px" color={grey500} />
|
||||
</InputAdornment>
|
||||
}
|
||||
/>
|
||||
</FormControl>
|
||||
</Stack>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user