Files
order_site/apps/frontend/src/services/files.ts
T
yml2213 2412df8b54 资料字段支持下拉选项与买家截图,大厅按 VIP 等级延迟可见
资料字段:
- CollectField 支持 type(text/select) 与 options,规则字段语法 key:名称#选项1,选项2
- 默认字段改为游戏编号/游戏昵称/系统(安卓,苹果)/区服(QQ区,微信区),旧默认模板字段自动替换为新版
- 采集页与管理端补资料支持单选下拉与买家主页截图上传(新增公开上传接口)
- 管理端工单详情展示买家截图

VIP 延迟可见:
- 等级权限新增 visibleDelaySeconds(默认 VIP1=20s~VIP5=0s,可后台配置)
- 大厅按等级延迟过滤新发布工单,页面提示延迟规则
2026-08-01 18:14:37 +08:00

25 lines
755 B
TypeScript

import { apiPostForm } from '@/lib/http'
import type { UploadedFile } from '@/types/worker-platform'
import { optimizeImageForUpload } from '@/utils/image-upload'
type UploadScope = 'admin' | 'worker' | 'collect'
export async function uploadFile(
file: File,
scene: string,
scope: UploadScope,
) {
const uploadTarget = await optimizeImageForUpload(file, scene)
const form = new FormData()
form.append('file', uploadTarget)
form.append('scene', scene)
const endpoint =
scope === 'admin'
? '/api/v1/admin/files/upload'
: scope === 'collect'
? '/api/v1/collect/upload'
: '/api/v1/worker/files/upload'
const response = await apiPostForm<{ file: UploadedFile }>(endpoint, form)
return response.data.file
}