打赏

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

打赏资讯

POST /news/{news}/rewards

Parameters

nametypemustdescription
amountintyes打赏金额

Response

Headers

Status: 201 Created

Body

{
  "message": [
    "打赏成功"
  ]
}

新版打赏资讯

POST /news/{news}/new-rewards

Parameters

nametypemustdescription
amountintyes打赏金额

Response

Headers

Status: 201 Created

Body

{
  "message": [
    "打赏成功"
  ]
}

资讯打赏列表

GET /news/{news}/rewards

Parameters

nametypemustdescription
limitintno列表返回数据条数
offsetintno偏移量,翻页时传入
orderstringno排序 正序-asc 倒序desc
order_typestringno排序规则 date-按时间 amount-按金额

Response

Headers

Status: 200 OK

Body

[
  {
    "id": 1,
    "user_id": 1,
    "target_user": 1,
    "amount": 200,
    "rewardable_id": 1,
    "rewardable_type": "news",
    "created_at": "2017-08-01 02:13:28",
    "updated_at": "2017-08-01 02:13:28",
    "user": {
      "id": 1,
      "name": "root",
      "bio": null,
      "sex": 0,
      "location": null,
      "created_at": "2017-07-31 03:16:19",
      "updated_at": "2017-07-31 03:16:19",
      "avatar": null,
      "bg": null,
      "verified": null,
      "extra": {
        "user_id": 1,
        "likes_count": 0,
        "comments_count": 1,
        "followers_count": 0,
        "followings_count": 0,
        "updated_at": "2017-07-31 06:06:58",
        "feeds_count": 0
      }
    }
  },
  {
    "id": 2,
    "user_id": 2,
    "target_user": 1,
    "amount": 210,
    "rewardable_id": 1,
    "rewardable_type": "news",
    "created_at": "2017-08-01 02:13:28",
    "updated_at": "2017-08-01 02:13:28",
    "user": {
      "id": 2,
      "name": "root1",
      "bio": null,
      "sex": 0,
      "location": null,
      "created_at": "2017-07-31 03:16:19",
      "updated_at": "2017-07-31 03:16:19",
      "avatar": null,
      "bg": null,
      "verified": null,
      "extra": null
    }
  },
  {
    "id": 3,
    "user_id": 3,
    "target_user": 1,
    "amount": 220,
    "rewardable_id": 1,
    "rewardable_type": "news",
    "created_at": "2017-08-01 02:13:28",
    "updated_at": "2017-08-01 02:13:28",
    "user": {
      "id": 3,
      "name": "root2",
      "bio": null,
      "sex": 0,
      "location": null,
      "created_at": "2017-07-31 03:16:19",
      "updated_at": "2017-07-31 03:16:19",
      "avatar": null,
      "bg": null,
      "verified": null,
      "extra": null
    }
  }
]
名称描述
id打赏记录id
user_id打赏用户id
target_user被打赏用户id
amount打赏金额
rewardable_id被打赏资源id
rewardable_type被打赏资源标识
user打赏用户信息
user.name打赏用户名称
user.avatar打赏用户头像
user.bio打赏用户简介
user.sex打赏目标性别
user.location打赏目标地区
user.bg打赏目标背景图片
user.verified打赏目标认证
user.extra打赏目标扩展字段

资讯打赏统计

GET /news/{news}/rewards/sum

Response

Headers

Status: 200 OK
{
  "count": 3,
  "amount": "630"
}
名称描述
count资讯打赏总记录 无记录时为0
amount资讯打赏总额 无记录时为null