合并 main 分支并融合订单列表最小化与 SQL 治理

- Auth/权限中间件取 main 演进版(错误细分、token 来源),保留 dev 的用户 cookie 与登出撤销语义
- 后台订单列表:融合 main 的首页免 COUNT 优化与关键词索引路由,保留 dev 的最小化 AdminOrderListItemDTO(结账明细仍由详情接口返回,同步调整对应集成测试)
- 保留 dev 的 token_version 冻结/解冻递增与 main 的状态变化判断及通知
- 前端:保留 dev 登出接口与 main 的 fetchMe silent 参数、SSE 登录跳转;后台订单表按 dev 最小化 DTO 移除号主到手列
This commit is contained in:
yml2213
2026-09-05 11:43:13 +08:00
294 changed files with 30171 additions and 13439 deletions
+13 -1
View File
@@ -108,6 +108,8 @@ func (row orderRow) toAdminDTO() OrderDTO {
GrowthPointsAwarded: row.GrowthPointsAwarded,
GrowthPointsAwardedAt: row.GrowthPointsAwardedAt,
AccountSnapshot: row.AccountSnapshot,
AccountSource: effectiveAccountSource(row.RentalOrder),
SourceChannel: row.SourceChannel,
Status: row.Status,
HandoffStatus: row.HandoffStatus,
HandoffMode: effectiveHandoffMode(row.RentalOrder),
@@ -132,6 +134,13 @@ func (row orderRow) toAdminDTO() OrderDTO {
}
}
func effectiveAccountSource(order model.RentalOrder) string {
if order.AccountSource != "" {
return order.AccountSource
}
return "internal"
}
func (row orderRow) toDTOForUser(userID uint64) OrderDTO {
dto := row.toAdminDTO()
dto.AdminActions = nil
@@ -147,6 +156,9 @@ func (row orderRow) toDTOForUser(userID uint64) OrderDTO {
dto.OfflineSettlementRemark = ""
dto.OfflineSettledBy = nil
dto.OfflineSettledAt = nil
// 外部来源渠道属于后台经营信息,仅在管理员订单详情展示。
dto.AccountSource = ""
dto.SourceChannel = ""
applyOrderPriceView(&dto, row.RentalOrder, userID)
return dto
}
@@ -335,7 +347,7 @@ func refreshCheckoutSettlementDTO(dto *CheckoutDTO, order model.RentalOrder, che
if checkout.Status != checkoutStatusSubmitted && checkout.Status != checkoutStatusCountered {
return
}
settlement := calculateCheckoutSettlement(order, checkout.ConsumableAmountCent, checkout.CoinConsumedM, checkout.DepositDeductAmountCent)
settlement := calculateCheckoutSettlement(order, checkout.ConsumableAmountCent, checkout.CoinConsumedM, effectiveCheckoutDepositDeductCent(checkout))
rent := settlement.ActualRentAmountCent
ownerRent := settlement.OwnerRentIncomeCent
platform := settlement.PlatformFeeCent