ziniao-workflow-batch-account
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese批量账号授权工作流
Batch Account Authorization Workflow
CRITICAL — 开始前 MUST 先用 Read 工具读取
../ziniao-shared/SKILL.mdCRITICAL — MUST use the Read tool to read before starting
../ziniao-shared/SKILL.md适用场景
Applicable Scenarios
- "给新员工分配店铺权限"
- "批量授权店铺给某个员工"
- "新人入职,需要授权所有店铺"
- "Assign store permissions to new employees"
- "Batch authorize stores to a specific employee"
- "New employee onboarding, need to authorize all stores"
前置条件
Prerequisites
- 已配置 apiKey()
ziniao-cli config init
- apiKey has been configured ()
ziniao-cli config init
工作流
Workflow
staff list ──► 找到目标员工 ID
account list ──► 找到目标店铺 ID 列表
│
├──► 对每个店铺:
│ api /superbrowser/rest/v1/erp/store/auth/add { storeIdList, staffId }
│
└──► 汇总授权结果staff list ──► Find target employee ID
account list ──► Find target store ID list
│
├──► For each store:
│ api /superbrowser/rest/v1/erp/store/auth/add { storeIdList, staffId }
│
└──► Summarize authorization resultsStep 1: 查找员工
Step 1: Find Employee
bash
undefinedbash
undefined按姓名查找
Search by name
ziniao-cli staff list --name "张三" --format table
ziniao-cli staff list --name "Zhang San" --format table
记录 userId
Record userId
undefinedundefinedStep 2: 查找要授权的店铺
Step 2: Find Stores to Authorize
bash
undefinedbash
undefined列出所有店铺
List all stores
ziniao-cli account list --format table --page-all
ziniao-cli account list --format table --page-all
或按名称搜索
Or search by name
ziniao-cli account list --name "US" --format table
undefinedziniao-cli account list --name "US" --format table
undefinedStep 3: 逐个授权
Step 3: Authorize One by One
对每个店铺执行:
bash
ziniao-cli api /superbrowser/rest/v1/erp/store/auth/add \
--data '{"storeIdList":["<storeId>"],"staffId":"<staffId>"}'Execute for each store:
bash
ziniao-cli api /superbrowser/rest/v1/erp/store/auth/add \
--data '{"storeIdList":["<storeId>"],"staffId":"<staffId>"}'Step 4: 验证
Step 4: Verification
bash
undefinedbash
undefined查看该员工已授权的店铺
View stores authorized to this employee
ziniao-cli api /superbrowser/rest/v1/erp/user/stores
--data '{"userId":"<userId>","page":1,"limit":10}'
--data '{"userId":"<userId>","page":1,"limit":10}'
undefinedziniao-cli api /superbrowser/rest/v1/erp/user/stores
--data '{"userId":"<userId>","page":1,"limit":10}'
--data '{"userId":"<userId>","page":1,"limit":10}'
undefined注意事项
Notes
- 授权是写入操作,执行前确认用户意图
- 如果需要授权大量店铺,建议先列出计划并确认
- 授权失败时记录错误并继续下一个
- Authorization is a write operation; confirm user intent before execution
- If a large number of stores need to be authorized, it is recommended to list the plan and confirm first
- Record errors and proceed to the next one if authorization fails
参考
References
- ziniao-account — 账号管理
- ziniao-staff — 员工管理
- ziniao-shared — 认证和全局参数
- ziniao-account — Account Management
- ziniao-staff — Staff Management
- ziniao-shared — Authentication and Global Parameters