调度控制 API

调度系统

创建调度系统 create_system

请求

{
    "action":"create_system",
    "name": "system1",
    "alias": "Sy01",
    "object_id": "obj1",
    "description": ""
}

响应

{
  "resp": "create_system",
  "code": 200,
  "msg": "成功",
  "result": {
    "id": 3,
    "organization_id": "",
    "uid": "SYS3405113700002",
    "name": "system2",
    "alias": "Sy02",
    "object_id": "obj1",
    "description": "",
    "created": "2023-04-10 14:08:51",
    "last_modified": "2023-04-10 14:08:51"
  }
}

编辑调度系统 update_system

请求

{
    "action":"update_system",
    "uid": "SYS3473205400001",
    "name": "system1",
    "alias": "Sy01",
    "object_id": "obj3",
    "description": ""
}

响应

{
  "resp": "update_system",
  "code": 200,
  "msg": "成功",
  "result": {
    "id": 3,
    "organization_id": "",
    "uid": "SYS3405113700002",
    "name": "system2",
    "alias": "Sy02",
    "object_id": "obj1",
    "description": "",
    "created": "2023-04-10 14:08:51",
    "last_modified": "2023-04-10 14:08:51"
  }
}

删除调度系统 delete_system

请求:

{
    "action":"delete_system",
    "uid":"SYS3405113700002"
}

响应

{
    "resp": "delete_system",
    "code": 200,
    "msg": "成功",
    "result": {
        "uid": "SYS3405113700002"
    }
}

获取调度系统详情 get_system_item

请求

{
    "action":"get_system_item",
    "uid":"SYS3473205400001"
}

响应

{
    "resp": "get_system_item",
    "code": 200,
    "msg": "成功",
    "result": {
        "id": 1,
        "organization_id": "",
        "uid": "SYS3473205400001",
        "name": "SYS3473205400001",
        "alias": "Sy01",
        "object_id": "obj3",
        "description": "",
        "created": "2023-04-07 10:40:32",
        "last_modified": "2023-04-07 10:41:40"
    }
}

获取调度列表 get_system_list

请求

{
    "action":"get_system_list",
    "page_index": 1,
     "page_size": 10
}

响应

{
    "resp": "get_system_list",
    "code": 200,
    "msg": "成功",
    "result": {
        "page_index": 1,
        "page_size": 10,
        "total_pages": 1,
        "total_records": 1,
        "data": [
            {
                "id": 1,
                "organization_id": "",
                "uid": "SYS3473205400001",
                "name": "SYS3473205400001",
                "alias": "Sy01",
                "object_id": "obj3",
                "description": "",
                "created": "2023-04-07 10:40:32",
                "last_modified": "2023-04-07 10:41:40"
            }
        ]
    }
}

状态参数 (待完成)

创建状态参数 create_status_parameter

编辑状态参数 update_status_parameter

删除状态参数 delete_status_parameter

获取状态参数详情 get_status_parameter

获取状态参数列表 get_status_parameter

常数参数

创建常数参数 create_const_parameter

请求

{
    "action":"create_const_parameter",
    "system_id": "SYS3473205400001",
    "name": "const5",
    "alias": "C05",
    "type": "single",
    "unit": "A",
    "value": {
        "single": 12
    },
    "description": ""
}

响应

{
    "resp": "create_const_parameter",
    "code": 200,
    "msg": "成功",
    "result": {
        "id": 3,
        "organization_id": "",
        "system_id": "SYS3473205400001",
        "uid": "CPM3400041500003",
        "name": "const5",
        "alias": "C05",
        "type": "single",
        "unit": "A",
        "value": {
            "single": 12
        },
        "description": "",
        "created": "2023-04-10 14:15:00",
        "last_modified": "2023-04-10 14:15:00"
    }
}

编辑常数参数 update_const_parameter

请求

{
    "action":"update_const_parameter",
    "system_id": "SYS3471916600001",
    "uid": "CPM3470777600002",
    "name": "const2",
    "alias": "C02",
    "type": "single",
    "unit": "A",
    "value": {
        "single": 10
    },
    "description": ""
}

响应

{
    "resp": "update_const_parameter",
    "code": 200,
    "msg": "成功",
    "result": {
        "id": 3,
        "organization_id": "",
        "system_id": "SYS3473205400001",
        "uid": "CPM3400041500003",
        "name": "const5",
        "alias": "C05",
        "type": "single",
        "unit": "A",
        "value": {
            "single": 12
        },
        "description": "",
        "created": "2023-04-10 14:15:00",
        "last_modified": "2023-04-10 14:15:00"
    }
}

