新功能: 佣金回退日志 content 改成中文友好描述

之前接口返回原始 JSON 字符串(前端不好展示):
  "{\"type\":333,\"amount\":-649,\"order_no\":\"xxx\",\"timestamp\":\"...\"}"

改为可读文字:
  333 订单退款回佣 → "订单退款回佣(订单号 xxx)"
  337 提现驳回   → "提现申请被驳回,佣金已退回"
  338 提现取消   → "已取消提现,佣金已退回"

同时影响以下两个接口的 content 字段:
- /v1/public/user/withdrawal_log?biz_type=commission_refund (deprecated)
- /v1/public/user/commission_return_log
This commit is contained in:
2026-06-12 20:35:27 -07:00
parent be09a115ec
commit 08434cfa32
@@ -142,7 +142,7 @@ func (l *QueryCommissionReturnLogLogic) queryCommissionReturnLogRecordsByEventTy
UserID: row.ObjectID, UserID: row.ObjectID,
Amount: content.Amount, Amount: content.Amount,
EventType: content.Type, EventType: content.Type,
Content: row.Content, Content: commissionReturnLogContentText(content.Type, content.OrderNo),
CreatedAt: timestamp, CreatedAt: timestamp,
UpdatedAt: timestamp, UpdatedAt: timestamp,
}) })
@@ -163,3 +163,21 @@ func isCommissionReturnEventType(eventType uint16) bool {
return false return false
} }
} }
// commissionReturnLogContentText 把佣金回退事件的原始 JSON 转成前端友好文字。
// 333 订单退款回佣 - 附订单号便于追溯;337/338 提现相关 - 跟订单无关。
func commissionReturnLogContentText(eventType uint16, orderNo string) string {
switch eventType {
case log.CommissionTypeRefund:
if strings.TrimSpace(orderNo) != "" {
return "订单退款回佣(订单号 " + orderNo + ")"
}
return "订单退款回佣"
case log.CommissionTypeWithdrawReject:
return "提现申请被驳回,佣金已退回"
case log.CommissionTypeWithdrawCancel:
return "已取消提现,佣金已退回"
default:
return "佣金调整"
}
}