feat(admin): 后台可配领取链接/发消息模板 + 可见买家账号 + 修正皮肤领取链接

**面板新增三项(抖音码速达接入配置)**
- 领取链接基址 (claimLinkBase):带实时预览「皮肤订单最终链接」,并拦截两类误配 ——
  带 `#`(`#/claim` 是打手领取页,会把买家带进绑定 UID 流程)、缺 http(s) 协议
- 发消息模板 (messageTemplate):提示可用占位符;模板里没有 `{link}` 直接报错提示
- 付款后发领取消息开关 (claimMessageEnabled)
- 顺带把默认出网超时的展示值对齐后端(10s → 20s)

**后台可见买家提交的账号(运营发货依据)**
- `getAdminTaskDetail` 新增 `claimSubmission`,按 `canViewSensitiveTaskData` 门禁下发
  (与 claimToken 明文同一门禁);任务详情新增「买家提交信息」卡片(可一键复制账号)

**修正:皮肤任务的领取链接**
- 详情接口原来用全局 `buildClaimUrl`(默认 hash 形式 `…/#/claim/…`),那是**打手**领取页;
  皮肤任务改用 `claimLinkBase + '/' + token`,运营复制给买家的链接才是买家页
- 顺带把「履约渠道」筛选项加上「皮肤自动发货」、任务详情执行器标签加上它、
  「来源渠道」加上「抖音码速达」(此前筛不出来抖音订单)