删除常数参数 delete_const_parameter

请求

{
    "action":"delete_const_parameter",
    "uid":"CPM3471379300003"
}

响应

{
    "resp": "delete_const_parameter",
    "code": 200,
    "msg": "成功",
    "result": {
        "uid": "CPM3471379300003"
    }
}

获取常数参数详情 get_const_parameter

请求

{
    "action":"get_const_parameter_item",
    "uid":"CPM3471379300003"
}

响应

{
    "resp": "get_const_parameter_item",
    "code": 200,
    "msg": "成功",
    "result": {
        "id": 3,
        "organization_id": "",
        "system_id": "SYS3473205400001",
        "uid": "CPM3400041500003",
        "name": "const5",
        "alias": "C05",
        "type": "single",
        "unit": "A",
        "value": {
            "single": 12
        },
        "description": "",
        "created": "2023-04-10 14:15:00",
        "last_modified": "2023-04-10 14:15:00"
    }
}

获取常数参数列表 get_const_parameter

请求

{
    "action":"get_const_parameter_list",
    "page_index": 1,
    "page_size": 10
}

响应

{
    "resp": "get_const_parameter_list",
    "code": 200,
    "msg": "成功",
    "result": {
        "page_index": 1,
        "page_size": 10,
        "total_pages": 1,
        "total_records": 2,
        "data": [
            {
                "id": 3,
                "organization_id": "",
                "system_id": "SYS3473205400001",
                "uid": "CPM3400041500003",
                "name": "const5",
                "alias": "C05",
                "type": "single",
                "unit": "A",
                "value": {
                    "single": 12
                },
                "description": "",
                "created": "2023-04-10 14:15:00",
                "last_modified": "2023-04-10 14:15:00"
            }
        ]
    }
}

可调控参数

创建可调控参数 create_adjust_parameter

请求

{
    "action":"create_adjust_parameter",
    "system_id": "SYS3473205400001",
    "name": "adjust02",
    "alias": "AD02",
    "type": "single",
    "unit": "A",
    "value": {
        "single": 12
    },
    "description": ""
}

响应

{
    "resp": "create_adjust_parameter",
    "code": 200,
    "msg": "成功",
    "result": {
        "id": 3,
        "organization_id": "",
        "system_id": "SYS3473205400001",
        "uid": "APM3401371400004",
        "name": "adjust02",
        "alias": "AD02",
        "type": "single",
        "unit": "A",
        "value": {
            "single": 12
        },
        "current_value": {
            "single": 12
        },
        "description": "",
        "created": "2023-04-10 14:20:13",
        "last_modified": "2023-04-10 14:20:13"
    }
}

编辑可调控参数 update_adjust_parameter

请求

{
    "action":"update_adjust_parameter",
    "system_id": "SYS3473205400001",
    "uid": "APM3474300600001",
    "name": "adjust01",
    "alias": "AD01",
    "type": "single",
    "unit": "A",
    "value": {
        "single": 12
    },
    "description": ""
}

响应

{
    "resp": "update_adjust_parameter",
    "code": 200,
    "msg": "成功",
    "result": {
        "id": 1,
        "organization_id": "",
        "system_id": "SYS3473205400001",
        "uid": "APM3474300600001",
        "name": "adjust01",
        "alias": "AD01",
        "type": "single",
        "unit": "A",
        "value": {
            "single": 12
        },
        "current_value": {},
        "description": "",
        "created": "2023-04-07 11:06:43",
        "last_modified": "2023-04-10 14:21:02"
    }
}

删除可调控参数 delete_adjust_parameter

请求

{
    "action":"delete_adjust_parameter",
    "uid":"APM3472343300002"
}

响应

{
    "resp": "delete_adjust_parameter",
    "code": 200,
    "msg": "成功",
    "result": {
        "uid": "APM3472343300002"
    }
}

获取可调控参数详情 get_adjust_parameter

请求

{
    "action":"get_adjust_parameter_item",
    "uid":"APM3401371400004"
}

响应

