feat(worker-platform): 优化打手我的寄卖卡片资料展示,前置展示打手自身上架账号资料
1. 后端 consignment-worker-service 在我的寄卖列表中解析并返回打手上架时填写的 sellerInfo(角色名、数字ID、区服系统、微信号/QQ、寄卖留言等); 2. 前端新增 ConsignmentSellerInfoBlock 卖家资料区块,提供角色名/ID高亮与一键复制功能; 3. 寄卖卡片布局升级为前置展示【我的寄卖账号资料】、后置展示【买家加好友资料】,多号上架时号主与买家清晰对应,彻底杜绝登错号加错人。
This commit is contained in:
@@ -70,6 +70,71 @@ function extractConsignmentGiftEvidenceFromWorkOrder(boundWo?: WorkOrderRow | nu
|
||||
}
|
||||
}
|
||||
|
||||
export type ConsignmentSellerInfo = {
|
||||
characterName: string
|
||||
characterId: string
|
||||
sellerContact?: string
|
||||
sellerPhone?: string
|
||||
sellerNote?: string
|
||||
system?: string
|
||||
serverZone?: string
|
||||
}
|
||||
|
||||
function extractConsignmentSellerInfoFromSubmission(
|
||||
sub: Awaited<ReturnType<typeof listConsignmentSubmissions>>['items'][number],
|
||||
): ConsignmentSellerInfo {
|
||||
const content = toRecord(sub.content_json) || {}
|
||||
let characterName = String(content.characterName || '').trim()
|
||||
let characterId = String(content.characterId || '').trim()
|
||||
|
||||
if (!characterName && sub.seller_game_id) {
|
||||
const raw = String(sub.seller_game_id).trim()
|
||||
const match = raw.match(/^(.*?)\s*\((.*?)\)$/)
|
||||
if (match) {
|
||||
characterName = match[1]?.trim() || raw
|
||||
if (!characterId) characterId = match[2]?.trim() || ''
|
||||
} else {
|
||||
characterName = raw
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
characterName,
|
||||
characterId,
|
||||
sellerContact: String(sub.contact_info || '').trim(),
|
||||
sellerPhone: String(sub.seller_phone || '').trim(),
|
||||
sellerNote: String(content.sellerNote || '').trim(),
|
||||
system: sub.system,
|
||||
serverZone: sub.server_zone,
|
||||
}
|
||||
}
|
||||
|
||||
function extractConsignmentSellerInfoFromInventory(
|
||||
inv: Awaited<ReturnType<typeof listConsignmentInventories>>['items'][number],
|
||||
): ConsignmentSellerInfo {
|
||||
let characterName = ''
|
||||
let characterId = ''
|
||||
if (inv.seller_game_id) {
|
||||
const raw = String(inv.seller_game_id).trim()
|
||||
const match = raw.match(/^(.*?)\s*\((.*?)\)$/)
|
||||
if (match) {
|
||||
characterName = match[1]?.trim() || raw
|
||||
characterId = match[2]?.trim() || ''
|
||||
} else {
|
||||
characterName = raw
|
||||
}
|
||||
}
|
||||
return {
|
||||
characterName,
|
||||
characterId,
|
||||
sellerContact: String(inv.seller_contact || '').trim(),
|
||||
sellerPhone: String(inv.seller_phone || '').trim(),
|
||||
sellerNote: String(inv.remark || '').trim(),
|
||||
system: inv.system,
|
||||
serverZone: inv.server_zone,
|
||||
}
|
||||
}
|
||||
|
||||
export function getConsignmentPublishDepositFen() {
|
||||
return getConfiguredConsignmentPublishDepositFen()
|
||||
}
|
||||
@@ -358,6 +423,7 @@ export async function listWorkerConsignments(workerId: number) {
|
||||
friendAddedAt: inv?.bound_work_order_id
|
||||
? (workOrderById.get(Number(inv.bound_work_order_id))?.friend_added_at ?? null)
|
||||
: null,
|
||||
sellerInfo: extractConsignmentSellerInfoFromSubmission(sub),
|
||||
buyerInfo: extractConsignmentBuyerInfoFromWorkOrder(boundWo),
|
||||
}
|
||||
}),
|
||||
@@ -397,6 +463,7 @@ export async function listWorkerConsignments(workerId: number) {
|
||||
friendAddedAt: inv.bound_work_order_id
|
||||
? (workOrderById.get(Number(inv.bound_work_order_id))?.friend_added_at ?? null)
|
||||
: null,
|
||||
sellerInfo: extractConsignmentSellerInfoFromInventory(inv),
|
||||
buyerInfo: extractConsignmentBuyerInfoFromWorkOrder(boundWo),
|
||||
}
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user