Author SHA1 Message Date
yml af38bbaddb 优化(斗鱼领取): 游戏主页截图改为游戏名字/UID核对并增加示例图
- 文案去掉斗鱼个人主页,改为游戏主页截图
- 提示需能看到游戏名字和游戏 UID
- 上传框右侧增加实例图片
- 调整移动端上传/示例布局
2026-11-25 00:16:31 +08:00
yml 0357020387 修复(斗鱼领取): 绑定任务已失败时不误归为准备中 2026-11-24 22:37:49 +08:00
yml ad4b6f01e5 安全(斗鱼领取): 主页截图上传增加订单/IP限流
- 防止公开领取页被批量刷 OSS
- 订单维度 10 次/分钟,IP 维度 30 次/分钟
2026-11-24 22:35:55 +08:00
yml 05fa658400 修复(斗鱼领取): 账号分配冷却不再误报角色绑定失败
- 尚未开始绑定、只是选号遇到账号换绑冷却时归为 preparing
- 只有绑定任务/二维码/待确认/已确认或 bindingStatus=failed 才归为 failed
- 补充分配冷却状态测试
2026-11-24 22:08:54 +08:00
yml cab333f410 功能(斗鱼领取): 客户资料必填个人主页截图
- 新增客户主页截图迁移、上传接口和文件归属校验
- 领取页必填上传后才能提交资料
- 快照通过 outbox 携带 customerProfile/homeImages 同步 live-hub
2026-11-24 21:21:22 +08:00
9 changed files with 515 additions and 4 deletions
@@ -0,0 +1,211 @@
-- 180_douyu_customer_homepage_screenshot.sql
--
-- 斗鱼客户领取页增加必填用户主页截图:
-- 1. 截图对象和展示地址作为斗鱼任务正式字段保存;
-- 2. 客户资料变化继续通过订单项快照事务 Outbox 同步 live-hub;
-- 3. 快照升级到 contractVersion=3,携带客户资料和主页截图。
ALTER TABLE douyu_fulfillment_tasks
ADD COLUMN IF NOT EXISTS customer_homepage_screenshot_object_key TEXT NOT NULL DEFAULT '',
ADD COLUMN IF NOT EXISTS customer_homepage_screenshot_url TEXT NOT NULL DEFAULT '',
ADD COLUMN IF NOT EXISTS customer_homepage_screenshot_thumbnail_url TEXT NOT NULL DEFAULT '',
ADD COLUMN IF NOT EXISTS customer_homepage_screenshot_filename TEXT NOT NULL DEFAULT '',
ADD COLUMN IF NOT EXISTS customer_homepage_screenshot_uploaded_at TIMESTAMPTZ;
COMMENT ON COLUMN douyu_fulfillment_tasks.customer_homepage_screenshot_object_key IS
'客户上传的斗鱼个人主页截图对象 key;文件台账和归属校验以 file_assets 为准';
COMMENT ON COLUMN douyu_fulfillment_tasks.customer_homepage_screenshot_url IS
'客户主页截图稳定展示地址;供 order_site 和 live-hub 工作台读取';
COMMENT ON COLUMN douyu_fulfillment_tasks.customer_homepage_screenshot_thumbnail_url IS
'客户主页截图缩略图稳定展示地址';
COMMENT ON COLUMN douyu_fulfillment_tasks.customer_homepage_screenshot_uploaded_at IS
'客户主页截图随资料提交保存的时间';
CREATE OR REPLACE FUNCTION enqueue_live_hub_platform_fulfillment_event(
p_order_id BIGINT,
p_order_item_id BIGINT,
p_fulfillment_id BIGINT,
p_reason TEXT
) RETURNS VOID
LANGUAGE plpgsql
AS $$
DECLARE
v_event_id UUID := gen_random_uuid();
v_snapshot JSONB;
v_dedupe_key TEXT;
BEGIN
SELECT jsonb_build_object(
'orderId', o.id,
'orderItemId', oi.id,
'fulfillmentId', f.id,
'sourceOrderId', o.id::text,
'sourceOrderItemId', oi.id::text,
'sourceFulfillmentId', f.id::text,
'platformOrderId', o.platform_order_id,
'provider', o.provider,
'platform', o.platform,
'shopId', o.shop_id,
'shopName', o.shop_name,
'orderStatus', o.order_status,
'payStatus', o.pay_status,
'totalAmountFen', o.total_amount,
'orderCreatedAt', to_char(
o.created_at AT TIME ZONE 'UTC',
'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"'
),
'paidAt', CASE
WHEN o.paid_at IS NULL THEN NULL
ELSE to_char(o.paid_at AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"')
END,
'skuCode', oi.sku_code,
'skuName', oi.sku_name,
'internalSkuKey', cfg.sku_key,
'quantity', oi.quantity,
'revenueAmountFen', oi.revenue_amount_fen,
'itemUpdatedAt', to_char(
oi.updated_at AT TIME ZONE 'UTC',
'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"'
),
'fulfillmentStatus', f.status,
'fulfillmentChannel', f.channel,
'fulfillmentIssueCode', COALESCE(f.issue_code, ''),
'fulfillmentUpdatedAt', to_char(
f.updated_at AT TIME ZONE 'UTC',
'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"'
),
'configEnabled', cfg.enabled,
'douyuFulfillmentEnabled', cfg.douyu_fulfillment_enabled,
'customerRoleName', COALESCE(task.customer_role_name, ''),
'customerPlatform', COALESCE(task.customer_platform, ''),
'customerSystem', COALESCE(task.customer_system, ''),
'homeImages', CASE
WHEN COALESCE(task.customer_homepage_screenshot_object_key, '') = ''
AND COALESCE(task.customer_homepage_screenshot_url, '') = ''
THEN '[]'::jsonb
ELSE jsonb_build_array(jsonb_build_object(
'url', COALESCE(task.customer_homepage_screenshot_url, ''),
'thumbnailUrl', COALESCE(
NULLIF(task.customer_homepage_screenshot_thumbnail_url, ''),
task.customer_homepage_screenshot_url,
''
),
'objectKey', COALESCE(task.customer_homepage_screenshot_object_key, ''),
'filename', COALESCE(task.customer_homepage_screenshot_filename, '')
))
END,
'customerProfileUpdatedAt', CASE
WHEN task.customer_homepage_screenshot_uploaded_at IS NULL THEN NULL
ELSE to_char(
task.customer_homepage_screenshot_uploaded_at AT TIME ZONE 'UTC',
'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"'
)
END
)
INTO v_snapshot
FROM orders o
JOIN order_items oi ON oi.order_id = o.id
JOIN fulfillments f ON f.order_item_id = oi.id
JOIN manual_fulfillment_configs cfg ON cfg.id = f.fulfillment_config_id
LEFT JOIN douyu_fulfillment_tasks task ON task.order_item_id = oi.id
WHERE o.id = p_order_id
AND oi.id = p_order_item_id
AND f.id = p_fulfillment_id
LIMIT 1;
IF v_snapshot IS NULL THEN
RETURN;
END IF;
v_dedupe_key := CONCAT(
'platform-fulfillment-order:',
p_order_item_id,
':',
md5(v_snapshot::text)
);
INSERT INTO integration_outbox (
event_id, destination, event_type, dedupe_key, payload_json, status, created_at
) VALUES (
v_event_id,
'live_hub',
'platform_fulfillment.order_snapshot',
v_dedupe_key,
jsonb_build_object(
'eventId', v_event_id::text,
'eventType', 'platform_fulfillment.order_snapshot',
'contractVersion', 3,
'occurredAt', to_char(
clock_timestamp() AT TIME ZONE 'UTC',
'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"'
),
'data', v_snapshot || jsonb_build_object(
'reason', COALESCE(p_reason, '')
)
),
'pending',
NOW()
)
ON CONFLICT (dedupe_key) DO NOTHING;
END;
$$;
CREATE OR REPLACE FUNCTION enqueue_platform_fulfillment_from_douyu_task()
RETURNS TRIGGER
LANGUAGE plpgsql
AS $$
BEGIN
IF NEW.fulfillment_id IS NOT NULL THEN
PERFORM enqueue_live_hub_platform_fulfillment_event(
NEW.order_id,
NEW.order_item_id,
NEW.fulfillment_id,
CONCAT('customer-profile:', NEW.status)
);
END IF;
RETURN NEW;
END;
$$;
DROP TRIGGER IF EXISTS trg_platform_fulfillment_douyu_task_sync
ON douyu_fulfillment_tasks;
CREATE TRIGGER trg_platform_fulfillment_douyu_task_sync
AFTER INSERT OR UPDATE OF
customer_role_name,
customer_platform,
customer_system,
customer_homepage_screenshot_object_key,
customer_homepage_screenshot_url,
customer_homepage_screenshot_thumbnail_url,
customer_homepage_screenshot_filename,
customer_homepage_screenshot_uploaded_at
ON douyu_fulfillment_tasks
FOR EACH ROW
EXECUTE FUNCTION enqueue_platform_fulfillment_from_douyu_task();
-- 已有活动任务补一次 contractVersion=3 快照,让 live-hub 立即拿到当前客户资料。
DO $$
DECLARE
candidate RECORD;
BEGIN
FOR candidate IN
SELECT
task.order_id,
task.order_item_id,
task.fulfillment_id
FROM douyu_fulfillment_tasks task
JOIN fulfillments f ON f.id = task.fulfillment_id
JOIN manual_fulfillment_configs cfg ON cfg.id = f.fulfillment_config_id
WHERE cfg.enabled = TRUE
AND cfg.douyu_fulfillment_enabled = TRUE
AND f.channel = 'manual'
AND f.status IN ('assigned', 'processing', 'completed', 'archived')
LOOP
PERFORM enqueue_live_hub_platform_fulfillment_event(
candidate.order_id,
candidate.order_item_id,
candidate.fulfillment_id,
'migration_customer_profile_snapshot'
);
END LOOP;
END;
$$;
@@ -7,12 +7,28 @@ import {
refreshDouyuCustomerBinding,
saveDouyuCustomerProfile,
startDouyuCustomerBinding,
uploadDouyuCustomerHomepageScreenshot,
} from '../services/douyu-fulfillment/douyu-fulfillment-service.js'
import { createRateLimitMiddleware, getParamRateLimitKey } from '../middleware/rate-limit.js'
import { uploadSingleFile } from './file-upload.js'
import { openCustomerOrderRealtimeStream } from '../services/realtime/realtime-event-service.js'
import { createRouteHandler } from '../utils/http.js'
const router = Router()
const homepageScreenshotOrderRateLimit = createRateLimitMiddleware({
scope: 'douyu-homepage-screenshot:order',
windowMs: 60_000,
max: 10,
key: getParamRateLimitKey('orderNo'),
})
const homepageScreenshotIpRateLimit = createRateLimitMiddleware({
scope: 'douyu-homepage-screenshot:ip',
windowMs: 60_000,
max: 30,
})
router.get('/:orderNo/realtime', (req, res) => {
openCustomerOrderRealtimeStream(
res,
@@ -29,6 +45,21 @@ router.get(
}),
)
router.post(
'/:orderNo/homepage-screenshot',
homepageScreenshotIpRateLimit,
homepageScreenshotOrderRateLimit,
uploadSingleFile,
createRouteHandler(
(req) => uploadDouyuCustomerHomepageScreenshot(String(req.params.orderNo || ''), req.file),
{
successMessage: '主页截图已上传',
errorMessage: '上传主页截图失败',
scope: '[douyu-fulfillment/:orderNo/homepage-screenshot]',
},
),
)
router.post(
'/:orderNo/profile',
createRouteHandler(
@@ -1,6 +1,13 @@
import type { PoolClient } from 'pg'
import { runtimeConfig } from '../../config/runtime.js'
import { query, withTransaction } from '../../db/client.js'
import { getFileAssetByObjectKey } from '../../repositories/file-asset-repo.js'
import {
ORDER_SERVICE_SCREENSHOT_CONTENT_TYPES,
buildFileUrl,
uploadFileAsset,
} from '../file-storage/file-storage-service.js'
import {
publishCustomerOrderRealtimeChange,
publishRealtimeEvent,
@@ -26,6 +33,11 @@ type DouyuTaskRow = {
customer_role_name: string
customer_platform: string
customer_system: string
customer_homepage_screenshot_object_key: string
customer_homepage_screenshot_url: string
customer_homepage_screenshot_thumbnail_url: string
customer_homepage_screenshot_filename: string
customer_homepage_screenshot_uploaded_at: string | null
binding_phase: string
live_execution_status: string
live_binding_status: string
@@ -99,6 +111,8 @@ type DouyuFulfillmentSettingsRow = {
const AUTO_DISCOVERY_INTERVAL_MS = 15_000
const LIVE_STATE_SYNC_INTERVAL_MS = 60_000
const TERMINAL_TASK_STATUSES = new Set(['completed', 'cancelled'])
const DOUYU_HOMEPAGE_SCREENSHOT_SCENE = 'douyu-homepage-screenshot'
const DOUYU_HOMEPAGE_UPLOADER_TYPE = 'douyu-customer'
let lastAutomaticDiscoveryAt = 0
let automaticDiscoveryInFlight: Promise<{ created: number; updated: number } | null> | null = null
@@ -124,6 +138,36 @@ function liveHubBaseUrl() {
.replace(/\/+$/, '')
}
function douyuHomepageScreenshotUploaderId(taskId: number) {
return `douyu-task-${taskId}`
}
function absoluteOrderSiteFileUrl(pathname: string) {
const normalizedPath = String(pathname || '').trim()
if (!normalizedPath) return ''
try {
return new URL(normalizedPath, new URL(runtimeConfig.orders.claimBaseUrl).origin).toString()
} catch {
return normalizedPath
}
}
export function hasDouyuCustomerProfile(input: {
customer_role_name?: string
customer_platform?: string
customer_system?: string
customer_homepage_screenshot_object_key?: string
customer_homepage_screenshot_url?: string
}) {
return Boolean(
String(input.customer_role_name || '').trim() &&
['wechat', 'qq'].includes(String(input.customer_platform || '').trim()) &&
['ios', 'android'].includes(String(input.customer_system || '').trim()) &&
String(input.customer_homepage_screenshot_object_key || '').trim() &&
String(input.customer_homepage_screenshot_url || '').trim(),
)
}
export async function getDouyuFulfillmentSettings() {
const result = await query<DouyuFulfillmentSettingsRow>(
`
@@ -417,7 +461,18 @@ export function statusForLive(live: LiveBindingState): string {
if (live.customerProfileReset === true) return 'waiting_profile'
if (live.executionStatus === 'completed') return 'completed'
if (live.executionStatus === 'cancelled') return 'cancelled'
if (live.bindingStatus === 'failed' || BINDING_FAILURE_ISSUES.has(live.issueCode)) {
const bindTaskFailed = ['failed', 'error', 'stopped'].includes(live.bindTaskStatus)
const bindingStarted =
live.bindingStatus !== 'not_started' ||
Boolean(live.bindTaskId) ||
Boolean(live.qrUrl) ||
live.bindReadyForConfirm ||
live.bindConfirmed
if (
live.bindingStatus === 'failed' ||
bindTaskFailed ||
(BINDING_FAILURE_ISSUES.has(live.issueCode) && bindingStarted)
) {
return 'failed'
}
if (live.executionStatus === 'manual_required') return 'manual_required'
@@ -504,6 +559,26 @@ async function updateTaskFromLiveState(
customer_role_name = CASE WHEN $19 THEN '' ELSE customer_role_name END,
customer_platform = CASE WHEN $19 THEN '' ELSE customer_platform END,
customer_system = CASE WHEN $19 THEN '' ELSE customer_system END,
customer_homepage_screenshot_object_key = CASE
WHEN $19 THEN ''
ELSE customer_homepage_screenshot_object_key
END,
customer_homepage_screenshot_url = CASE
WHEN $19 THEN ''
ELSE customer_homepage_screenshot_url
END,
customer_homepage_screenshot_thumbnail_url = CASE
WHEN $19 THEN ''
ELSE customer_homepage_screenshot_thumbnail_url
END,
customer_homepage_screenshot_filename = CASE
WHEN $19 THEN ''
ELSE customer_homepage_screenshot_filename
END,
customer_homepage_screenshot_uploaded_at = CASE
WHEN $19 THEN NULL
ELSE customer_homepage_screenshot_uploaded_at
END,
qr_url = $15,
qr_generated_at = NULLIF($16, '')::timestamptz,
qr_expires_at = NULLIF($17, '')::timestamptz,
@@ -787,9 +862,34 @@ export async function getCustomerDouyuFulfillment(orderNo: string) {
return localCustomerFulfillment(task)
}
export async function uploadDouyuCustomerHomepageScreenshot(
orderNo: string,
file: Express.Multer.File | null | undefined,
) {
const task = await loadTaskByOrderNo(orderNo)
if (task.status === 'completed' || task.status === 'cancelled') {
throw createHttpError('当前订单已结束,不能上传资料', {
statusCode: 409,
errorCode: 'douyu_fulfillment_closed',
})
}
return uploadFileAsset({
file,
scene: DOUYU_HOMEPAGE_SCREENSHOT_SCENE,
uploaderType: DOUYU_HOMEPAGE_UPLOADER_TYPE,
uploaderId: douyuHomepageScreenshotUploaderId(task.id),
allowedContentTypes: ORDER_SERVICE_SCREENSHOT_CONTENT_TYPES,
})
}
export async function saveDouyuCustomerProfile(
orderNo: string,
input: { roleName?: unknown; platform?: unknown; system?: unknown },
input: {
roleName?: unknown
platform?: unknown
system?: unknown
homepageScreenshotObjectKey?: unknown
},
) {
const task = await loadTaskByOrderNo(orderNo)
if (task.status === 'completed' || task.status === 'cancelled') {
@@ -807,29 +907,70 @@ export async function saveDouyuCustomerProfile(
const system = String(input.system ?? '')
.trim()
.toLowerCase()
const homepageScreenshotObjectKey = String(input.homepageScreenshotObjectKey ?? '')
.trim()
.slice(0, 512)
if (!roleName || !['wechat', 'qq'].includes(platform) || !['ios', 'android'].includes(system)) {
throw createHttpError('请完整填写角色名、微信/QQ 和苹果/安卓', {
statusCode: 400,
errorCode: 'douyu_customer_profile_invalid',
})
}
if (!homepageScreenshotObjectKey) {
throw createHttpError('请上传游戏主页截图', {
statusCode: 400,
errorCode: 'douyu_customer_homepage_screenshot_required',
})
}
await withTransaction(async (client) => {
const asset = await getFileAssetByObjectKey(homepageScreenshotObjectKey, client)
if (
!asset ||
asset.uploader_type !== DOUYU_HOMEPAGE_UPLOADER_TYPE ||
asset.uploader_id !== douyuHomepageScreenshotUploaderId(task.id) ||
asset.scene !== DOUYU_HOMEPAGE_SCREENSHOT_SCENE ||
!ORDER_SERVICE_SCREENSHOT_CONTENT_TYPES.has(String(asset.content_type || '').trim())
) {
throw createHttpError('主页截图无效,请重新上传', {
statusCode: 400,
errorCode: 'douyu_customer_homepage_screenshot_invalid',
})
}
const screenshotUrl = absoluteOrderSiteFileUrl(buildFileUrl(asset.object_key))
const thumbnailUrl = absoluteOrderSiteFileUrl(
buildFileUrl(asset.thumbnail_object_key || asset.object_key),
)
await client.query(
`
UPDATE douyu_fulfillment_tasks
SET customer_role_name = $2,
customer_platform = $3,
customer_system = $4,
customer_homepage_screenshot_object_key = $5,
customer_homepage_screenshot_url = $6,
customer_homepage_screenshot_thumbnail_url = $7,
customer_homepage_screenshot_filename = $8,
customer_homepage_screenshot_uploaded_at = NOW(),
status = CASE WHEN status = 'waiting_profile' THEN 'preparing' ELSE status END,
updated_at = NOW()
WHERE id = $1
`,
[task.id, roleName, platform, system],
[
task.id,
roleName,
platform,
system,
asset.object_key,
screenshotUrl,
thumbnailUrl,
asset.original_filename,
],
)
await appendEvent(client, task.id, 'customer_profile_saved', 'customer', {
roleName,
platform,
system,
homepageScreenshotObjectKey: asset.object_key,
})
})
return getCustomerDouyuFulfillment(orderNo)
@@ -43,6 +43,20 @@ test('斗鱼客户资料角色名不一致时禁止确认', () => {
assert.equal(result.roleMatched, false)
})
test('账号换绑冷却但尚未开始绑定,不应显示角色绑定失败', () => {
const status = statusForLive({
executionStatus: 'ready',
bindingStatus: 'not_started',
issueCode: 'account_role_cooldown',
bindTaskId: null,
qrUrl: '',
bindReadyForConfirm: false,
bindConfirmed: false,
accountReady: false,
} as never)
assert.equal(status, 'preparing')
})
test('绑定失败优先于旧角色确认标记', () => {
const status = statusForLive({
executionStatus: 'manual_required',
Binary file not shown.

After

Width:  |  Height:  |  Size: 304 KiB

@@ -10,13 +10,16 @@ import QRCode from 'qrcode'
import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
import { useParams } from 'react-router'
import ImageUpload from '@/components/files/ImageUpload'
import {
confirmDouyuBinding,
fetchDouyuFulfillment,
refreshDouyuBinding,
saveDouyuProfile,
startDouyuBinding,
uploadDouyuHomepageScreenshot,
} from '@/services/douyu-fulfillment'
import type { UploadedFile } from '@/types/worker-platform'
import type {
DouyuCustomerFulfillment,
DouyuCustomerPlatform,
@@ -77,6 +80,7 @@ export default function DouyuFulfillmentPage() {
const [roleName, setRoleName] = useState('')
const [platform, setPlatform] = useState<DouyuCustomerPlatform>('wechat')
const [system, setSystem] = useState<DouyuCustomerSystem>('android')
const [homepageScreenshot, setHomepageScreenshot] = useState<UploadedFile[]>([])
const [qrImage, setQrImage] = useState('')
const [bindingQrExpanded, setBindingQrExpanded] = useState(false)
const [nowMs, setNowMs] = useState(() => Date.now())
@@ -239,12 +243,18 @@ export default function DouyuFulfillmentPage() {
message.warning(roleNameIssue)
return
}
const screenshot = homepageScreenshot[0]
if (!screenshot?.objectKey) {
message.warning('请上传游戏主页截图')
return
}
setSaving(true)
try {
const response = await saveDouyuProfile(orderNo, {
roleName: roleName.trim(),
platform,
system,
homepageScreenshotObjectKey: screenshot.objectKey,
})
applyData(response.data)
message.success('资料已提交,正在准备绑定二维码')
@@ -408,6 +418,37 @@ export default function DouyuFulfillmentPage() {
{roleNameIssue ? <ExclamationCircleOutlined aria-hidden="true" /> : null}
<span>{roleNameIssue || DOUYU_ROLE_NAME_FORMAT_HINT}</span>
</p>
<label className="customer-collect-label">游戏主页截图(必填)</label>
<div className="customer-douyu-screenshot-row">
<div className="customer-douyu-screenshot-upload">
<ImageUpload
scene="douyu-homepage-screenshot"
scope="collect"
maxCount={1}
showPasteHint
value={homepageScreenshot}
onChange={setHomepageScreenshot}
uploader={async (file) => {
const response = await uploadDouyuHomepageScreenshot(orderNo, file)
return response.data.file
}}
/>
</div>
<div className="customer-douyu-screenshot-example">
<Image
src="/images/game-home-example.webp"
alt="游戏主页截图示例"
width={150}
height={140}
style={{ objectFit: 'cover', borderRadius: 8, border: '1px solid #334155' }}
/>
<span>示例:需能看到游戏名字和游戏 UID</span>
</div>
</div>
<p className="customer-douyu-role-name-help">
请上传游戏主页截图,需能看到游戏名字/昵称和游戏
UID(编号);用于客服核对绑定是否正确。
</p>
<div className="customer-douyu-submit-bar">
<Button
block
@@ -1,4 +1,6 @@
import { apiGet, apiPost } from '@/lib/http'
import { apiGet, apiPost, apiPostForm } from '@/lib/http'
import { optimizeImageForUpload } from '@/utils/image-upload'
import type { UploadedFile } from '@/types/worker-platform'
import type {
DouyuCustomerFulfillment,
DouyuCustomerPlatform,
@@ -17,6 +19,7 @@ export function saveDouyuProfile(
roleName: string
platform: DouyuCustomerPlatform
system: DouyuCustomerSystem
homepageScreenshotObjectKey: string
},
) {
return apiPost<DouyuCustomerFulfillment>(
@@ -51,3 +54,13 @@ export function confirmDouyuBinding(orderNo: string) {
{},
)
}
export async function uploadDouyuHomepageScreenshot(orderNo: string, file: File) {
const optimized = await optimizeImageForUpload(file, 'douyu-homepage-screenshot')
const form = new FormData()
form.append('file', optimized)
return apiPostForm<{ file: UploadedFile }>(
`/api/v1/douyu-fulfillment/${encodeURIComponent(orderNo)}/homepage-screenshot`,
form,
)
}
@@ -645,3 +645,58 @@
-webkit-overflow-scrolling: touch;
}
}
.customer-douyu-screenshot-row {
display: flex;
align-items: flex-start;
gap: 14px;
min-width: 0;
}
.customer-douyu-screenshot-upload {
flex: 0 0 150px;
min-width: 0;
}
.customer-douyu-screenshot-upload .ant-upload-select,
.customer-douyu-screenshot-upload .ant-upload-list-item-container {
width: 150px !important;
height: 140px !important;
}
.customer-douyu-screenshot-example img {
width: 100% !important;
height: 100% !important;
object-fit: cover;
}
.customer-douyu-screenshot-example {
display: flex;
flex-direction: column;
gap: 6px;
min-width: 0;
color: #94a3b8;
font-size: 12px;
line-height: 1.45;
}
@media (max-width: 480px) {
.customer-douyu-screenshot-row {
gap: 10px;
}
.customer-douyu-screenshot-upload {
flex-basis: 126px;
}
.customer-douyu-screenshot-upload .ant-upload-select,
.customer-douyu-screenshot-upload .ant-upload-list-item-container {
width: 126px !important;
height: 118px !important;
}
.customer-douyu-screenshot-example .ant-image {
width: 126px !important;
height: 118px !important;
}
}
@@ -11,6 +11,11 @@ export type DouyuFulfillmentTask = {
customer_role_name: string
customer_platform: string
customer_system: string
customer_homepage_screenshot_object_key: string
customer_homepage_screenshot_url: string
customer_homepage_screenshot_thumbnail_url: string
customer_homepage_screenshot_filename: string
customer_homepage_screenshot_uploaded_at: string | null
binding_phase: string
live_execution_status: string
live_binding_status: string