{
    "resp": "get_adjust_parameter_item",
    "code": 200,
    "msg": "成功",
    "result": {
        "id": 3,
        "organization_id": "",
        "system_id": "SYS3473205400001",
        "uid": "APM3401371400004",
        "name": "adjust02",
        "alias": "AD02",
        "type": "single",
        "unit": "A",
        "value": {
            "single": 12
        },
        "current_value": {
            "single": 12
        },
        "description": "",
        "created": "2023-04-10 14:20:13",
        "last_modified": "2023-04-10 14:20:13"
    }
}

获取可调控参数列表 get_adjust_parameter

请求

{
    "action": "get_adjust_parameter_list",
    "page_index": 1,
    "page_size": 10
}

响应

{
    "resp": "get_adjust_parameter_list",
    "code": 200,
    "msg": "成功",
    "result": {
        "page_index": 1,
        "page_size": 10,
        "total_pages": 1,
        "total_records": 2,
        "data": [
            {
                "id": 3,
                "organization_id": "",
                "system_id": "SYS3473205400001",
                "uid": "APM3401371400004",
                "name": "adjust02",
                "alias": "AD02",
                "type": "single",
                "unit": "A",
                "value": {
                    "single": 12
                },
                "current_value": {
                    "single": 12
                },
                "description": "",
                "created": "2023-04-10 14:20:13",
                "last_modified": "2023-04-10 14:20:13"
            }
        ]
    }
}

调度程序

创建调度程序 create_process

请求

{
  "action":"create_process",
  "system_id": "SYS3473205400001",
  "name": "process1",
  "alias": "p2",
  "language": "lua",
  "description": "",
  "script": "local log = require(\"log\")\r\nlocal json = require(\"json\")\r\nlocal http = require(\"http\")\r\ni = 0\r\nfunction run()\r\n        while true do\r\n          show(1,json.decode(param))\r\n          os.execute(\"sleep 15s\")\r\n          show(2,json.decode(param))\r\n          os.execute(\"sleep 15s\")\r\n        end\r\nend\r\n\r\n\r\nfunction show(msg, info)\r\n    local json_info = json.encode(info)\r\n    msg = \"[\" .. os.date(\"%Y-%m-%d %H:%M:%S\") .. \"] 测试param \" .. msg\r\n    print(msg)\r\n    print(json_info)\r\n    log.info(msg)\r\n    log.info(json_info)\r\nend\r\n\r\nreturn run()"
}

响应

{
    "resp": "create_process",
    "code": 200,
    "msg": "成功",
    "result": {
        "id": 3,
        "organization_id": "",
        "system_id": "SYS3473205400001",
        "uid": "PCE3405118800006",
        "name": "process1",
        "alias": "p2",
        "language": "lua",
        "script": "local log = require(\"log\")\r\nlocal json = require(\"json\")\r\nlocal http = require(\"http\")\r\ni = 0\r\nfunction run()\r\n        while true do\r\n          show(1,json.decode(param))\r\n          os.execute(\"sleep 15s\")\r\n          show(2,json.decode(param))\r\n          os.execute(\"sleep 15s\")\r\n        end\r\nend\r\n\r\n\r\nfunction show(msg, info)\r\n    local json_info = json.encode(info)\r\n    msg = \"[\" .. os.date(\"%Y-%m-%d %H:%M:%S\") .. \"] 测试param \" .. msg\r\n    print(msg)\r\n    print(json_info)\r\n    log.info(msg)\r\n    log.info(json_info)\r\nend\r\n\r\nreturn run()",
        "sleep": 0,
        "description": "",
        "created": "2023-04-10 14:23:51",
        "last_modified": "2023-04-10 14:23:51",
        "is_running": 0
    }
}

编辑调度程序 update_process

请求:

{
    "action":"update_process",
    "system_id": "SYS3473205400001",
    "uid":"PCE3471784800003",
    "name": "process1",
    "alias": "p1",
    "language": "lua",
    "description": "",
    "script": "local log = require(\"log\")\r\nlocal json = require(\"json\")\r\nlocal http = require(\"http\")\r\ni = 0\r\nfunction run()\r\n        while true do\r\n          show(1,json.decode(param))\r\n          os.execute(\"sleep 15s\")\r\n          show(2,json.decode(param))\r\n          os.execute(\"sleep 15s\")\r\n        end\r\nend\r\n\r\n\r\nfunction show(msg, info)\r\n    local json_info = json.encode(info)\r\n    msg = \"[\" .. os.date(\"%Y-%m-%d %H:%M:%S\") .. \"] 测试param \" .. msg\r\n    print(msg)\r\n    print(json_info)\r\n    log.info(msg)\r\n    log.info(json_info)\r\nend\r\n\r\nreturn run()"
}

响应

{
    "resp": "update_process",
    "code": 200,
    "msg": "成功",
    "result": {
        "id": 1,
        "organization_id": "",
        "system_id": "SYS3473205400001",
        "uid": "PCE3471784800003",
        "name": "process1",
        "alias": "p1",
        "language": "lua",
        "script": "local log = require(\"log\")\r\nlocal json = require(\"json\")\r\nlocal http = require(\"http\")\r\ni = 0\r\nfunction run()\r\n        while true do\r\n          show(1,json.decode(param))\r\n          os.execute(\"sleep 15s\")\r\n          show(2,json.decode(param))\r\n          os.execute(\"sleep 15s\")\r\n        end\r\nend\r\n\r\n\r\nfunction show(msg, info)\r\n    local json_info = json.encode(info)\r\n    msg = \"[\" .. os.date(\"%Y-%m-%d %H:%M:%S\") .. \"] 测试param \" .. msg\r\n    print(msg)\r\n    print(json_info)\r\n    log.info(msg)\r\n    log.info(json_info)\r\nend\r\n\r\nreturn run()",
        "sleep": 0,
        "description": "",
        "created": "2023-04-10 14:23:51",
        "last_modified": "2023-04-10 14:25:08",
        "is_running": 0
    }
}

删除调度程序 delete_process

请求

{
    "action":"delete_process",
    "uid": "PCE3405118800006"
}

响应

{
    "resp": "delete_process",
    "code": 200,
    "msg": "成功",
    "result": {
        "uid": "PCE3405118800006"
    }
}

获取调度程序详情 get_process_item

请求

{
    "action":"get_process_item",
    "uid":"PCE3471784800003"
}

响应

{
    "resp": "get_process_item",
    "code": 200,
    "msg": "成功",
    "result": {
        "id": 1,
        "organization_id": "",
        "system_id": "SYS3473205400001",
        "uid": "PCE3471784800003",
        "name": "process1",
        "alias": "p1",
        "language": "lua",
        "script": "local log = require(\"log\")\r\nlocal json = require(\"json\")\r\nlocal http = require(\"http\")\r\ni = 0\r\nfunction run()\r\n        while true do\r\n          show(1,json.decode(param))\r\n          os.execute(\"sleep 15s\")\r\n          show(2,json.decode(param))\r\n          os.execute(\"sleep 15s\")\r\n        end\r\nend\r\n\r\n\r\nfunction show(msg, info)\r\n    local json_info = json.encode(info)\r\n    msg = \"[\" .. os.date(\"%Y-%m-%d %H:%M:%S\") .. \"] 测试param \" .. msg\r\n    print(msg)\r\n    print(json_info)\r\n    log.info(msg)\r\n    log.info(json_info)\r\nend\r\n\r\nreturn run()",
        "sleep": 0,
        "description": "",
        "created": "2023-04-07 11:15:17",
        "last_modified": "2023-04-10 14:25:08",
        "is_running": 1
    }
}

获取调度程序列表 get_process_list

请求

{
    "action":"get_process_list",
    "page_index": 1,
    "page_size": 10
}

响应

{
    "resp": "get_process_list",
    "code": 200,
    "msg": "成功",
    "result": {
        "page_index": 1,
        "page_size": 10,
        "total_pages": 1,
        "total_records": 1,
        "data": [
            {
                "id": 1,
                "organization_id": "",
                "system_id": "SYS3473205400001",
                "uid": "PCE3471784800003",
                "name": "process1",
                "alias": "p1",
                "language": "lua",
                "script": "local log = require(\"log\")\r\nlocal json = require(\"json\")\r\nlocal http = require(\"http\")\r\ni = 0\r\nfunction run()\r\n        while true do\r\n          show(1,json.decode(param))\r\n          os.execute(\"sleep 15s\")\r\n          show(2,json.decode(param))\r\n          os.execute(\"sleep 15s\")\r\n        end\r\nend\r\n\r\n\r\nfunction show(msg, info)\r\n    local json_info = json.encode(info)\r\n    msg = \"[\" .. os.date(\"%Y-%m-%d %H:%M:%S\") .. \"] 测试param \" .. msg\r\n    print(msg)\r\n    print(json_info)\r\n    log.info(msg)\r\n    log.info(json_info)\r\nend\r\n\r\nreturn run()",
                "sleep": 0,
                "description": "",
                "created": "2023-04-07 11:15:17",
                "last_modified": "2023-04-10 14:25:08",
                "is_running": 1
            }
        ]
    }
}

