Fecify-角色-更新

接口信息

  • 接口地址: {your-site-url}/api/skill/system-role/update
  • 基础 URL: {your-site-url} 需替换为你自己的独立站 URL 地址,如 https://your-domain.com/admin
  • 请求方式: POST
  • Content-Type: application/json
  • 说明: 更新角色的名称和权限(全量覆盖)。必须先通过 Fecify-角色-详细 获取当前完整数据再修改提交。

认证

请求头中需要携带 skill-access-token

Header
skill-access-token {your-skill-access-token} (请替换为你自己的 token)

请求参数

字段 类型 必填 说明
id String 角色 ID,从 Fecify-角色-列表 获取
name String 角色名称
admin_resources Array 服务端后台权限资源标识符列表,从 Fecify-角色-详细all_admin_resources 中选取
shop_type Number 店铺范围:1 = 所有店铺,2 = 指定店铺
shop_ids Array 店铺 ID 列表,shop_type=2 时必填
manager_b2c_resources Array B2C 商家端权限资源标识符列表,从 Fecify-角色-详细 all_manager_b2c_resources 中选取
manager_b2b_resources Array B2B 商家端权限资源标识符列表,从 Fecify-角色-详细 all_manager_b2b_resources 中选取

请求示例

cURL

curl --location --request POST '{your-site-url}/api/skill/system-role/update' \
--header 'skill-access-token: {your-skill-access-token}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "vip",
    "admin_resources": ["shop.shop.view", "shop.shop.edit", "system.role.view"],
    "shop_type": 2,
    "shop_ids": [347, 346, 345],
    "manager_b2c_resources": ["order.manage.view", "order.manage.edit"],
    "manager_b2b_resources": ["customer.manage.view", "customer.b2bcontacts.view"],
    "id": "18"
}'

返回结果

code200 表示成功;code 不为 200 表示失败。

成功响应

{
    "code": 200,
    "data": {
        "id": 18,
        "name": "vip",
        "admin_resources": ["shop.shop.view", "shop.shop.edit"],
        "shop_type": 2,
        "shop_ids": [347, 346, 345],
        "manager_b2c_resources": ["order.manage.view"],
        "manager_b2b_resources": ["customer.manage.view"],
        "created_at": "2025-08-18 11:56:33",
        "updated_at": "2026-07-22 11:18:16"
    },
    "message": "success"
}

返回字段说明

字段 类型 说明
code Number 状态码,200 表示成功
message String 执行结果的文字描述
data Object 更新后的角色信息

注意事项

  1. 更新为全量覆盖,必须先通过 Fecify-角色-详细 获取当前完整数据再修改。
  2. admin_resourcesmanager_b2c_resourcesmanager_b2b_resources 的合法值来自详情接口返回的 all_*_resources 资源树中各节点的 resource 字段。
  3. shop_type=2 时必须传入 shop_ids 指定店铺范围。

results matching ""

    No results matching ""