fix(reward-service/admin-web): 省市团队收益明细显示来源用户

问题根因:
- planting-service 发出的 Kafka 事件体未包含 accountSequence 字段
- 导致 reward_ledger_entries.source_account_sequence 列全部为 NULL
- 前端"来源用户"列因此始终显示 '-'

修复方案:
- reward-service getRewardEntriesByType 返回结果新增 memo 字段透传
- 前端 RewardEntryDTO 类型加 memo: string | null
- 省市团队收益明细"来源用户"列优先用 sourceAccountSequence,
  为空时通过正则 /来自用户([^\s的]+)/ 从 memo 中解析
  (memo 格式:'市团队权益(441300):来自用户D26031300003的认种')

涉及服务:reward-service、admin-web

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-13 11:23:12 -07:00
parent e306f346d3
commit a52081a94e
3 changed files with 12 additions and 2 deletions

View File

@ -1343,6 +1343,12 @@ export class RewardApplicationService {
createdAt: string;
claimedAt: string | null;
expiredAt: string | null;
// [2026-03-13] 新增:返回 memo 字段,用于前端在 sourceAccountSequence 为空时从 memo 解析来源用户。
// 背景planting-service 发出的 Kafka 事件未携带 accountSequence导致历史记录
// source_account_sequence 列全部为 NULL但 memo 中已记录了来源用户信息
// (格式:'市团队权益(441300)来自用户D26031300003的认种'
// 前端通过正则 /来自用户([^\s的]+)/ 从中提取账户序列号展示。
memo: string | null;
}>;
total: number;
page: number;
@ -1388,6 +1394,7 @@ export class RewardApplicationService {
createdAt: entry.createdAt.toISOString(),
claimedAt: entry.claimedAt?.toISOString() ?? null,
expiredAt: entry.expiredAt?.toISOString() ?? null,
memo: entry.memo ?? null, // [2026-03-13] 新增:透传 memo 供前端解析来源用户
})),
total,
page,

View File

@ -1742,8 +1742,8 @@ function RewardTypeSummarySection({
<td>{new Date(entry.createdAt).toLocaleString('zh-CN')}</td>
{/* [2026-01-07] 更新:使用 getAccountDisplayName 显示账户名称和编码 */}
<td>{getAccountDisplayName(entry.accountSequence)}</td>
{/* [2026-02-05] 新增:显示来源用户账户序列号 */}
<td>{entry.sourceAccountSequence ?? '-'}</td>
{/* [2026-02-05] 新增:显示来源用户账户序列号,从 memo 解析 */}
<td>{entry.sourceAccountSequence ?? entry.memo?.match(/来自用户([^\s的]+)/)?.[1] ?? '-'}</td>
<td className={styles.orderId}>{entry.sourceOrderId}</td>
<td>{formatAmount(entry.usdtAmount)}</td>
<td>

View File

@ -329,6 +329,9 @@ export interface RewardEntryDTO {
createdAt: string;
claimedAt: string | null;
expiredAt: string | null;
// [2026-03-13] 新增memo 原始备注,用于在 sourceAccountSequence 为空时解析来源用户
// 格式示例:'市团队权益(441300)来自用户D26031300003的认种'
memo: string | null;
}
/**