itecdn 5.x用户文档
itecdn 5.x / 用户 API

获取消息完整详情

GET/v1/messages/{message_id}

按 ID 返回 message 表的完整消息记录(包含正文及发送状态字段)。接口要求登录。若消息指定了 receive 且其值不是当前用户 ID,则仅管理员可查看;服务端不额外检查 is_show,因此已登录用户可读取未指定接收者的隐藏消息详情。

身份认证

access-token

api-key + api-secret

认证定义
{
  "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 同时发送。"
  }
}

请求参数

参数位置类型必填说明与约束
message_idpathinteger必填

消息 ID。路由只匹配整数;不存在时返回业务错误。

完整参数定义
{
  "name": "message_id",
  "in": "path",
  "required": true,
  "schema": {
    "type": "integer"
  },
  "description": "消息 ID。路由只匹配整数;不存在时返回业务错误。",
  "example": 101
}

响应

HTTP 200

成功、消息不存在、接收者权限不足及认证错误均返回 HTTP 200。成功响应的 msg 固定为空字符串。

application/json

oneOf

oneOf · 1 · object
字段类型必填说明与约束
codeinteger必填

0 表示查询成功。

约束 / 默认值 / 示例
{
  "enum": [
    0
  ]
}
msgstring必填

详情查询成功时固定为空字符串。

约束 / 默认值 / 示例
{
  "enum": [
    ""
  ]
}
dataobject必填

消息表完整记录。布尔数据库字段按 0/1 数值返回。

约束 / 默认值 / 示例
{
  "required": [
    "id",
    "type",
    "pub_user",
    "receive",
    "title",
    "content",
    "phone_content",
    "templ_id",
    "templ_para",
    "event_id",
    "user_package_id",
    "site_id",
    "is_show",
    "is_red",
    "is_bold",
    "is_external",
    "is_popup",
    "email_need_send",
    "phone_need_send",
    "email_is_sent",
    "phone_is_sent",
    "url",
    "sort",
    "create_at",
    "update_at"
  ],
  "additionalProperties": false
}
展开字段结构

消息表完整记录。布尔数据库字段按 0/1 数值返回。

字段类型必填说明与约束
idinteger必填

消息 ID。

typestring必填

消息类型,例如 announcement。

约束 / 默认值 / 示例
{
  "nullable": true
}
pub_userinteger必填

发布者用户 ID。

约束 / 默认值 / 示例
{
  "nullable": true
}
receiveinteger必填

指定接收用户 ID;为空表示未指定单个接收者。

约束 / 默认值 / 示例
{
  "nullable": true
}
titlestring必填

消息标题。

约束 / 默认值 / 示例
{
  "nullable": true
}
contentstring必填

站内消息正文;外部链接消息通常为空字符串。

约束 / 默认值 / 示例
{
  "nullable": true
}
phone_contentstring必填

短信发送正文。

约束 / 默认值 / 示例
{
  "nullable": true
}
templ_idstring必填

消息发送模板 ID。

约束 / 默认值 / 示例
{
  "nullable": true
}
templ_parastring必填

模板参数文本。

约束 / 默认值 / 示例
{
  "nullable": true
}
event_idstring必填

关联事件标识。

约束 / 默认值 / 示例
{
  "nullable": true
}
user_package_idinteger必填

关联用户套餐 ID。

约束 / 默认值 / 示例
{
  "nullable": true
}
site_idinteger必填

关联网站 ID。

约束 / 默认值 / 示例
{
  "nullable": true
}
is_showinteger必填

展示标记:1 展示,0 隐藏。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ],
  "nullable": true
}
is_redinteger必填

红色标题标记。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ],
  "nullable": true
}
is_boldinteger必填

粗体标题标记。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ],
  "nullable": true
}
is_externalinteger必填

外部链接标记:1 使用 url,0 使用 content。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ],
  "nullable": true
}
is_popupinteger必填

弹窗显示标记。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ],
  "nullable": true
}
email_need_sendinteger必填

是否需要发送邮件通知。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ],
  "nullable": true
}
phone_need_sendinteger必填