This commit is contained in:
yml2213
2026-10-09 15:06:49 +08:00
parent 56a8184576
commit b70741daec
9 changed files with 269 additions and 7 deletions
@@ -361,6 +361,33 @@ export default function AdminTaskDetailPage() {
</Card>
) : null}
{/* 皮肤自动发货:买家在领取页提交的游戏账号是发货依据,单独成卡,避免被领取链接卡片挤掉 */}
{resolvedDetail.claimSubmission ? (
<Card title="买家提交信息">
<Space direction="vertical" size={4}>
<Typography.Text type="secondary">
买家在领取页填写的游戏账号(发货依据,属买家隐私,请勿外传)
</Typography.Text>
<Space wrap size={8}>
<Typography.Text strong style={{ fontSize: 15 }}>
{resolvedDetail.claimSubmission.gameAccount}
</Typography.Text>
<Typography.Text
type="secondary"
copyable={{ text: resolvedDetail.claimSubmission.gameAccount }}
>
复制
</Typography.Text>
</Space>
{resolvedDetail.claimSubmission.submittedAt ? (
<Typography.Text type="secondary">
提交时间:{formatAdminDateTime(resolvedDetail.claimSubmission.submittedAt)}
</Typography.Text>
) : null}
</Space>
</Card>
) : null}
{resolvedDetail.task.executorKey === 'manual_dispatch' ||
resolvedDetail.operations.canCompleteManualDispatch ||
resolvedDetail.manualDispatch ? (
@@ -856,6 +883,9 @@ function resolveTaskExecutorDisplay(value: unknown) {
if (executorKey === 'kuaishou_feifei') {
return { label: '飞飞(已下线)', color: 'default' }
}
if (executorKey === 'douyin_mashida_skin') {
return { label: '皮肤自动发货', color: 'magenta' }
}
if (executorKey === 'manual_dispatch') {
return { label: '人工履约', color: 'orange' }
}
@@ -30,7 +30,10 @@ import {
} from '@/services/admin/platform-config'
import type { AdminDouyinMashidaConfig } from '@/types/admin/platform-config'
import {
buildDouyinMashidaClaimLinkPreview,
buildDouyinMashidaMessageUrl,
describeClaimLinkBaseWarning,
describeMessageTemplateWarning,
describeMissingConfigFields,
isLocalDevBaseUrl,
} from '@/utils/douyin-mashida'
@@ -59,10 +62,13 @@ function createEmptyConfig(): AdminDouyinMashidaConfig {
secretMasked: '',
hasSecret: false,
certLink: '',
claimLinkBase: '',
messageTemplate: '',
claimMessageEnabled: true,
afterVerifyLink: '',
afterVerifyMessage: '您的订单已兑换成功',
messageType: 2,
timeoutMs: 10000,
timeoutMs: 20000,
handledTopics: [...DEFAULT_HANDLED_TOPICS],
ready: false,
}
@@ -144,6 +150,9 @@ export function DouyinMashidaPanel() {
})
const isLocalDev = isLocalDevBaseUrl(config.baseUrl)
const messageUrl = buildDouyinMashidaMessageUrl(window.location.origin)
const claimLinkPreview = buildDouyinMashidaClaimLinkPreview(config.claimLinkBase)
const claimLinkWarning = describeClaimLinkBaseWarning(config.claimLinkBase)
const messageTemplateWarning = describeMessageTemplateWarning(config.messageTemplate)
return (
<Card
@@ -274,7 +283,65 @@ export function DouyinMashidaPanel() {
placeholder="https://你的域名/redeem"
/>
<Text type="secondary" style={{ fontSize: 12 }}>
卡券里下发给买家的固定兑换链接
通用兜底兑换链接(皮肤订单解析不出领取链接时才用它)
</Text>
</Space>
</Col>
<Col xs={24} sm={12} md={8}>
<Space direction="vertical" size={4} style={{ width: '100%' }}>
<Text strong>领取链接基址 (claimLinkBase)</Text>
<Input
value={config.claimLinkBase}
onChange={(event) => updateField('claimLinkBase', event.target.value)}
placeholder="https://你的域名/claim"
/>
{claimLinkPreview ? (
<Text type="secondary" style={{ fontSize: 12 }}>
皮肤订单最终链接:{claimLinkPreview}
</Text>
) : (
<Text type="secondary" style={{ fontSize: 12 }}>
皮肤自动发货订单的领取页基址,留空则回退到上面的兑换链接
</Text>
)}
{claimLinkWarning ? (
<Text type="danger" style={{ fontSize: 12 }}>
{claimLinkWarning}
</Text>
) : null}
</Space>
</Col>
<Col xs={24} sm={12} md={8}>
<Space direction="vertical" size={4} style={{ width: '100%' }}>
<Text strong>发消息模板 (messageTemplate)</Text>
<Input
value={config.messageTemplate}
onChange={(event) => updateField('messageTemplate', event.target.value)}
placeholder="您的订单已发货,请点击链接领取:{link}"
/>
<Text type="secondary" style={{ fontSize: 12 }}>
占位符:{'{link}'} 领取链接、{'{sku}'} 内部SKU、{'{orderNo}'} 订单号、
{'{productTitle}'} 商品标题;留空用默认文案
</Text>
{messageTemplateWarning ? (
<Text type="danger" style={{ fontSize: 12 }}>
{messageTemplateWarning}
</Text>
) : null}
</Space>
</Col>
<Col xs={24} sm={12} md={8}>
<Space direction="vertical" size={4} style={{ width: '100%' }}>
<Text strong>付款后发领取消息 (claimMessageEnabled)</Text>
<Switch
checked={config.claimMessageEnabled}
onChange={(checked) => updateField('claimMessageEnabled', checked)}
/>
<Text type="secondary" style={{ fontSize: 12 }}>
关闭后只把领取链接写进卡券,不发订单消息
</Text>
</Space>
</Col>
@@ -17,15 +17,21 @@ export interface AdminDouyinMashidaConfig {
/** 脱敏后的秘钥,形如 abcd****wxyz */
secretMasked: string
hasSecret: boolean
/** 卡券里的固定兑换链接,如 https://<域名>/redeem */
/** 通用兜底兑换链接,如 https://<域名>/redeem(皮肤订单解析不出领取链接时才用它) */
certLink: string
/** 皮肤自动发货的领取页基址,如 https://<域名>/claim;最终链接 = 基址 + '/' + token */
claimLinkBase: string
/** 付款后发给买家的领取消息模板,支持 {link}/{sku}/{orderNo}/{productTitle};留空用默认文案 */
messageTemplate: string
/** 付款建单+发券后是否给买家发领取消息(默认 true) */
claimMessageEnabled: boolean
/** 兑换成功后发给买家的「去使用链接」 */
afterVerifyLink: string
/** 兑换成功通知正文,默认「您的订单已兑换成功」 */
afterVerifyMessage: string
/** 1-订单状态 2-订单发货 4-图片 5-视频 */
messageType: number
/** 出网超时(毫秒),默认 10000 */
/** 出网超时(毫秒),默认 20000(平台业务错误要 ~10.5s 才返回) */
timeoutMs: number
/** 本地处理白名单 topic */
handledTopics: string[]
+5
View File
@@ -101,6 +101,11 @@ export interface AdminTaskDetail {
expiredAt: string
claimUrl: string
}
/** 皮肤自动发货:买家在领取页提交的游戏账号(无权限时后端下发 null) */
claimSubmission: null | {
gameAccount: string
submittedAt: string
}
artifacts: Record<string, unknown>
screenshotUrl: string
review: {
+4
View File
@@ -10,10 +10,14 @@ export const adminOrderProviderOptions = [
{ label: '拼多多', value: 'pdd' },
{ label: '91卡券', value: '91kaquan' },
{ label: '快手', value: 'kuaishou' },
// 抖音码速达:订单落在 orders.provider='douyin_mashida'(platform='doudian')
{ label: '抖音码速达', value: 'douyin_mashida' },
]
export const adminOrderExecutorOptions = [
{ label: '联盟发货', value: 'affiliate_dash' },
// 抖音码速达皮肤类:建任务 + 生成领取链接,买家自己填账号领取
{ label: '皮肤自动发货', value: 'douyin_mashida_skin' },
{ label: '行业凭证', value: 'kuaishou-industry' },
{ label: '人工履约', value: 'manual_dispatch' },
]
+50
View File
@@ -62,3 +62,53 @@ export function describeMissingConfigFields(config: MissingConfigCheck): string[
return missing
}
/**
* 面板预览用的示例 token(48 位 hex,与真实 claim token 形态一致)。
*/
const CLAIM_LINK_PREVIEW_TOKEN = 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6'
/**
* 拼一条领取链接预览:`claimLinkBase` 去尾斜杠 + '/' + token。
* 规则与后端拼装一致(后端用配置里的 `claimLinkBase`)。
* 基址为空返回空串(后端会回退到通用兑换链接)。
*/
export function buildDouyinMashidaClaimLinkPreview(
claimLinkBase: string,
token = CLAIM_LINK_PREVIEW_TOKEN,
): string {
const base = String(claimLinkBase ?? '')
.trim()
.replace(/\/+$/, '')
if (!base) return ''
return `${base}/${String(token ?? '').trim()}`
}
/**
* 领取链接基址的误配提示(无问题返回空串)。
*
* 重点拦 `#`:`#/claim/{token}` 是**打手**领取页(要绑游戏 UID),
* 皮肤买家链接必须是路径式,配错会把买家带到打手流程里。
*/
export function describeClaimLinkBaseWarning(claimLinkBase: string): string {
const text = String(claimLinkBase ?? '').trim()
if (!text) return ''
if (text.includes('#')) {
return '不要带 #:#/claim 是打手领取页,皮肤买家链接请用路径式,例如 https://你的域名/claim'
}
if (!/^https?:\/\//i.test(text)) {
return '请填完整地址(http:// 或 https:// 开头),例如 https://你的域名/claim'
}
return ''
}
/**
* 发消息模板提示(无问题返回空串):模板里没有 {link} 就等于没把领取链接给买家。
*/
export function describeMessageTemplateWarning(messageTemplate: string): string {
const text = String(messageTemplate ?? '').trim()
if (text && !text.includes('{link}')) {
return '模板里没有 {link} 占位符,买家将拿不到领取链接'
}
return ''
}