Repository navigation
预付款退款退还已使用额度 #4355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cts926
wants to merge
85
commits into
QuantumNous:main
Choose a base branch
from
lynxtoncloud:stc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
预付款退款退还已使用额度 #4355
Changes from 1 commit
Commits
Show all changes
85 commits
Select commit
Hold shift + click to select a range
6dd933c
预付款退款退还已使用额度
qqjyy f32dc37
Merge pull request #1 from lynxtoncloud/stc
cts926 b796bdb
暂时用回监听机制
qqjyy e7dea72
Merge pull request #2 from lynxtoncloud/stc
cts926 8387c46
改变消费趋势时间范围
qqjyy 1217fec
增加设置模型显示名称和模型输出类型
qqjyy cc68b83
增加prcing结构字段Modalities和DisplayName
qqjyy dc38021
Merge pull request #3 from lynxtoncloud/stc
cts926 c38d070
将企业折扣加入计费过程
qqjyy f619448
商业折扣应用于扣款
qqjyy babfc6d
更换商业折扣在计费流程的使用
qqjyy b83a5e8
增加应用折扣日志
qqjyy 06a52d2
增加日志
qqjyy 4456da0
增加日志
qqjyy 6aa098f
更改getUserOrgDiscount使用表名
qqjyy 79799c8
预扣费应用企业折扣,同时文本图片音频模型差额结算也应用企业折扣
qqjyy 4049e3c
Merge remote-tracking branch 'origin/stc' into stc
c4a7c3c
fmj-4/23-登录不允许不同设备同时登录,7天登录有效期。聊天界面和模型界面适配手机端
b7303d7
Merge remote-tracking branch 'origin/stc' into stc
3a4d4c5
增加预扣款时应用企业折扣的具体日志
qqjyy 1054b6d
取消文本音频模型应用企业折扣增加日志
qqjyy 9bca53c
Merge remote-tracking branch 'origin/stc' into fmj
8d3334d
Merge pull request #4 from lynxtoncloud/fmj
Azilier7 acf6bb5
添加对ModelDisplayName和ModelModalities的初始化和更新处理
qqjyy 1dd5d23
Merge pull request #5 from lynxtoncloud/stc
cts926 456f8a2
增加当OriginModelName为空时尝试从其他字段获取
qqjyy 1206d02
增加当OriginModelName为空时尝试从其他字段获取
qqjyy cf19679
Merge remote-tracking branch 'origin/stc' into stc
qqjyy 468bf12
解决视频模型调用消耗日志显示有误
qqjyy c1ab061
解决视频模型调用应用企业折扣有误
qqjyy b19c58a
解决重复应用企业折扣
qqjyy 50b2f37
解决重复应用企业折扣
qqjyy 4bb54d6
解决视频模型应用企业折扣后补扣
qqjyy 87f3978
解决视频模型应用企业折扣后补扣
qqjyy abbce9a
Merge pull request #6 from lynxtoncloud/stc
cts926 88cfdd0
增加调用NormalizeRecordedQuota日志显示
qqjyy 4ffbe50
测试NormalizeRecordedQuota
qqjyy c5328df
修改discountRate为orgDiscountRate
qqjyy ff877a0
Merge pull request #7 from lynxtoncloud/stc
cts926 baeb385
限制令牌限额不能小于零
qqjyy 6b18e41
Merge pull request #8 from lynxtoncloud/stc
cts926 2b57c75
修改管理日志显示货币符号,小数点后位数
qqjyy 150a13d
增加model_img字段显示和敏感词报错
qqjyy 9a6bad0
Merge pull request #9 from lynxtoncloud/stc
cts926 0e23eb4
将有企业的成员的充值面板撤去,新增企业充值面板,只有企业拥有者有权进行企业充值,企业普通成员无权访问企业充值面板
qqjyy 33168dc
日志页面耗时字段改为余额字段
qqjyy c34eecf
兑换码名字后加序号
qqjyy 0f10fdf
Merge pull request #10 from lynxtoncloud/stc
cts926 e0d9832
限流中间件达到限流时返回具体"请求过于频繁,请稍后再试",限流条件改为同一IP一分钟20次
qqjyy e046cd5
修复:豆包图生视频请求的 content 项补齐 role,避免图片输入报 role 缺失错误
Yxin-art 56c731c
修复:豆包视频任务仅对 image_url 设置 role,文本 content 禁止携带 role
Yxin-art 67a54dc
fix(doubao): 视频任务图片统一为 reference_image
Yxin-art e84c31d
fix(doubao): 区分 r2v 与 i2v,修复 seedance 1.0 Pro 的 task_type
Yxin-art 5e073fb
fix(doubao): 1.5 Pro 与 1.0 Pro 一样不走 r2v
Yxin-art fe0ea76
Merge remote-tracking branch 'origin/main' into stc
qqjyy b796d72
修改日志显示的余额
qqjyy 02ebc73
修改退还用户已用额度
qqjyy ee9245c
任务提交失败时,无需退还用户已用额度
qqjyy 36d28d3
异步任务资金调整改为强制立即写库
qqjyy ea1bd95
异步任务资金调整改回批量写库策略,日志快照按“数据库余额 + 未落库变更”记录。
qqjyy 957bfad
Merge pull request #11 from lynxtoncloud/stc
cts926 5c82499
fix(doubao):视频任务图片支持裸 base64 并保留 metadata 中的 image_url role
Yxin-art 8da1cc1
Merge branch 'dev2.0'
Yxin-art b156871
stc-5/7-21.12修复空返回仍然算任务成功
qqjyy fabdfda
Merge pull request #12 from lynxtoncloud/stc
cts926 4211409
stc-5/7-22.01解决文本等模型二次应用企业折扣
qqjyy 05aa22b
Merge pull request #13 from lynxtoncloud/stc
cts926 1d46970
stc-5/8-15:53为用户使用量聚合表添加end_at字段
qqjyy 0ba4d37
Merge pull request #14 from lynxtoncloud/stc
cts926 5d8cf8c
stc-5/12-10:41 feat(gateway): 新增 /v1/responses 请求转 chat completions 上…
qqjyy 884c78f
stc-5/12-10:51 feat(gateway): 新增 /v1/responses 请求转 chat completions 上…
qqjyy b22cc9c
stc-5/12-15:27 feat(usage): 新增个人与企业分钟级模型用量聚合表
qqjyy 057e862
Merge pull request #15 from lynxtoncloud/stc
cts926 aca670f
stc-5/13-10:04 fix(auth): 使用 Redis 存储验证码避免多实例校验失效
qqjyy ecc7fc8
stc-5/13-10:35 feat(auth): 新增单设备登录配置开关
qqjyy 635a77c
feat(ops): 计费快照写入 Gin 上下文供上游运维日志消费
Yxin-art 5e49edd
stc-5/13-15:34 fix(channel): 保存渠道时规范化 Base URL
qqjyy 05fe523
Merge pull request #16 from lynxtoncloud/stc
cts926 a6e0806
stc-5/13-18:07 fix(channel): 修复渠道多模型时除首个外报模型ID错误
qqjyy c733683
Merge pull request #17 from lynxtoncloud/stc
cts926 eb9d639
·
qqjyy 90ff23e
stc-5/14-14:39 fix(token):令牌额度不足时,切换列表展示下一位可用令牌使用
qqjyy 2e3d921
Merge pull request #18 from lynxtoncloud/stc
cts926 c36449a
feat(logging): add GinLogWriterFactory hook for structured gin log ro…
Yxin-art 5ce5a8a
stc-5/15-11:46 fix(logquota): 使用兑换码充值后,日志表记录的数据加上充值的具体金额
qqjyy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: QuantumNous/new-api
Length of output: 4392
🏁 Script executed:
Repository: QuantumNous/new-api
Length of output: 3164
🏁 Script executed:
Repository: QuantumNous/new-api
Length of output: 224
🏁 Script executed:
Repository: QuantumNous/new-api
Length of output: 1700
🏁 Script executed:
Repository: QuantumNous/new-api
Length of output: 45
Refund paths incorrectly decrement user request_count.
model.UpdateUserUsedQuotaAndRequestCountupdates bothused_quotaandrequest_countby 1, regardless of whether the quota parameter is positive or negative. Passing-quotaon the refund path (lines 168 and 233) will decrementrequest_countby 1.Semantically, a failed/refunded task should roll back quota usage but NOT decrement request_count — the user made a request regardless of success. Over time, this causes
request_countto drift and violates the expectation that it is monotonically increasing.The codebase already has
updateUserUsedQuota()(model/user.go:981) which updates onlyused_quotaand leavesrequest_countunchanged. Use this helper (or a public wrapper) for refunds instead:RefundTaskQuota: ReplaceUpdateUserUsedQuotaAndRequestCount(task.UserId, -quota)with a quota-only update.RecalculateTaskQuota: ReplaceUpdateUserUsedQuotaAndRequestCount(task.UserId, -quotaDelta)with a quota-only update.Apply the same fix to channel updates if
UpdateChannelUsedQuotaexhibits the same pattern.🤖 Prompt for AI Agents