2025-07-19 03:30:44 +08:00
|
|
|
|
/*
|
|
|
|
|
|
Copyright (C) 2025 QuantumNous
|
|
|
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
|
it under the terms of the GNU Affero General Public License as
|
|
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
For commercial licensing, please contact support@quantumnous.com
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2023-04-23 15:42:23 +08:00
|
|
|
|
export const CHANNEL_OPTIONS = [
|
2025-02-12 00:07:02 +08:00
|
|
|
|
{ value: 1, color: 'green', label: 'OpenAI' },
|
2024-03-23 21:24:39 +08:00
|
|
|
|
{
|
|
|
|
|
|
value: 2,
|
|
|
|
|
|
color: 'light-blue',
|
2025-04-04 12:00:38 +08:00
|
|
|
|
label: 'Midjourney Proxy',
|
2024-03-23 21:24:39 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
value: 5,
|
|
|
|
|
|
color: 'blue',
|
2025-04-04 12:00:38 +08:00
|
|
|
|
label: 'Midjourney Proxy Plus',
|
2024-03-23 21:24:39 +08:00
|
|
|
|
},
|
2024-06-12 20:37:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
value: 36,
|
|
|
|
|
|
color: 'purple',
|
2025-04-04 12:00:38 +08:00
|
|
|
|
label: 'Suno API',
|
2024-06-12 20:37:42 +08:00
|
|
|
|
},
|
2025-02-12 00:07:02 +08:00
|
|
|
|
{ value: 4, color: 'grey', label: 'Ollama' },
|
2024-03-23 21:24:39 +08:00
|
|
|
|
{
|
|
|
|
|
|
value: 14,
|
|
|
|
|
|
color: 'indigo',
|
2025-04-04 12:00:38 +08:00
|
|
|
|
label: 'Anthropic Claude',
|
2024-03-23 21:24:39 +08:00
|
|
|
|
},
|
2024-04-23 11:44:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
value: 33,
|
2024-04-23 12:19:23 +08:00
|
|
|
|
color: 'indigo',
|
2025-04-04 12:00:38 +08:00
|
|
|
|
label: 'AWS Claude',
|
2024-04-23 11:44:40 +08:00
|
|
|
|
},
|
2025-02-12 00:07:02 +08:00
|
|
|
|
{ value: 41, color: 'blue', label: 'Vertex AI' },
|
2024-03-23 21:24:39 +08:00
|
|
|
|
{
|
|
|
|
|
|
value: 3,
|
|
|
|
|
|
color: 'teal',
|
2025-04-04 12:00:38 +08:00
|
|
|
|
label: 'Azure OpenAI',
|
2024-03-23 21:24:39 +08:00
|
|
|
|
},
|
2024-04-24 18:49:56 +08:00
|
|
|
|
{
|
|
|
|
|
|
value: 34,
|
|
|
|
|
|
color: 'purple',
|
2025-04-04 12:00:38 +08:00
|
|
|
|
label: 'Cohere',
|
2024-04-24 18:49:56 +08:00
|
|
|
|
},
|
2025-02-12 00:07:02 +08:00
|
|
|
|
{ value: 39, color: 'grey', label: 'Cloudflare' },
|
|
|
|
|
|
{ value: 43, color: 'blue', label: 'DeepSeek' },
|
2024-03-23 21:24:39 +08:00
|
|
|
|
{
|
|
|
|
|
|
value: 15,
|
|
|
|
|
|
color: 'blue',
|
2025-04-04 12:00:38 +08:00
|
|
|
|
label: '百度文心千帆',
|
2024-03-23 21:24:39 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-02-12 00:07:02 +08:00
|
|
|
|
value: 46,
|
|
|
|
|
|
color: 'blue',
|
2025-04-04 12:00:38 +08:00
|
|
|
|
label: '百度文心千帆V2',
|
2025-02-12 00:07:02 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-03-23 21:24:39 +08:00
|
|
|
|
value: 17,
|
|
|
|
|
|
color: 'orange',
|
2025-04-04 12:00:38 +08:00
|
|
|
|
label: '阿里通义千问',
|
2024-03-23 21:24:39 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
value: 18,
|
|
|
|
|
|
color: 'blue',
|
2025-04-04 12:00:38 +08:00
|
|
|
|
label: '讯飞星火认知',
|
2024-03-23 21:24:39 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
value: 16,
|
|
|
|
|
|
color: 'violet',
|
2025-08-09 17:51:54 +08:00
|
|
|
|
label: '智谱 ChatGLM(已经弃用,请使用智谱 GLM-4V)',
|
2024-03-23 21:24:39 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
value: 26,
|
|
|
|
|
|
color: 'purple',
|
2025-04-04 12:00:38 +08:00
|
|
|
|
label: '智谱 GLM-4V',
|
2024-03-23 21:24:39 +08:00
|
|
|
|
},
|
2025-10-10 16:12:15 +08:00
|
|
|
|
{
|
|
|
|
|
|
value: 27,
|
|
|
|
|
|
color: 'blue',
|
|
|
|
|
|
label: 'Perplexity',
|
|
|
|
|
|
},
|
2024-12-05 17:50:08 +08:00
|
|
|
|
{
|
|
|
|
|
|
value: 24,
|
|
|
|
|
|
color: 'orange',
|
2025-04-04 12:00:38 +08:00
|
|
|
|
label: 'Google Gemini',
|
2024-12-05 17:50:08 +08:00
|
|
|
|
},
|
2024-05-16 19:06:35 +08:00
|
|
|
|
{
|
|
|
|
|
|
value: 11,
|
|
|
|
|
|
color: 'orange',
|
2025-04-04 12:00:38 +08:00
|
|
|
|
label: 'Google PaLM2',
|
2024-05-16 19:06:35 +08:00
|
|
|
|
},
|
2025-02-11 23:47:15 +08:00
|
|
|
|
{
|
2025-03-12 17:53:46 +08:00
|
|
|
|
value: 47,
|
2025-02-11 23:47:15 +08:00
|
|
|
|
color: 'blue',
|
2025-04-04 12:00:38 +08:00
|
|
|
|
label: 'Xinference',
|
2025-02-11 23:47:15 +08:00
|
|
|
|
},
|
2025-02-12 00:07:02 +08:00
|
|
|
|
{ value: 25, color: 'green', label: 'Moonshot' },
|
2025-03-12 17:53:46 +08:00
|
|
|
|
{ value: 20, color: 'green', label: 'OpenRouter' },
|
2025-02-12 00:07:02 +08:00
|
|
|
|
{ value: 19, color: 'blue', label: '360 智脑' },
|
|
|
|
|
|
{ value: 23, color: 'teal', label: '腾讯混元' },
|
|
|
|
|
|
{ value: 31, color: 'green', label: '零一万物' },
|
|
|
|
|
|
{ value: 35, color: 'green', label: 'MiniMax' },
|
|
|
|
|
|
{ value: 37, color: 'teal', label: 'Dify' },
|
|
|
|
|
|
{ value: 38, color: 'blue', label: 'Jina' },
|
|
|
|
|
|
{ value: 40, color: 'purple', label: 'SiliconCloud' },
|
|
|
|
|
|
{ value: 42, color: 'blue', label: 'Mistral AI' },
|
|
|
|
|
|
{ value: 8, color: 'pink', label: '自定义渠道' },
|
|
|
|
|
|
{
|
2024-03-23 21:24:39 +08:00
|
|
|
|
value: 22,
|
|
|
|
|
|
color: 'blue',
|
2025-04-04 12:00:38 +08:00
|
|
|
|
label: '知识库:FastGPT',
|
2024-03-23 21:24:39 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
value: 21,
|
|
|
|
|
|
color: 'purple',
|
2025-04-04 12:00:38 +08:00
|
|
|
|
label: '知识库:AI Proxy',
|
2025-01-22 04:21:08 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-02-12 00:07:02 +08:00
|
|
|
|
value: 44,
|
2025-01-22 04:21:08 +08:00
|
|
|
|
color: 'purple',
|
2025-04-04 12:00:38 +08:00
|
|
|
|
label: '嵌入模型:MokaAI M3E',
|
2025-03-12 17:53:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
value: 45,
|
|
|
|
|
|
color: 'blue',
|
2025-05-29 15:52:11 +08:00
|
|
|
|
label: '字节火山方舟、豆包通用',
|
2025-03-12 17:53:46 +08:00
|
|
|
|
},
|
2025-04-10 12:26:48 +08:00
|
|
|
|
{
|
|
|
|
|
|
value: 48,
|
|
|
|
|
|
color: 'blue',
|
2025-05-15 20:00:59 +08:00
|
|
|
|
label: 'xAI',
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
value: 49,
|
|
|
|
|
|
color: 'blue',
|
|
|
|
|
|
label: 'Coze',
|
|
|
|
|
|
},
|
2025-06-08 21:40:57 +08:00
|
|
|
|
{
|
|
|
|
|
|
value: 50,
|
|
|
|
|
|
color: 'green',
|
|
|
|
|
|
label: '可灵',
|
|
|
|
|
|
},
|
2025-06-20 15:50:00 +08:00
|
|
|
|
{
|
|
|
|
|
|
value: 51,
|
|
|
|
|
|
color: 'blue',
|
|
|
|
|
|
label: '即梦',
|
|
|
|
|
|
},
|
2025-09-08 16:21:21 +08:00
|
|
|
|
{
|
|
|
|
|
|
value: 52,
|
2025-07-23 10:22:52 +08:00
|
|
|
|
color: 'purple',
|
|
|
|
|
|
label: 'Vidu',
|
|
|
|
|
|
},
|
✨ feat: Add topup billing history with admin manual completion
Implement comprehensive topup billing system with user history viewing and admin management capabilities.
## Features Added
### Frontend
- Add topup history modal with paginated billing records
- Display order details: trade number, payment method, amount, money, status, create time
- Implement empty state with proper illustrations
- Add payment method column with localized display (Stripe, Alipay, WeChat)
- Add admin manual completion feature for pending orders
- Add Coins icon for recharge amount display
- Integrate "Bills" button in RechargeCard header
- Optimize code quality by using shared utility functions (isAdmin)
- Extract constants for status and payment method mappings
- Use React.useMemo for performance optimization
### Backend
- Create GET `/api/user/topup/self` endpoint for user topup history with pagination
- Create POST `/api/user/topup/complete` endpoint for admin manual order completion
- Add `payment_method` field to TopUp model for tracking payment types
- Implement `GetUserTopUps` method with proper pagination and ordering
- Implement `ManualCompleteTopUp` with transaction safety and row-level locking
- Add application-level mutex locks to prevent concurrent order processing
- Record payment method in Epay and Stripe payment flows
- Ensure idempotency and data consistency with proper error handling
### Internationalization
- Add i18n keys for Chinese (zh), English (en), and French (fr)
- Support for billing-related UI text and status messages
## Technical Improvements
- Use database transactions with FOR UPDATE row-level locking
- Implement sync.Map-based mutex for order-level concurrency control
- Proper error handling and user-friendly toast notifications
- Follow existing codebase patterns for empty states and modals
- Maintain code quality with extracted render functions and constants
## Files Changed
- Backend: controller/topup.go, controller/topup_stripe.go, model/topup.go, router/api-router.go
- Frontend: web/src/components/topup/modals/TopupHistoryModal.jsx (new), web/src/components/topup/RechargeCard.jsx, web/src/components/topup/index.jsx
- i18n: web/src/i18n/locales/{zh,en,fr}.json
2025-10-07 00:22:45 +08:00
|
|
|
|
{
|
2025-09-10 18:33:42 +08:00
|
|
|
|
value: 53,
|
2025-09-08 16:21:21 +08:00
|
|
|
|
color: 'blue',
|
|
|
|
|
|
label: 'SubModel',
|
|
|
|
|
|
},
|
2025-10-02 01:03:20 +08:00
|
|
|
|
{
|
|
|
|
|
|
value: 54,
|
|
|
|
|
|
color: 'blue',
|
|
|
|
|
|
label: '豆包视频',
|
|
|
|
|
|
},
|
2025-10-08 22:53:02 +08:00
|
|
|
|
{
|
|
|
|
|
|
value: 55,
|
|
|
|
|
|
color: 'green',
|
|
|
|
|
|
label: 'Sora',
|
|
|
|
|
|
},
|
2023-12-05 18:15:40 +08:00
|
|
|
|
];
|
2025-06-24 17:46:08 +08:00
|
|
|
|
|
|
|
|
|
|
export const MODEL_TABLE_PAGE_SIZE = 10;
|