主题 - jues-zz/ddexpert_server GitHub Wiki

1. get /topics 主题首页

接收 get 参数

offset Number 偏移文章数
tab String 主题分类 (如果没有或为'all'时则默认获取全部主题列表)
limit Number 每一页的主题数量
mdrender String 当为 false 时,不渲染。默认为 true
hot String 热门主题 可选,为1时按主题热门排序

示例:/api/v1/topics

2. get /topic/:id 主题详情

接收 get 参数

mdrender String 当为 false 时,不渲染。默认为 true
accesstoken String 用户的 accessToken(可选,带此参数,主题里面会有in_collection字段,为0未收藏,为1则已收藏)  

示例:/api/v1/topic/5433d5e4e737cbe96dcef312

3. post /topic/create 新建主题(新建主题并发布,新建主题并保存为草稿)

接收 post 参数

title   String 标题  
cover   String 封面图片url  
tab     String 目前有 ask share job  
content String 主题内容  
draft   String 是否为草稿 可选 没有或为其它则新建主题并发布 为1则新建主题并保存为草稿
song    Json   歌曲结构  
loc     Json   经纬度  
accesstoken String 用户的 accessToken  

loc = {
  type: "Point" ,
  coordinates: [0, 0]
};

song = {
"starred": false,
"popularity": 95,
"starredNum": 0,
"playedNum": 0,
"dayPlays": 0,
"hearTime": 0,
"mp3Url": "http://m2.music.126.net/1H7iZ9sWANTqKlKAD0L5vw==/1012650209189890.mp3",
"rtUrls": [],
"name": "玫瑰色的你",
"id": 326695,
"position": 1,
"duration": 297927,
"status": 1,
"alias": [],
"artists": [
    {
        "img1v1Id": 0,
        "name": "张悬",
        "id": 10557,
        "alias": [],
        "briefDesc": "",
        "picUrl": "http://p3.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
        "picId": 0,
        "albumSize": 0,
        "img1v1Url": "http://p4.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
        "trans": "",
        "musicSize": 0
    }
],
"score": 95,
"album": {
    "songs": [],
    "name": "神的游戏",
    "id": 32311,
    "type": "专辑",
    "size": 10,
    "status": 1,
    "description": "",
    "tags": "",
    "alias": [
        "Games We Play"
    ],
    "artists": [
        {
            "img1v1Id": 0,
            "name": "张悬",
            "id": 10557,
            "alias": [],
            "briefDesc": "",
            "picUrl": "http://p4.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
            "picId": 0,
            "albumSize": 0,
            "img1v1Url": "http://p3.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
            "trans": "",
            "musicSize": 0
        }
    ],
    "briefDesc": "",
    "artist": {
        "img1v1Id": 0,
        "name": "",
        "id": 0,
        "alias": [],
        "briefDesc": "",
        "picUrl": "http://p4.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
        "picId": 0,
        "albumSize": 0,
        "img1v1Url": "http://p3.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
        "trans": "",
        "musicSize": 0
    },
    "picUrl": "http://p3.music.126.net/cdoUJ2yO5LRuJhGeIsRdjQ==/46179488380332.jpg",
    "picId": 46179488380332,
    "commentThreadId": "R_AL_3_32311",
    "publishTime": 1344528000000,
    "company": "索尼音乐娱乐",
    "copyrightId": 5003,
    "blurPicUrl": "http://p4.music.126.net/cdoUJ2yO5LRuJhGeIsRdjQ==/46179488380332.jpg",
    "companyId": 0,
    "pic": 46179488380332
},
"commentThreadId": "R_SO_4_326695",
"fee": 0,
"hMusic": {
    "name": "玫瑰色的你",
    "id": 10334053,
    "size": 11930240,
    "extension": "mp3",
    "dfsId": 1012650209189888,
    "playTime": 297927,
    "bitrate": 320000,
    "sr": 44100,
    "volumeDelta": -1.31
},
"mMusic": {
    "name": "玫瑰色的你",
    "id": 10334054,
    "size": 5976935,
    "extension": "mp3",
    "dfsId": 1012650209189889,
    "playTime": 297927,
    "bitrate": 160000,
    "sr": 44100,
    "volumeDelta": -0.87
},
"lMusic": {
    "name": "玫瑰色的你",
    "id": 10334055,
    "size": 3595194,
    "extension": "mp3",
    "dfsId": 1012650209189890,
    "playTime": 297927,
    "bitrate": 96000,
    "sr": 44100,
    "volumeDelta": -0.89
},
"copyrightId": 7001,
"mvid": 5102,
"ftype": 0,
"rtype": 0,
"rurl": null,
"copyFrom": "",
"bMusic": {
    "name": "玫瑰色的你",
    "id": 10334055,
    "size": 3595194,
    "extension": "mp3",
    "dfsId": 1012650209189890,
    "playTime": 297927,
    "bitrate": 96000,
    "sr": 44100,
    "volumeDelta": -0.89
},
"audition": {
    "name": "玫瑰色的你",
    "id": 38036062,
    "size": 2411001,
    "extension": "m4a",
    "dfsId": 5841705278434201,
    "playTime": 297927,
    "bitrate": 64000,
    "sr": 44100,
    "volumeDelta": 0
},
"ringtone": "600902000009458622",
"disc": "",
"no": 1,
"crbt": "b957432baaac42d8096f76ae357992ce",
"rtUrl": null
}

返回值示例

{ errcode:0, topic: {} }

4. post /topic/:tid/edit 编辑主题(修改主题、修改草稿、把草稿发布出来)

接收 post 参数

title   String 标题  
cover   String 封面图片url  
tab     String 目前有 ask share job  
content String 主题内容  
draft   String 是否为草稿 可选 为0或其它则把草稿发布出来 为1则保存为草稿
song    Json   歌曲结构  
loc     Json   经纬度  
accesstoken String 用户的 accessToken  

返回值示例

{success: true, topic: {} }

5. post /topic/:tid/delete 删除主题

接收 post 参数

accesstoken String 用户的 accessToken  

返回值示例

{ errcode: 0, message: '话题已被删除。' }

6. post /topic/:topic_id/ups 为主题点赞

接受 post 参数

accesstoken String

接口会自动判断用户是否已点赞,如果否,则点赞;如果是,则取消点赞。点赞的动作反应在返回数据的 action 字段中,up or down。 返回值示例

{"success": true, "action": "down"}

7. post /topic/collect 收藏/取消收藏主题

接收 post 参数

accesstoken String 用户的 accessToken
topic_id String 被收藏的主题id

返回值示例

{success: true}

8. get /songtopics/:id 歌曲对应的主题

接收 get 参数, id为网易歌曲id

offset Number 偏移文章数
limit Number 每一页的主题数量
mdrender String 当为 false 时,不渲染。默认为 true
hot String 热门主题 可选,为1时按主题热门排序

返回值