chore: update balance renderer
This commit is contained in:
parent
48ebff372b
commit
83605327c6
@ -4,7 +4,7 @@ import { Link } from 'react-router-dom';
|
|||||||
import { API, showError, showInfo, showSuccess, timestamp2string } from '../helpers';
|
import { API, showError, showInfo, showSuccess, timestamp2string } from '../helpers';
|
||||||
|
|
||||||
import { CHANNEL_OPTIONS, ITEMS_PER_PAGE } from '../constants';
|
import { CHANNEL_OPTIONS, ITEMS_PER_PAGE } from '../constants';
|
||||||
import { renderGroup } from '../helpers/render';
|
import { renderGroup, renderNumber } from '../helpers/render';
|
||||||
|
|
||||||
function renderTimestamp(timestamp) {
|
function renderTimestamp(timestamp) {
|
||||||
return (
|
return (
|
||||||
@ -28,10 +28,17 @@ function renderType(type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderBalance(type, balance) {
|
function renderBalance(type, balance) {
|
||||||
if (type === 5) {
|
switch (type) {
|
||||||
return <span>¥{(balance / 10000).toFixed(2)}</span>
|
case 1: // OpenAI
|
||||||
|
case 8: // 自定义
|
||||||
|
return <span>${balance.toFixed(2)}</span>;
|
||||||
|
case 5: // OpenAI-SB
|
||||||
|
return <span>¥{(balance / 10000).toFixed(2)}</span>;
|
||||||
|
case 10: // AI Proxy
|
||||||
|
return <span>{renderNumber(balance)}</span>;
|
||||||
|
default:
|
||||||
|
return <span>不支持</span>;
|
||||||
}
|
}
|
||||||
return <span>${balance.toFixed(2)}</span>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ChannelsTable = () => {
|
const ChannelsTable = () => {
|
||||||
@ -422,7 +429,8 @@ const ChannelsTable = () => {
|
|||||||
<Button size='small' loading={loading} onClick={testAllChannels}>
|
<Button size='small' loading={loading} onClick={testAllChannels}>
|
||||||
测试所有已启用通道
|
测试所有已启用通道
|
||||||
</Button>
|
</Button>
|
||||||
<Button size='small' onClick={updateAllChannelsBalance} loading={loading || updatingBalance}>更新所有已启用通道余额</Button>
|
<Button size='small' onClick={updateAllChannelsBalance}
|
||||||
|
loading={loading || updatingBalance}>更新所有已启用通道余额</Button>
|
||||||
<Pagination
|
<Pagination
|
||||||
floated='right'
|
floated='right'
|
||||||
activePage={activePage}
|
activePage={activePage}
|
||||||
|
Loading…
Reference in New Issue
Block a user