Artist 现在可以维护属于自己的自定义权利模板,并在多个自己的 Service 中复用。
Service 的 right_templates 现在包含两类模板:
type | 来源 | 说明 |
|---|---|---|
platform | 平台模板 | 来自平台维护的 right_templates |
custom | Artist 自定义模板 | 来自当前 Artist 自己维护的模板库 |
两类模板的数值 id 可能相同,因此前端必须使用 (type, id) 作为模板唯一标识,不能只使用 id。
自定义模板可配置:
nameright_tree自定义模板的 summary、description 由系统固定提供,Artist 不可编辑:
GET /api/content/service/info
data.right_templates[] 同时返回平台模板和 Artist 自定义模板,并新增 typePOST /api/service_requests/create
right_template_type,支持选择平台模板或 Artist 自定义模板POST /api/service_requests/list
service_snap.data.right_templates[] 缺少 type 时,读取结果按 platform 返回POST /api/service_requests/info
type 的 Service 模板快照;历史快照缺少 type 时按 platform 返回POST /api/work_tasks/list
busable_snap.right_templates[] 缺少 type 时,读取结果按 platform 返回GET /api/work_tasks/info
busable_snap.right_templates[] 缺少 type 时,读取结果按 platform 返回GET /api/artist_center/right_templates/custom/list
GET /api/artist_center/right_templates/custom/info
POST /api/artist_center/right_templates/custom/create
POST /api/artist_center/right_templates/custom/update
POST /api/artist_center/right_templates/custom/delete
GET /api/artist_center/services/meta
right_templates[] 新增 type: "platform";自定义模板通过独立 CRUD 接口获取GET /api/artist_center/services/info
data.right_templates[] 统一返回平台模板和自定义模板POST /api/artist_center/services/create
right_templates[] 新增 type,可关联当前 Artist 的自定义模板POST /api/artist_center/services/update
right_templates[] 新增 type,可同时关联平台模板和当前 Artist 的自定义模板GET /api/artist_center/service_requests/list
type 时按 platform 返回GET /api/artist_center/service_requests/info
type 时按 platform 返回POST /api/artist_center/work_tasks/list
busable_snap.right_templates[] 缺少 type 时按 platform 返回GET /api/artist_center/work_tasks/info
busable_snap.right_templates[] 缺少 type 时按 platform 返回POST /api/admin_center/service_request/list
type 时按 platform 返回POST /api/admin_center/service_request/info
type 时按 platform 返回POST /api/admin_center/work_task/list
busable_snap.right_templates[] 缺少 type 时按 platform 返回POST /api/admin_center/work_task/info
busable_snap.right_templates[] 缺少 type 时按 platform 返回GET /api/content/service/inforight_templates 统一返回平台模板和 Artist 自定义模板。| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
service_id | number | 是 | Service id |
404:Service 不存在或不可访问。
POST /api/service_requests/createright_template_type;right_template_id 必须属于指定 Service 在对应类型下关联的模板。| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
service_id | number | 是 | Service id |
right_template_type | "platform" | "custom" | null | 否 | 模板类型;省略但传入 right_template_id 时默认为 platform |
right_template_id | number | null | 条件必填 | 选择的模板 id;传入 right_template_type 时必填 |
deadline | string | 是 | 原有字段 |
detail | string | 是 | 原有字段 |
budget | number | 是 | 原有字段 |
currency_id | number | 是 | 原有字段 |
files | object[] | 否 | 原有字段 |
right_template_type 仅允许 platform、custom。type = custom 时,只能选择该 Service 已关联的 Artist 自定义模板。id 可能同时存在于两种类型中,选择结果由 right_template_type + right_template_id 共同确定。422:类型不合法,或模板不属于当前 Service。
POST /api/service_requests/listservice_snap.data.right_templates[] 均按新类型语义读取。无新增。
无新增,沿用原有错误语义。
POST /api/service_requests/infotype 时,API 读取结果补为 platform。| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | number | 是 | Service Request id |
无新增,沿用原有错误语义。
POST /api/work_tasks/list /GET /api/work_tasks/infobusable_snap.right_templates[] 返回结构与 Service Request 快照一致;历史项缺少 type 时按 platform 返回。无新增。
无新增,沿用原有错误语义。
GET /api/artist_center/right_templates/custom/list| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
page | number | 否 | 页码,默认 1 |
size | number | 否 | 每页数量,默认 15,范围 1-50 |
422:分页参数不合法。
GET /api/artist_center/right_templates/custom/info| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | number | 是 | 自定义模板 id |
与列表项结构一致。
404:模板不存在、已删除或不属于当前 Artist。422:参数校验失败。POST /api/artist_center/right_templates/custom/createname 为多语言对象;权益状态使用扁平的 right_states 数组提交。| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | Record<string, string> | 是 | 多语言模板名称,至少包含一项,每个值最长 255 字符 |
right_states | object[] | 是 | 权益状态列表,创建时至少包含一项 |
right_states[].right_id | number | 是 | Rights 表中的权益 id,不可重复 |
right_states[].state | number | 是 | 权益状态整数 |
summary、description 不允许提交,始终由系统固定返回。
422:名称、Rights id 或权益状态参数不合法。
POST /api/artist_center/right_templates/custom/updatename、right_states 均为可选;传入 right_states 时会替换模板的完整权益状态集合。| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | number | 是 | 自定义模板 id |
name | Record<string, string> | 否 | 新的多语言名称 |
right_states | object[] | 否 | 新的完整权益状态列表 |
right_states[].right_id | number | 条件必填 | 传入 right_states 时必填 |
right_states[].state | number | 条件必填 | 传入 right_states 时必填 |
与创建接口响应结构一致。
404:模板不存在、已删除或不属于当前 Artist。422:参数校验失败。POST /api/artist_center/right_templates/custom/delete81001;传入 force: true 后解除 Service 关联并删除。| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | number | 是 | 自定义模板 id |
force | boolean | 否 | 是否强制解除所有 Service 关联并删除,默认 false |
400:模板仍被 Service 使用,业务错误码为 81001(ArtistRightTemplateUsedByService)。前端应使用 code 判断是否展示强制删除确认,不要依赖 message 文案。
404:模板不存在、已删除或不属于当前 Artist。
GET /api/artist_center/services/metatype: "platform";该接口不混入 Artist 自定义模板,自定义模板通过 /right_templates/custom/list 获取。无。
无新增,沿用原有错误语义。
GET /api/artist_center/services/infodata.right_templates[] 统一返回平台模板和自定义模板,并包含各自的 type。| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | number | 是 | Service id |
right_templates 结构与 GET /api/content/service/info 一致。
无新增,沿用原有错误语义。
POST /api/artist_center/services/create /POST /api/artist_center/services/updateright_templates[] 使用 type 区分平台模板与自定义模板。| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
right_templates | object[] | 否 | Service 关联的完整模板列表 |
right_templates[].type | "platform" | "custom" | 否 | 模板类型;省略时兼容为 platform |
right_templates[].id | number | 是 | 对应类型下的模板 id |
right_templates[].markup_type | "percent" | "fixed" | 否 | 加价类型,默认 percent |
right_templates[].markup_value | number | 否 | 非负整数,默认 0 |
type = platform:模板必须存在于平台 right_templates。type = custom:模板必须属于当前 Artist,不能关联其他 Artist 的自定义模板。(type, id) 不可重复。right_templates 是完整集合;空数组表示解除全部平台和自定义模板关联。更新接口响应:
422:模板不存在、重复,或自定义模板不属于当前 Artist。
GET /api/artist_center/service_requests/list /GET /api/artist_center/service_requests/infotype 时按 platform 返回。无新增。
快照中的 right_templates 结构与 POST /api/service_requests/info 一致。
无新增,沿用原有错误语义。
POST /api/artist_center/work_tasks/list /GET /api/artist_center/work_tasks/infobusable_snap.right_templates[] 历史项缺少 type 时按 platform 返回。无新增。
busable_snap.right_templates 结构与 user Work Task 接口一致。
无新增,沿用原有错误语义。
POST /api/admin_center/service_request/list /POST /api/admin_center/service_request/infotype 时按 platform 返回。无新增。
快照中的 right_templates 结构与 POST /api/service_requests/info 一致。
无新增,沿用原有错误语义。
POST /api/admin_center/work_task/list /POST /api/admin_center/work_task/infobusable_snap.right_templates[] 历史项缺少 type 时按 platform 返回。无新增。
busable_snap.right_templates 结构与 user Work Task 接口一致。
无新增,沿用原有错误语义。
service_snap.data.right_templates 会保存当时 Service 的全部平台模板和自定义模板。typeidnamesummarydescriptionmarkup_typemarkup_valueright_treeright_template_type + right_template_id 记录用户选择的模板。right_templates[].type 缺失时默认为 platform。right_template_id 但省略 right_template_type 时默认为 platform。right_template_id 的记录会按 platform 处理。service_snap.data.right_templates[] 或 work_tasks.busable_snap.right_templates[] 时:
type,API 返回结果会补为 platform前端仍必须对缺失的 type 做相同回退,不能只依赖后端:
匹配 Service Request 已选模板时:
不要使用以下方式: