{
  "tags": [
    "日志"
  ],
  "description": "分页查询资源新增、更新和删除等操作日志，按日志 ID 倒序返回。普通用户只能查看自己的操作；管理员可查询全部日志或用 uid 筛选指定用户。支持按 IP、时间、资源类别、操作动作、操作对象和变更内容筛选，limit=0 时返回全部匹配记录。",
  "operationId": "user_get_v1_log_op",
  "security": [
    {
      "AccessToken": []
    },
    {
      "ApiKey": [],
      "ApiSecret": []
    }
  ],
  "responses": {
    "200": {
      "description": "业务结果使用 HTTP 200 返回。成功响应含 code、count、data，不含 msg；页码、每页数量或认证失败时返回统一业务错误封装。",
      "content": {
        "application/json": {
          "schema": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "code",
                  "count",
                  "data"
                ],
                "properties": {
                  "code": {
                    "type": "integer",
                    "enum": [
                      0
                    ],
                    "description": "成功状态码，固定为 0。"
                  },
                  "count": {
                    "type": "integer",
                    "format": "int64",
                    "minimum": 0,
                    "description": "当前权限和筛选条件下、未应用分页前的日志总数。"
                  },
                  "data": {
                    "type": "array",
                    "description": "当前页操作日志，按 id 倒序排列。",
                    "items": {
                      "type": "object",
                      "required": [
                        "id",
                        "uid",
                        "type",
                        "action",
                        "content",
                        "diff",
                        "ip",
                        "ip_location",
                        "create_at",
                        "process",
                        "create_at2"
                      ],
                      "properties": {
                        "id": {
                          "type": "integer",
                          "format": "int64",
                          "description": "操作日志 ID。"
                        },
                        "uid": {
                          "type": "integer",
                          "format": "int64",
                          "nullable": true,
                          "description": "执行操作的用户 ID。"
                        },
                        "type": {
                          "type": "string",
                          "nullable": true,
                          "description": "资源类别，例如 网站、任务、证书、ACL。"
                        },
                        "action": {
                          "type": "string",
                          "nullable": true,
                          "description": "操作动作，通用写入逻辑为 新增、更新 或 删除。"
                        },
                        "content": {
                          "type": "string",
                          "nullable": true,
                          "description": "被操作对象的标识文本，通常为资源 ID 或逗号分隔的资源 ID。"
                        },
                        "diff": {
                          "type": "string",
                          "nullable": true,
                          "description": "字段变更详情文本或 JSON 文本；新增、删除操作通常为空。"
                        },
                        "ip": {
                          "type": "string",
                          "nullable": true,
                          "description": "执行操作的客户端 IP。"
                        },
                        "ip_location": {
                          "type": "string",
                          "nullable": true,
                          "description": "服务端根据 IP 记录的地理位置，格式通常为 国家-省份-城市。"
                        },
                        "create_at": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true,
                          "description": "数据库返回的操作创建时间。"
                        },
                        "process": {
                          "type": "string",
                          "nullable": true,
                          "description": "操作处理标记；通用新增、更新、删除写入时为空字符串。"
                        },
                        "create_at2": {
                          "type": "string",
                          "nullable": true,
                          "description": "格式化后的操作时间，格式为 YYYY-MM-DD HH:mm:ss。"
                        }
                      },
                      "additionalProperties": false,
                      "description": "单条操作日志。"
                    }
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "object",
                "required": [
                  "code",
                  "msg",
                  "data"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "log_op-1",
                      "log_op-2",
                      "login_required"
                    ],
                    "description": "page 格式错误、limit 格式错误或认证失败的业务错误码。"
                  },
                  "msg": {
                    "type": "string",
                    "description": "具体错误原因。"
                  },
                  "data": {
                    "type": "string",
                    "enum": [
                      ""
                    ],
                    "description": "业务错误时固定为空字符串。"
                  }
                },
                "additionalProperties": false
              }
            ]
          },
          "examples": {
            "success": {
              "summary": "查询成功",
              "value": {
                "code": 0,
                "count": 1,
                "data": [
                  {
                    "id": 301,
                    "uid": 12,
                    "type": "网站",
                    "action": "更新",
                    "content": "101",
                    "diff": "[{\"field\":\"domain\",\"old\":\"old.example.com\",\"new\":\"www.example.com\"}]",
                    "ip": "198.51.100.23",
                    "ip_location": "中国-北京市-北京市",
                    "create_at": "2026-01-01T12:00:00",
                    "process": "",
                    "create_at2": "2026-01-01 12:00:00"
                  }
                ]
              }
            }
          },
          "example": {
            "code": 0,
            "count": 1,
            "data": [
              {
                "id": 301,
                "uid": 12,
                "type": "网站",
                "action": "更新",
                "content": "101",
                "diff": "[{\"field\":\"domain\",\"old\":\"old.example.com\",\"new\":\"www.example.com\"}]",
                "ip": "198.51.100.23",
                "ip_location": "中国-北京市-北京市",
                "create_at": "2026-01-01T12:00:00",
                "process": "",
                "create_at2": "2026-01-01 12:00:00"
              }
            ]
          }
        }
      }
    }
  },
  "x-python-handler": "system.OpAPI",
  "x-python-route-line": 712,
  "x-audience": "user",
  "x-auth": "user",
  "x-reviewed": true,
  "parameters": [
    {
      "name": "page",
      "in": "query",
      "required": false,
      "description": "页码，默认 1。服务端仅校验为数字，分页偏移为 (page - 1) × limit。",
      "schema": {
        "type": "integer",
        "format": "int32",
        "minimum": 1,
        "default": 1
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "description": "每页记录数，默认 10；传 0 时不附加 SQL limit，返回全部匹配记录。",
      "schema": {
        "type": "integer",
        "format": "int32",
        "minimum": 0,
        "default": 10
      }
    },
    {
      "name": "uid",
      "in": "query",
      "required": false,
      "description": "仅管理员有效：精确筛选操作用户 ID。普通用户提供此参数仍只查询自己的日志。",
      "schema": {
        "type": "integer",
        "format": "int64",
        "minimum": 1
      }
    },
    {
      "name": "ip",
      "in": "query",
      "required": false,
      "description": "按客户端 IP 进行包含匹配，不要求完整 IP。",
      "schema": {
        "type": "string",
        "example": "198.51.100"
      }
    },
    {
      "name": "start",
      "in": "query",
      "required": false,
      "description": "创建时间下限，筛选 create_at 大于或等于该值。服务端直接交给数据库比较。",
      "schema": {
        "type": "string",
        "example": "2026-01-01 00:00:00"
      }
    },
    {
      "name": "end",
      "in": "query",
      "required": false,
      "description": "创建时间上限（不含），筛选 create_at 小于该值。服务端直接交给数据库比较。",
      "schema": {
        "type": "string",
        "example": "2026-01-02 00:00:00"
      }
    },
    {
      "name": "type",
      "in": "query",
      "required": false,
      "description": "精确筛选资源类别，即日志中的 type，例如 网站、任务、证书或 ACL。",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "action",
      "in": "query",
      "required": false,
      "description": "精确筛选操作动作。通用写入逻辑使用 新增、更新、删除。",
      "schema": {
        "type": "string",
        "enum": [
          "新增",
          "更新",
          "删除"
        ]
      }
    },
    {
      "name": "content",
      "in": "query",
      "required": false,
      "description": "按操作对象内容进行包含匹配，例如资源 ID 或以逗号分隔的资源 ID。",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "diff",
      "in": "query",
      "required": false,
      "description": "按字段变更内容进行包含匹配。该字段通常保存更新前后差异的文本或 JSON 文本。",
      "schema": {
        "type": "string"
      }
    }
  ],
  "x-itecdn-source-reviewed": true,
  "extensions": [
    {
      "key": "x-python-handler",
      "value": "system.OpAPI"
    },
    {
      "key": "x-python-route-line",
      "value": 712
    },
    {
      "key": "x-audience",
      "value": "user"
    },
    {
      "key": "x-auth",
      "value": "user"
    },
    {
      "key": "x-reviewed",
      "value": true
    },
    {
      "key": "x-itecdn-source-reviewed",
      "value": true
    }
  ],
  "method": "get",
  "path": "/v1/log/op",
  "servers": [
    {
      "url": "https://master.example.invalid",
      "description": "不可调用的示例地址；复制示例后替换为自己的主控域名。"
    }
  ],
  "securitySchemes": {
    "AccessToken": {
      "type": "apiKey",
      "in": "header",
      "name": "access-token",
      "description": "通过登录接口获得的短期访问令牌。"
    },
    "ApiKey": {
      "type": "apiKey",
      "in": "header",
      "name": "api-key",
      "description": "API Key；必须和 api-secret 同时发送。"
    },
    "ApiSecret": {
      "type": "apiKey",
      "in": "header",
      "name": "api-secret",
      "description": "API Secret；必须和 api-key 同时发送。"
    }
  },
  "info": {
    "title": "itecdn v5 用户 API",
    "version": "5.x",
    "description": "itecdn v5.x Python 主控用户 API。本文档不适用于 v6 或其它实现。"
  },
  "postman": {
    "name": "查询操作日志",
    "description": {
      "content": "分页查询资源新增、更新和删除等操作日志，按日志 ID 倒序返回。普通用户只能查看自己的操作；管理员可查询全部日志或用 uid 筛选指定用户。支持按 IP、时间、资源类别、操作动作、操作对象和变更内容筛选，limit=0 时返回全部匹配记录。",
      "type": "text/plain"
    },
    "url": {
      "path": [
        "v1",
        "log",
        "op"
      ],
      "host": [
        "{{baseUrl}}"
      ],
      "query": [
        {
          "disabled": false,
          "description": {
            "content": "页码，默认 1。服务端仅校验为数字，分页偏移为 (page - 1) × limit。",
            "type": "text/plain"
          },
          "key": "page",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "每页记录数，默认 10；传 0 时不附加 SQL limit，返回全部匹配记录。",
            "type": "text/plain"
          },
          "key": "limit",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "仅管理员有效：精确筛选操作用户 ID。普通用户提供此参数仍只查询自己的日志。",
            "type": "text/plain"
          },
          "key": "uid",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "按客户端 IP 进行包含匹配，不要求完整 IP。",
            "type": "text/plain"
          },
          "key": "ip",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "创建时间下限，筛选 create_at 大于或等于该值。服务端直接交给数据库比较。",
            "type": "text/plain"
          },
          "key": "start",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "创建时间上限（不含），筛选 create_at 小于该值。服务端直接交给数据库比较。",
            "type": "text/plain"
          },
          "key": "end",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "精确筛选资源类别，即日志中的 type，例如 网站、任务、证书或 ACL。",
            "type": "text/plain"
          },
          "key": "type",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "精确筛选操作动作。通用写入逻辑使用 新增、更新、删除。",
            "type": "text/plain"
          },
          "key": "action",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "按操作对象内容进行包含匹配，例如资源 ID 或以逗号分隔的资源 ID。",
            "type": "text/plain"
          },
          "key": "content",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "按字段变更内容进行包含匹配。该字段通常保存更新前后差异的文本或 JSON 文本。",
            "type": "text/plain"
          },
          "key": "diff",
          "value": ""
        }
      ],
      "variable": []
    },
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "method": "GET",
    "auth": {
      "type": "apikey",
      "apikey": [
        {
          "type": "any",
          "value": "access-token",
          "key": "key"
        },
        {
          "type": "any",
          "value": "{{apiKey}}",
          "key": "value"
        },
        {
          "type": "any",
          "value": "header",
          "key": "in"
        }
      ]
    }
  }
}