获取
描述
integer/array module.get(object parameters)
此方法允许根据给定参数检索模块。
此方法仅适用于 Super admin 用户类型。 调用此方法的权限可在用户角色设置中撤销。 更多信息请参见 用户角色。
参数
(object) 定义所需输出的参数。
该方法支持以下参数。
| 参数 | 类型 | 说明 |
|---|---|---|
| moduleids | ID/array | 仅返回具有给定 ID 的模块。 |
| sortfield | string/array | 按给定属性对结果进行排序。 可能的值: moduleid、relative_path。 |
| countOutput | boolean | 这些参数在参考说明中进行了描述。 |
| excludeSearch | boolean | |
| filter | object | |
| limit | integer | |
| output | query | |
| preservekeys | boolean | |
| search | object | |
| searchByAny | boolean | |
| searchWildcardsEnabled | boolean | |
| sortorder | string/array | |
| startSearch | boolean |
返回值
(integer/array) 返回两者其中任一:
- 一组对象数组;
- 如果已经使用了
countOutput参数,则检索对象的计数。
示例
通过 ID 检索模块
检索有关模块 "1"、 "2"和 "25"的所有数据。
请求:
{
"jsonrpc": "2.0",
"method": "module.get",
"params": {
"output": "extend",
"moduleids": [
"1",
"2",
"25"
]
},
"id": 1
}
响应:
{
"jsonrpc": "2.0",
"result": [
{
"moduleid": "1",
"id": "actionlog",
"relative_path": "widgets/actionlog",
"status": "1",
"config": []
},
{
"moduleid": "2",
"id": "clock",
"relative_path": "widgets/clock",
"status": "1",
"config": []
},
{
"moduleid": "25",
"id": "example",
"relative_path": "modules/example_module",
"status": "1",
"config": []
}
],
"id": 1
}
另请参阅
来源
CModule::get() in ui/include/classes/api/services/CModule.php。