执行调度程序 exec_process

请求

{
    "action":"exec_process",
    "process_id": "PCE3471784800003"
}

响应

{
    "resp": "exec_process",
    "code": 200,
    "msg": "成功",
    "result": "success"
}

停止调度程序 stop_process

请求

{
    "action":"stop_process",
    "process_id": "PCE3471784800003"
}

响应

{
    "resp": "stop_process",
    "code": 200,
    "msg": "成功",
    "result": "success"
}

热更新调度程序 hot_reload_process

请求

{
    "action":"hot_reload_process",
    "process_id": "PCE3471784800003"
}

响应

{
    "resp": "hot_reload_process",
    "code": 200,
    "msg": "成功",
    "result": "success"
}

获取调度程序列表执行记录 get_process_log_list

请求

{
    "action":"get_process_log_list",
    "page_index": 1,
    "page_size": 10
}

响应

{
    "resp": "get_process_log_list",
    "code": 200,
    "msg": "成功",
    "result": {
        "page_index": 1,
        "page_size": 10,
        "total_pages": 1,
        "total_records": 2,
        "data": [
            {
                "id": 2,
                "organization_id": "",
                "system_id": "SYS3473205400001",
                "uid": "LOG3402622400008",
                "process_id": "PCE3400746900007",
                "exec_time": "2023-04-10 14:29:26",
                "exec_parameter": {
                    "adjust_parameter": [
                        {
                            "alias": "AD01",
                            "created": "2023-04-07 11:06:43",
                            "current_value": {},
                            "description": "",
                            "id": 1,
                            "last_modified": "2023-04-10 14:21:02",
                            "name": "adjust01",
                            "organization_id": "",
                            "system_id": "SYS3473205400001",
                            "type": "single",
                            "uid": "APM3474300600001",
                            "unit": "A",
                            "value": {
                                "single": 12
                            }
                        },
                        {
                            "alias": "AD02",
                            "created": "2023-04-10 14:20:13",
                            "current_value": {
                                "single": 12
                            },
                            "description": "",
                            "id": 3,
                            "last_modified": "2023-04-10 14:20:13",
                            "name": "adjust02",
                            "organization_id": "",
                            "system_id": "SYS3473205400001",
                            "type": "single",
                            "uid": "APM3401371400004",
                            "unit": "A",
                            "value": {
                                "single": 12
                            }
                        }
                    ],
                    "const_parameter": [
                        {
                            "alias": "C02",
                            "created": "2023-04-07 10:42:07",
                            "description": "",
                            "id": 1,
                            "last_modified": "2023-04-07 10:42:43",
                            "name": "const2",
                            "organization_id": "",
                            "system_id": "SYS3473205400001",
                            "type": "single",
                            "uid": "CPM3470777600002",
                            "unit": "A",
                            "value": {
                                "single": 10
                            }
                        },
                        {
                            "alias": "C05",
                            "created": "2023-04-10 14:15:00",
                            "description": "",
                            "id": 3,
                            "last_modified": "2023-04-10 14:15:00",
                            "name": "const5",
                            "organization_id": "",
                            "system_id": "SYS3473205400001",
                            "type": "single",
                            "uid": "CPM3400041500003",
                            "unit": "A",
                            "value": {
                                "single": 12
                            }
                        }
                    ],
                    "object_id": "obj3"
                },
                "exec_result": {},
                "is_finish": 0,
                "created": "2023-04-10 14:29:26",
                "last_modified": "2023-04-10 14:29:26"
            }
        ]
    }
}

调度程序中的全局变量

pub2mmq 订阅事件通道

<暂略>

mmq_resp 接收事件通道

<暂略>

mmq_stop 接收事件停止通道

<暂略>

param 调度参数

形式:

{
    "const_parameter": [],//常数参数
    "adjust_parameter": [],  //可调控参数
    "status_parameter": [] //状态参数
}
文档更新时间: 2024-08-09 13:29   作者:技术支持