投稿

优质
小牛编辑
130浏览
2023-12-01

提交投稿

POST /news/categories/:category/news

Input

字段类型描述
titleString必须,标题,最长 20 个字。
subjectString主题,副标题,概述,最长 200 个字。
contentString必须,内容。
imageInteger缩略图。
tagsstring,array必须 标签id,多个id以逗号隔开或传入数组形式
fromString资讯来源。
authorString作者
text_contentstring纯文本字段
passwordstring根据启动信息决定是否传递,用户密码,支付需要用户输入密码进行付费支付。)

用户投稿时,用户输入摘要正文

数据提交到服务端时,将用户输入的摘要填写到subject字段, 将用户输入的正文按照markdown格式填写到content字段

前端渲染正文时,使用markdown格式渲染subject字段和content字段

Response
Status: 201 Created
{
  "message": [
    "投稿成功"
  ]
}

修改投稿

PATCH /news/categories/:category/news/:news

Input

字段类型描述
titleString标题,最长 20 个字。
subjectString主题,副标题,概述,最长 200 个字。
contentString内容。
tagsstring,array标签id,多个id以逗号隔开或传入数组形式
imageInteger缩略图。
fromString资讯来源。
authorString作者
text_contentstring纯文本字段
Response
Status: 204 No Content

删除投稿

DELETE /news/categories/:category/news/:news

Response

Status: 204 No Content

已发布时需要提交删除申请

Status: 201 Created

申请退款

PUT /news/categories/:category/news/:news

Response

Status: 201 Created
{
  "message": [
    "申请成功"
  ]
}

获取用户投稿列表

GET /user/news/contributes

请求参数

名称类型描述
limitInteger获取条数,默认 20
afterInteger上次获取列表最小的 ID。默认 0
typeInteger筛选类型 0-已发布 1-待审核 3-被驳回 默认为全部
userInteger查询用户id,只能查看他人已发布的资讯
Response
Status: 200 OK
[
  {
    "id": 1,
    "created_at": "2017-07-24 07:33:36",
    "updated_at": "2017-07-24 07:33:36",
    "title": "haha",
    "content": "### Title @![image](1) \r\n @[image](xx)",
    "digg_count": 0,
    "comment_count": 0,
    "hits": 0,
    "from": "原创",
    "is_recommend": 0,
    "subject": "我是测试的概述",
    "author": "Seven",
    "audit_status": 1,
    "audit_count": 0,
    "user_id": 1,
    "contribute_amount": 0,
    "has_collect": false,
    "has_like": false,
    "category": {
      "id": 1,
      "name": "c1",
      "rank": 0
    },
    "image": {
      "id": 13,
      "size": "1932x1932"
    },
    "tags": []
  }
]
名称描述
id投稿,资讯ID
created_at创建时间
updated_at更新时间
title标题
subject副标题,主题,概述
content内容
digg_count点赞,喜欢数量统计
comment_count评论数
hits阅读数
from来源
is_recommend是否被推荐
author作者
audit_status状态,0 正常,1 代审核, 3 驳回,5 退款中
audit_count审核次数
contribute_amount投稿支付了多少钱
has_collect是否已收藏
has_like是否已点赞
category分类信息
image缩略图信息
category.id分类 ID
category.name分类名称
image.idfile with ID
image.size图像尺寸,数据异常或者该附件为非图像,则为 null
tags标签列表