获取

描述

integer/array module.get(object parameters)

该方法允许根据给定参数检索模块。

此方法仅适用于超级管理员用户类型。 调用该方法的权限可在用户角色设置中撤销。 更多信息请参阅User roles

参数

(object) 定义所需输出的参数。

该方法支持以下参数。

Parameter 类型 描述
moduleids ID/数组 仅返回具有给定ID的模块。
sortfield string/数组 根据给定的属性对结果进行排序。

可能的值: moduleid, relative_path
countOutput 布尔值 这些参数在参考说明中有描述。
excludeSearch 布尔值
filter 对象
limit 整数
output 查询
preservekeys 布尔值
search 对象
searchByAny 布尔值
searchWildcardsEnabled 布尔值
sortorder string/数组
startSearch 布尔值

返回值

(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