是否需要发送短信通知。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ],
  "nullable": true
}
email_is_sentinteger必填

邮件是否已发送。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ],
  "nullable": true
}
phone_is_sentinteger必填

短信是否已发送。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ],
  "nullable": true
}
urlstring必填

外部消息跳转地址。

约束 / 默认值 / 示例
{
  "nullable": true
}
sortinteger必填

排序值。

约束 / 默认值 / 示例
{
  "nullable": true
}
create_atstring (date-time)必填

消息创建时间。

约束 / 默认值 / 示例
{
  "format": "date-time",
  "nullable": true
}
update_atstring (date-time)必填

消息更新时间。

约束 / 默认值 / 示例
{
  "format": "date-time",
  "nullable": true
}
oneOf · 2 · object
字段类型必填说明与约束
codestring必填

分别表示消息不存在、指定接收者消息需要管理员权限或认证失败。

约束 / 默认值 / 示例
{
  "enum": [
    "message-18",
    "message-32",
    "login_required"
  ]
}
msgstring必填

具体错误原因。

datastring必填

业务错误时为空字符串。

约束 / 默认值 / 示例
{
  "enum": [
    ""
  ]
}
完整 Schema
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "code",
        "msg",
        "data"
      ],
      "properties": {
        "code": {
          "type": "integer",
          "enum": [
            0
          ],
          "description": "0 表示查询成功。"
        },
        "msg": {
          "type": "string",
          "enum": [
            ""
          ],
          "description": "详情查询成功时固定为空字符串。"
        },
        "data": {
          "type": "object",
          "description": "消息表完整记录。布尔数据库字段按 0/1 数值返回。",
          "required": [
            "id",
            "type",
            "pub_user",
            "receive",
            "title",
            "content",
            "phone_content",
            "templ_id",
            "templ_para",
            "event_id",
            "user_package_id",
            "site_id",
            "is_show",
            "is_red",
            "is_bold",
            "is_external",
            "is_popup",
            "email_need_send",
            "phone_need_send",
            "email_is_sent",
            "phone_is_sent",
            "url",
            "sort",
            "create_at",
            "update_at"
          ],
          "properties": {
            "id": {
              "type": "integer",
              "description": "消息 ID。"
            },
            "type": {
              "type": "string",
              "nullable": true,
              "description": "消息类型,例如 announcement。"
            },
            "pub_user": {
              "type": "integer",
              "nullable": true,
              "description": "发布者用户 ID。"
            },
            "receive": {
              "type": "integer",
              "nullable": true,
              "description": "指定接收用户 ID;为空表示未指定单个接收者。"
            },
            "title": {
              "type": "string",
              "nullable": true,
              "description": "消息标题。"
            },
            "content": {
              "type": "string",
              "nullable": true,
              "description": "站内消息正文;外部链接消息通常为空字符串。"
            },
            "phone_content": {
              "type": "string",
              "nullable": true,
              "description": "短信发送正文。"
            },
            "templ_id": {
              "type": "string",
              "nullable": true,
              "description": "消息发送模板 ID。"
            },
            "templ_para": {
              "type": "string",
              "nullable": true,
              "description": "模板参数文本。"
            },
            "event_id": {
              "type": "string",
              "nullable": true,
              "description": "关联事件标识。"
            },
            "user_package_id": {
              "type": "integer",
              "nullable": true,
              "description": "关联用户套餐 ID。"
            },
            "site_id": {
              "type": "integer",
              "nullable": true,
              "description": "关联网站 ID。"
            },
            "is_show": {
              "type": "integer",
              "enum": [
                0,
                1
              ],
              "nullable": true,
              "description": "展示标记:1 展示,0 隐藏。"
            },
            "is_red": {
              "type": "integer",
              "enum": [
                0,
                1
              ],
              "nullable": true,
              "description": "红色标题标记。"
            },
            "is_bold": {
              "type": "integer",
              "enum": [
                0,
                1
              ],
              "nullable": true,
              "description": "粗体标题标记。"
            },
            "is_external": {
              "type": "integer",
              "enum": [
                0,
                1
              ],
              "nullable": true,
              "description": "外部链接标记:1 使用 url,0 使用 content。"
            },
            "is_popup": {
              "type": "integer",
              "enum": [
                0,
                1
              ],
              "nullable": true,
              "description": "弹窗显示标记。"
            },
            "email_need_send": {
              "type": "integer",
              "enum": [
                0,
                1
              ],
              "nullable": true,
              "description": "是否需要发送邮件通知。"
            },
            "phone_need_send": {
              "type": "integer",
              "enum": [
                0,
                1
              ],
              "nullable": true,
              "description": "是否需要发送短信通知。"
            },
            "email_is_sent": {
              "type": "integer",
              "enum": [
                0,
                1
              ],
              "nullable": true,
              "description": "邮件是否已发送。"
            },
            "phone_is_sent": {
              "type": "integer",
              "enum": [
                0,
                1
              ],
              "nullable": true,
              "description": "短信是否已发送。"
            },
            "url": {
              "type": "string",
              "nullable": true,
              "description": "外部消息跳转地址。"
            },
            "sort": {
              "type": "integer",
              "nullable": true,
              "description": "排序值。"
            },
            "create_at": {
              "type": "string",
              "format": "date-time",
              "nullable": true,
              "description": "消息创建时间。"
            },
            "update_at": {
              "type": "string",
              "format": "date-time",
              "nullable": true,
              "description": "消息更新时间。"
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    {
      "type": "object",
      "required": [
        "code",
        "msg",
        "data"
      ],
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "message-18",
            "message-32",
            "login_required"
          ],
          "description": "分别表示消息不存在、指定接收者消息需要管理员权限或认证失败。"
        },
        "msg": {
          "type": "string",
          "description": "具体错误原因。"
        },
        "data": {
          "type": "string",
          "enum": [
            ""
          ],
          "description": "业务错误时为空字符串。"
        }
      },
      "additionalProperties": false
    }
  ]
}

