safety-eval-service-frontend/.cursor/skills/specs/19-底座平台API调用规范/03-信息获取API/SKILL.md

110 lines
2.2 KiB
Markdown
Raw Normal View History

2026-08-14 16:54:03 +08:00
---
name: jjb-base-info-api
description: 定义 JJB 底座 getClientInfo、getTenantInfo、getUserInfo 信息获取 API。在获取终端、租户、用户信息时查阅。
---
# 底座平台API调用规范
## 信息获取 API
## base.getClientInfo
获取终端信息。
**函数签名**
```typescript
declare function getClientInfo(option: {
onFail?: (e: Error) => void,
onSuccess?: (e: Record<string, any>) => void
}): void;
```
**参数说明**
- `option.onFail`:失败回调函数(可选)
- `option.onSuccess`:成功回调函数(可选)
**返回值**
- `void`
**使用示例**
```javascript
if (typeof window.__IN_BASE__ !== 'undefined') {
base.getClientInfo({
onSuccess: (data) => {
console.log('终端信息:', data);
// 使用终端信息
},
onFail: (error) => {
console.error('获取终端信息失败:', error);
}
});
}
```
## base.getTenantInfo
获取当前租户信息。
**函数签名**
```typescript
declare function getTenantInfo(option: {
onFail?: (e: Error) => void,
onSuccess?: (e: Record<string, any>) => void
}): void;
```
**参数说明**
- `option.onFail`:失败回调函数(可选)
- `option.onSuccess`:成功回调函数(可选)
**返回值**
- `void`
**使用示例**
```javascript
if (typeof window.__IN_BASE__ !== 'undefined') {
base.getTenantInfo({
onSuccess: (data) => {
console.log('租户信息:', data);
},
onFail: (error) => {
console.error('获取租户信息失败:', error);
}
});
}
```
## base.getUserInfo
获取当前登录用户信息。
**函数签名**
```typescript
declare function getUserInfo(option: {
onFail?: (e: Error) => void,
onSuccess?: (e: Record<string, any>) => void
}): void;
```
**参数说明**
- `option.onFail`:失败回调函数(可选)
- `option.onSuccess`:成功回调函数(可选)
**返回值**
- `void`
**使用示例**
```javascript
if (typeof window.__IN_BASE__ !== 'undefined') {
base.getUserInfo({
onSuccess: (data) => {
console.log('用户信息:', data);
// 使用用户信息
},
onFail: (error) => {
console.error('获取用户信息失败:', error);
}
});
}
```