fix: 修复域能管理操作无响应及公户账务错误

- 修复前端 energy.js api.post/get 回调调用为 Promise 链式调用,解决操作无响应
- 修复 AdminAdjust system_operation 模式错误扣减公户余额,现不碰公户
- 修复 AdminAdjust admin_transfer 模式公户按用户数量扣款(amount * len(userIDs))
- 修复 AdminAdjust 余额检查移入事务内并加行锁(SELECT FOR UPDATE),防 TOCTOU 竞态
- FundStore 接口及 FundRepo 新增 LockAndGetBalance 方法
This commit is contained in:
2026-06-01 15:26:25 +08:00
parent 26e557de8a
commit 4815060839
4 changed files with 39 additions and 30 deletions

View File

@ -114,6 +114,7 @@ type energyStore = EnergyStore
// FundStore 公户仓储接口ISP
type FundStore interface {
GetBalance() (int, error)
LockAndGetBalance() (int, error)
IncrBalance(amount int) error
CreateLog(log *model.FundLog) error
ListLogs(logType string, offset, limit int) ([]model.FundLog, int64, error)