说说详情接口

接口说明

获取单条说说的详细信息。返回说说的完整内容和相关信息。

  • 接口URL: /api/shuoshuos/show
  • 请求方法: POST
  • 权限要求: 无需登录即可访问

请求参数

参数名 类型 必填 说明 示例值
shuoshuo_id number 说说ID 1

响应结构

typescript 复制代码
interface Response {
  code: number;      // 状态码
  message: string;   // 响应消息
  data?: {
    shuoshuo_id: number;     // 说说ID
    shuoshuo_text: string;   // 说说内容
    shuoshuo_date: string;   // 发布日期
    shuoshuo_coll_id: number;// 分类ID
  };
}

响应示例

json 复制代码
{
  "code": 0,
  "message": "success",
  "data": {
    "shuoshuo_id": 1,
    "shuoshuo_text": "今天天气真好,出去散步了一圈,遇到了很多有趣的事情。在公园里看到了一群小朋友在玩耍,他们的笑声让整个下午都充满了欢乐。回家的路上买了一杯奶茶,感觉生活真美好。",
    "shuoshuo_date": "2024-01-01",
    "shuoshuo_coll_id": 1
  }
}

特殊说明

内容处理

  • 返回说说的完整内容,不会进行截断
  • 支持富文本内容的展示

错误码说明

错误码 说明 处理建议
0 成功 -
404 说说不存在 检查说说ID是否正确
500 服务器错误 请联系管理员

调用示例

typescript 复制代码
const response = await fetch('/api/shuoshuos/show', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    shuoshuo_id: 1
  })
});

const result = await response.json();
if (result.code === 0) {
  // 获取成功,显示说说详情
  console.log(result.data);
} else {
  // 获取失败,显示错误信息
  console.error(result.message);
}