评论

作者: 宝宝爱樱花 | 来源:发表于2018-09-10 23:41 被阅读0次

接口约定

  • 使用https
  • restful风格
  • 用户端:https://{域名}/api/{接口版本号}/{resource}/{resource_id}/{sub_resource}/{sub_resource_id}/{action}?{query_string}
  • 管理端:https://{域名}/admin/api/{接口版本号}/{resource}/{resource_id}/{sub_resource}/{sub_resource_id}/{action}?{query_string}
  • 测试环境域名babieta.xivan.cn
  • 正式环境域名待定
  • 公共参数放在header,如userid,session_key,unionid,version等
  • resource: comments

接口


POST /comments/<busi_type>/<busi_id>

name cname type Description
用途 评论
版本号 v1.0
busi_type 业务类型 string soak(浸泡训练)
busi_id 业务id string
请求数据:

body 参数/可选参数

name cname type Description
text 评论内容 string

curl -i -XPOST  "https://babieta.xivan.cn/api/v1.0/comments/soak/1" -H "openid:oslC94mGqAAEz6iWhKhL9dEY5l3o" -H "token:25e8ba0469c6f1c0c6dcd4fe952b8e4e" -d '{"text":"内容"}'

wx.request({
      "url":"https://babieta.xivan.cn/api/v1.0/comments/soak/1", 
      "method":"POST",
      "success": res =>{
        console.log(res)
      },
      "data":{text:'内容'},
      "dataType":"json", 
      "header": { "content-type":"application/json",
        "openid": "oslC94mGqAAEz6iWhKhL9dEY5l3o", "token":"25e8ba0469c6f1c0c6dcd4fe952b8e4e"},
      "complete": res => {
        console.log(res)
      }
    })
返回数据:
name cname type Description
code int 返回码 0成功 非0失败
msg string 错误信息

{
    "msg": "",
    "code": 0,
}

GET /comments/<busi_type>/<busi_id>

name cname type Description
用途 评论
版本号 v1.0
busi_type 业务类型 string soak(浸泡训练)
busi_id 业务id string
请求数据:

query string 参数/可选参数

name cname type Description
cursor 游标,用于分页 string 取上一次页面的cursor透传,默认不传或空
limit 数量 int 默认10

curl -i "https://babieta.xivan.cn/api/v1.0/comment/soak/1?limit=10&cursor=10" -H "openid:oslC94mGqAAEz6iWhKhL9dEY5l3o" -H "token:25e8ba0469c6f1c0c6dcd4fe952b8e4e"

wx.request({
      "url":"https://babieta.xivan.cn/api/v1.0/comment/soak/1?limit=10&cursor=10", 
      "method":"GET",
      "success": res =>{
        console.log(res)
      },
      "data":{busi_type:'soak', busi_id:1, limit:10, last_id='1123'},
      "dataType":"json", 
      "header": { "content-type":"application/x-www-form-urlencoded",
        "openid": "oslC94mGqAAEz6iWhKhL9dEY5l3o", "token":"25e8ba0469c6f1c0c6dcd4fe952b8e4e"},
      "complete": res => {
        console.log(res)
      }
    })
返回数据:
name cname type Description
code int 返回码 0成功 非0失败
msg string 错误信息

{
    "msg": "",
    "code": 0,
        "list": [{
             "id":"11",    //评论id
             "content":"abc", //评论内容
             "comment_ts":1111111, //评论时间
             "comment_user": {  //评论人信息
                  "nickname":"aa" , //昵称
                  "avatar_url":"http://111.jpg", //头像
                  "userid":"1232", //id
                  "level":10           //级别
             },
             "praise_count":10  //点赞数,
             "praise_flag":1   //点赞状态  1 已点赞 0 未点赞
   
       },...],
       "count":123,//评论类型
       "cursor":"111"   //透传id
}

相关文章

  • 评论里评论的评论的评论

    你是我见过的对工作和生活最认真的菇凉,智商超高但情商略显不足。你有书写日记及阅读的好习惯,希望这个习惯可以让你改变...

  • 看评论的评论

    看到自己几篇无聊时打发时间随手写的文的评论时,虽然赞多过贬,却让我深刻的感受到什么叫“一样米养百样人”,一样的文章...

  • 评论别人的评论

    时评,就是时事评论,当一个新闻曝光的时候,很快就在互联网上传播开来,这时,媒体和自媒体便会针对这个事件发表看法,尤...

  • 评论

    灰色下面的阳光是流淌的江。视频下面的评论是千百个心的臆想。 1:将这个事情或动作换一个环境一个情境将会如何,表达对...

  • 评论

    @7组|李鹃|007-5995| 链接:https://mp.weixin.qq.com/s/SjSSw0PTe1...

  • 评论

    看《生门》的时候,我情绪是沉重、纠结的! 我在想那个在要紧关头连5万块钱都需要东拼西凑,押房贷款哪来的勇气生孩子?...

  • 评论

    我对《偶尔辜负他人的期望》的评论 辜负他人期望的人。我听到这句话,认为它充满了贬义的色彩,因为我一直都感觉,辜负他...

  • 评论

    接口约定 使用httpsrestful风格用户端:https://{域名}/api/{接口版本号}/{resour...

  • 评论

    链接:https://note.youdao.com/share/mobile.html?id=3e70ee912...

  • “评论”???

    【570】每日步行第570天 最近一段时间,我对“评论”感到非常苦恼。因为我不擅长给简友发表“评论”。 内心虚弱的...

网友评论

      本文标题:评论

      本文链接:https://www.haomeiwen.com/subject/pxthgftx.html