示例

{
  "code": 0,
  "msg": "",
  "data": {
    "id": 101,
    "type": "announcement",
    "pub_user": 1,
    "receive": null,
    "title": "服务通知",
    "content": "系统将在今晚进行维护。",
    "phone_content": null,
    "templ_id": null,
    "templ_para": null,
    "event_id": null,
    "user_package_id": null,
    "site_id": null,
    "is_show": 1,
    "is_red": 0,
    "is_bold": 1,
    "is_external": 0,
    "is_popup": 0,
    "email_need_send": 0,
    "phone_need_send": 0,
    "email_is_sent": 0,
    "phone_is_sent": 0,
    "url": "",
    "sort": 100,
    "create_at": "2026-01-01T12:00:00",
    "update_at": "2026-01-01T12:00:00"
  }
}

查询成功

{
  "code": 0,
  "msg": "",
  "data": {
    "id": 101,
    "type": "announcement",
    "pub_user": 1,
    "receive": null,
    "title": "服务通知",
    "content": "系统将在今晚进行维护。",
    "phone_content": null,
    "templ_id": null,
    "templ_para": null,
    "event_id": null,
    "user_package_id": null,
    "site_id": null,
    "is_show": 1,
    "is_red": 0,
    "is_bold": 1,
    "is_external": 0,
    "is_popup": 0,
    "email_need_send": 0,
    "phone_need_send": 0,
    "email_is_sent": 0,
    "phone_is_sent": 0,
    "url": "",
    "sort": 100,
    "create_at": "2026-01-01T12:00:00",
    "update_at": "2026-01-01T12:00:00"
  }
}

消息不存在

{
  "code": "message-18",
  "msg": "消息不存在",
  "data": ""
}

cURL 示例

根据文档生成;请替换主控地址、路径参数和凭证,并按上表补充查询参数。

curl --request GET \
  "https://master.example.invalid/v1/messages/{message_id}" \
  --header "access-token: YOUR_ACCESS_TOKEN"

查看完整接口 JSON