@lark-apaas/coding-miaoda-sandbox-skills 0.1.29 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
>
|
|
5
5
|
> 飞书用户身份体系官方说明:https://open.larkoffice.com/document/platform-overveiw/basic-concepts/user-identity-introduction/introduction
|
|
6
6
|
>
|
|
7
|
-
> **承接 `user-identity` skill 决策树**:如果只需 妙搭 userId → 飞书 user_id(employee_id),在 nestjs-react-fullstack 项目内优先用 `AuthNPaasService
|
|
7
|
+
> **承接 `user-identity` skill 决策树**:如果只需 妙搭 userId → 飞书 user_id(employee_id),在 nestjs-react-fullstack 项目内优先用 `AuthNPaasService`。本文只覆盖**不在该模板内**的项目。模板内 **`employee_id` / LarkID / open_id / union_id ↔ 妙搭 userId 双向**一律用 `AuthNPaasService`(open_id / union_id 用 `getBatchOpenIds` / `getBatchUnionIds` / `getBatchMiaodaUserIdsByOpenIds` / `getBatchMiaodaUserIdsByUnionIds`,`feishuClientId` 传 open_id 所属飞书应用 App ID),不要手写 spark `id_convert`。
|
|
8
8
|
|
|
9
9
|
## ID 识别速查
|
|
10
10
|
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
> 官方定义:`user_id` 也称为 `employee_id`,两者在多数业务场景等价(除飞书招聘)。它**不是**员工工号(`employee_no` 是另一个独立字段)。
|
|
23
23
|
>
|
|
24
|
-
> 飞书还有第四种 ID `lark_id
|
|
24
|
+
> 飞书还有第四种 ID `lark_id`(LarkID,全局物理身份,纯数字),飞书 OpenAPI 不认。LarkID ↔ 妙搭 userId 在模板内用 `AuthNPaasService.getBatchMiaodaUserIdsByLarkIds` / `getBatchLarkIds`(见 `user-identity`),本文不涉及。
|
|
25
25
|
|
|
26
26
|
## 决策树:我需要转换吗?
|
|
27
27
|
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
拿到的 ID 是什么?
|
|
30
30
|
├─ 妙搭 userId(纯数字)
|
|
31
31
|
│ ├─ nestjs-react-fullstack 项目内要拿飞书 user_id → 用 AuthNPaasService(见 user-identity skill),双向均可
|
|
32
|
-
│ ├─ 要调飞书开放平台 API 拿 open_id/union_id →
|
|
32
|
+
│ ├─ 要调飞书开放平台 API 拿 open_id/union_id → 模板内 AuthNPaasService.getBatchOpenIds / getBatchUnionIds;模板外用下方 spark id_convert API
|
|
33
33
|
│ └─ 仅妙搭内部使用 → 直接用,不需要转换
|
|
34
34
|
├─ 飞书 open_id(ou_ 开头)→ 要在妙搭中查用户?
|
|
35
|
-
│ ├─ 是 →
|
|
35
|
+
│ ├─ 是 → 模板内 AuthNPaasService.getBatchMiaodaUserIdsByOpenIds;模板外 spark id_convert type 20
|
|
36
36
|
│ └─ 否(仅飞书 API 使用)→ 直接用
|
|
37
37
|
├─ 飞书 union_id(on_ 开头)→ 要在妙搭中查用户?
|
|
38
|
-
│ ├─ 是 →
|
|
38
|
+
│ ├─ 是 → 模板内 AuthNPaasService.getBatchMiaodaUserIdsByUnionIds;模板外 spark id_convert type 21
|
|
39
39
|
│ └─ 否 → 直接用
|
|
40
40
|
└─ 飞书 user_id(即 employee_id)
|
|
41
41
|
├─ 妙搭 userId → 飞书 user_id:nestjs-react-fullstack 项目内用 AuthNPaasService(仅此一种方法)
|
|
@@ -121,7 +121,7 @@ const res2 = await client.request({
|
|
|
121
121
|
|
|
122
122
|
| 错误 | 正确做法 |
|
|
123
123
|
|------|----------|
|
|
124
|
-
| 把妙搭 userId 当飞书 open_id 传给飞书 API | 两套体系不互通;nestjs-react-fullstack 项目内用 `AuthNPaasService
|
|
124
|
+
| 把妙搭 userId 当飞书 open_id 传给飞书 API | 两套体系不互通;nestjs-react-fullstack 项目内用 `AuthNPaasService.getBatchOpenIds`(`feishuClientId` 传调 API 用的那个飞书应用 App ID),其他场景调 spark `id_convert` |
|
|
125
125
|
| 混淆 `req.userContext.userId` 和 `useCurrentUserProfile().user_id` | 同一个 ID,dataloom 同源,前后端获取方式不同而已 |
|
|
126
126
|
| 把 `employee_id` 当作员工工号 | `employee_id` 等价于 `user_id`,是企业内身份标识;工号是另一个独立字段 `employee_no` |
|
|
127
127
|
| 反查 employee_id → 妙搭 userId 时还手写两步 | 模板内直接用 `AuthNPaasService.getBatchMiaodaUserIds()` 一步;仅模板外 / open_id 场景才两步 |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/coding-miaoda-sandbox-skills",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30",
|
|
4
4
|
"description": "Miaoda 合并沙箱 skills 包(包含原 miaoda-skills 的 miaoda / miaoda-modern / miaoda-design / shared 四条业务线);发布公网 npm,随沙箱运行时经 update-skills 同步到 .agent/skills/",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|