module.get

描述

integer/array module.get(object parameters)

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

该方法对所有类型用户可用. 调用该方法的权限可以在用户角色设置中撤销. 更多信息请参阅User roles.

参数

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

该方法支持以下参数.

参数 数据类型 描述
moduleids ID/array 仅返回具有给定ID的模块.
sortfield string/array 按给定属性对结果进行排序.

可能的值: moduleid, relative_path.
countOutput boolean 这些参数在通用get方法参数中有描述.
excludeSearch boolean
filter object
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

返回值

(integer/array) 返回以下两种情况之一:

  • 一个包含array的objects数组
  • 检索到的objects数量(当使用了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() 位于 ui/include/classes/api/services/CModule.php 文件中。