wiki:price_jiekou

Version 61 (modified by hejingdong, 12 years ago) (diff)

--

1.基本约定

1.当接口处理正常时,HTTP STATUS CODE 返回给200。包括有正常的业务数据和数据为空的情况。

2.当接口处理异常时,HTTP STATUS CODE 返回给500,并且给出具体的错误信息。
    {
	"uri" : "/intf/albums-by-type.jsp",
	"error-desc":"Need you follow uid.",
        "user-notice":"给用户的提示放在这里"
    }`
    
3.接口默认的字符编码是UTF-8,接口需要实现对req-enc和resp-enc参数的支持。在JSP的最顶部,实现类似下面的代码:

        String queryString = request.getQueryString();
        String requestEncoding = getParam(queryString,"req_enc");
        String responseEncoding = getParam(queryString,"resp_enc");
        if(isNotBlank(requestEncoding)){
            request.setCharacterEncoding(requestEncoding);
        }
        if(isNotBlank(responseEncoding)){
            response.setCharacterEncoding(responseEncoding);
        }

4.所有有写操作的数据接口,必须用POST方式提交,在接口里需要判断提交方式,拒绝GET的调用请求。

5.接口中的JSON字符串,key都用双引号("")包裹,value是字符串类型时,也用双引号("")包裹;是数字类型时,不用引号。

2.接口列表

2.1 优惠/发现 分类接口

(维护:成荣伟)

    url:http://best.pconline.com.cn/intf/iphone/getTopicType.jsp 
    HTTP请求方式:get
    是否需要登录:否
    提交参数:isIndex:是否首页分类,1表示是,0表示不是,默认0
    参数说明: 

返回数据:
{
  "order": [                                                             //排序(发现页)
    {
      "name": "最新发现", //分类名字
      "id": "0", //分类ID,用于2.2中的topicId参数
      "imageSrc": "www.pconline.com.cn", //图标
      "imageSrcPressed": "www.pconline.com.cn" //被选中的图标
    },
    {
      "name": "最热发现",
      "url": "www.pconlien.com.cn",
      "id": "0",
      "imageSrc": "www.pconline.com.cn",
      "imageSrcPressed": "www.pconline.com.cn"
    }
  ],
  "category": [                                                         //优惠分类
    {
      "name": "优惠精选",
      "id": "123",
      "imageSrc": "www.pconline.com.cn",
      "imageSrcPressed": "www.pconline.com.cn"
    },
    {
      "name": "数码家电",
      "id": "124",
      "imageSrc": "www.pconline.com.cn",
      "imageSrcPressed": "www.pconline.com.cn"
    }
  ]
}

2.2文章列表接口

(维护:成荣伟)

    url:http://best.pconline.com.cn/intf/iphone/getTopicList.jsp
    请求参数: pageNo:页码,默认1
	           pageSize:每页显示记录数,默认20
	           recommendIndex:是否推荐首页,默认0不推荐
                   topicTypeId:分类ID
                   mallId:电商ID(可选)
    请求方法:get
    是否需要登录:否
    返回参数:
{
    "pageCount":9, //分页数
    "pageNo":1, //页码
    "pageTotal":35, // 数据总数
    "topicTypeId: 0, //分类ID
   "focus": [
    {
      "id": "",
      "title": "",
      "image": "",
      "invalid": 1
    }
   ],
    "topics":[ //数据
        {
            "commentNum":"0",    //评论数
            "id":"2395585",
            "title":"有钱你就来",    //标题
            "image":"http://img0.pcauto.com.cn/pcauto/1303/15/2395585_1.png",  //图片
            "pubDate":"2013-02-03",        //时间
            "good":"20",    //值的数量
            "bad":"1",        //不值的数量
            "price":"只售998,还包邮~"    //价格
            "deprecated":1            //是否过期
            currentPrice = "0.00"; //现在价格
            discount = "0.0折"; //打折数
            formerPrice = "0.00"; //之前价格
            “eb”:"电商名称",
        }
    ],
    "pageSize":"20" //每页数据数
}

2.3 终端页接口

(维护:成荣伟、制作:甘剑威)

    url:http://best.pconline.com.cn/intf/iphone/getTopicHtml.jsp
    请求参数:	topicId:爆料ID
	                type:爆料类型
    请求方法:get
    是否需要登录:否
    返回参数:web页面的html代码

备注:
    附加信息用注释的方式放到html代码里面以/*@_HTML_META_START_开头, _HTML_META_END_@*/结尾,里面的内容有评论url,标题以及发送微博用的图片url,用json格式,例如:

<!-- 
/*@_HTML_META_START_    
{"url":"http://best.pconline.com.cn/discovery_art.jsp?topicId=3064","title":"东芝 3TB DT01ACA300 7200转 64M SATA3 台式机硬盘","firstPic":"http://img.pconline.com.cn/images/upload/upc/tx/pc_best/1309/02/c0/25177373_1378101718895_350x350.jpg"}
_HTML_META_END_@*/
 -->

2.4 评论列表接口

(客户端通用)

url:http://mrobot.pconline.com.cn/v3/cmt/new_topics 
 HTTP请求方式:get
    是否需要登录:否
    提交参数:
            topicId: 评论id 
            articleId: 文章id

返回数据:
{
  "comments": [
    {  //没有引用其他评论的评论
      "1": { //表达其引用关系的key
        "id":"24991904",//帖子id
        "name": "不是网易的江苏省盐城市网友&nbsp;帅气飞扬: ",  //用户名称
        "floor": "1737",  //楼层
        "time": "2013-01-05 09:05:40",  //时间
        "content": "内容过于暴力,已和谐" //内容
      },
      "current":"1",               //当前最外层引用标识
      "support":"10086"       //"顶"数量
      "expand":false  //判断是否展开,默认为false
    },
    {
      "3": {
        "id":"24991804",//帖子id
        "name": "不是网易的江苏省盐城市网友&nbsp;帅气飞扬: ",
        "floor": "1737",
        "time": "2013-01-05 09:05:40",
        "content": "内容过于暴力,已和谐"
      },
      "2": {
        "id":"24941904",//帖子id
        "name": "不是网易的江苏省盐城市网友&nbsp;帅气飞扬: ",
        "floor": "1737",
        "time": "2013-01-05 09:05:40",
        "content": "内容过于暴力,已和谐"
      },
      "1": {
        "id":"24491904",//帖子id
        "name": "不是网易的江苏省盐城市网友&nbsp;帅气飞扬: ",
        "floor": "1737",
        "time": "2013-01-05 09:05:40",
        "content": "内容过于暴力,已和谐"
      },
      "4": {
        "id":"24993904",//帖子id
        "name": "不是网易的江苏省盐城市网友&nbsp;帅气飞扬: ",
        "floor": "1737",
        "time": "2013-01-05 09:05:40",
        "content": "内容过于暴力,已和谐"
      },
      "current":"4",
      "support":"10086" //顶数
      "expand":false  //判断是否展开,默认为false
    }
  ],
  "hot-comments": [
    {  //没有引用其他评论的评论
      "1": { //表达其引用关系的key
        "id":"24691904",//帖子id
        "name": "不是网易的江苏省盐城市网友&nbsp;帅气飞扬: ",  //用户名称
        "floor": "1737",  //楼层
        "time": "2013-01-05 09:05:40",  //时间
        "content": "内容过于暴力,已和谐" //内容
      },
      "current":"1"
      "support":"10086" //顶数
      "expand":false  //判断是否展开,默认为false
    }
  ],
  "docUrl": "http://im_an_artical"
}

备注:

2.5 发评论接口

(客户端通用)

http://cmt.pcauto.com.cn/action/comment/create_utf8.jsp
HTTP请求方式:post
    是否需要登录:否
    提交参数:id:话题id
                    url:话题url
                    common_session_id:太平洋通行证session
                    username:用户名
                    anonymous:是否匿名
                    content:内容
                    replyFloor2:回复楼层(可选)
                    通过body传参

    返回数据:
{
    "commentId":25705754,
    "floor":27,
    "showName":"iostester",
    "brief":"Really&nbsp;good&nbsp;car&nbsp;hm~~~",
    "status":0,
    "createTime":"2013-07-19 10:37:03",
    "resultCode":0,
    "resultMsg":"您的评论已经成功发表。注:评论在审核后才能出现在列表中,谢谢!",
    "userId":25520497
}

2.6 值不值接口

(维护:成荣伟)

    url:http://best.pconline.com.cn/intf/iphone/likeAndDislike.jsp
    请求参数: topicId:爆料ID
	          operate:值或不值,0表示值,1表示不值
                  common_session_id:太平洋通行证session (当有登录时发,无登录时不发)
    请求方法:get
    是否需要登录:否
    返回参数:
{
    "resultCode":0,
    "resultMsg":"您的投票已经成功发表。注:评论在审核后才能出现在列表中,谢谢!"
}

2.7 摇一摇接口

(维护:成荣伟)

     url:http://best.pconline.com.cn/intf/iphone/getTopicListOfTop.jsp
    
    备注:摇一摇接口出文章列表规则:当前时间算24小时内首页接口文章最新的100篇,不足100篇的话有多少出多少,时间按发布时间排序,不分页.

    请求参数: 无
    请求方法:get
    是否需要登录:否
    返回参数:
{
    "pageCount":"1",
    "pageNo":"1",
    "data":[
        {
            "commentNum":"0",
            "id":"2395585",
            "title":"“BMW大师殿堂”杨丽萍舞剧《孔雀》在陕西惊艳登场",
            "image":"http://img0.pcauto.com.cn/pcauto/1303/15/2395585_1.png",
            "pubDate":"2013-02-03",        //时间
            "wroth":"1",    //值的数量
            "price":"160元包邮"    //价格
        }
    ],
    "pageSize":"20"
}

2.8 太平洋统一登录接口

(客户端通用)

    url:http://mrobot.pcauto.com.cn/proxy/passport2/login
    
    备注:
    请求参数:username:用户名
                  password:密码
    请求方法:post
    是否需要登录:否
    返回参数:
{
    "status": 0,
    "message": "ok",
    "session": "123456",
    "userId": 25520497,
    "common_session_id": "123456"
}

2.9 晒单首页

    url:http://www.pconline.com.cn/jrzcz/app/1311/intf3741.js
    
    备注:
    请求参数:
    请求方法:get
    是否需要登录:否
    返回参数:
{
topics: [   帖子数组
    {
        id: 48074,   id
        image: "http://img0.pconline.com.cn/pconline/jrzcz/1311/28525424_1384151163247_0_1024x1024.jpg",   导读图
        title: "晒屌丝破车升级20寸轮毂+土豪邻居新车",    标题
        time: "2013-11-13"   发表时间
    }
]
}

3.0 晒单终端

    url:http://mrobot.pconline.com.cn/best/topics/45049?pageNo=1
    
    备注:
    请求参数:id_0:帖子id,  pageNo:页数, authorId:为0时查看全部,为楼主id时只看楼主 
    请求方法:get
    是否需要登录:否

3.1 回帖

    url:http://piebbs.pconline.com.cn/rest/topics/${topicId}
    
    备注:
    请求参数:
    agent = 1;
    message = 内容;
    replyToId = 31202601;
设置header  Cookie = "common_session_id=xxxx";
    请求方法:post
    是否需要登录:否
    返回参数:

3.2 搜索

    url:http://best.pconline.com.cn/intf/iphone/searchResult.jsp
    
    参数:
keyword 搜索关键词(会去除前后空格)String

              recommendIndex 优惠1/发现0 int
              
pageNo 页号 int
              
pageSize 页大小(默认20)
    请求方法:get
    是否需要登录:否
    返回参数:
{
    "pageCount":9, //分页数
    "pageNo":1, //页码
    "pageTotal":35, // 数据总数
"pagesize
    "topics":[ //数据
        {
            "commentNum":"0",    //评论数
            "id":"2395585",
            "title":"有钱你就来",    //标题
       "image":"http://img0.pcauto.com.cn/pcauto/1303/15/2395585_1.png",  //图片
            "pubDate":"2013-02-03",        //时间
            "good":"20",    //值的数量
            "bad":"1",        //不值的数量
            "price":"只售998,还包邮~"    //价格
            "deprecated":1            //是否过期
            currentPrice = "0.00"; //现在价格
            discount = "0.0折"; //打折数
            formerPrice = "0.00"; //之前价格

        }
    ],
    "pageSize":"20" //每页数据数
}

3.3 搜索热词

    url:http://www.pconline.com.cn/jrzcz/app/1311/intf3722.js
    
    备注:
    请求参数:
    请求方法:get
    是否需要登录:否
    返回参数:

V1.2.0用到的接口

4.0 获取收藏列表

    url:http://192.168.50.32:8082/intf/iphone/getCollectsForApp.jsp
    
    参数:
    common_session_id: 登录后session,Cookies中
    topicTypeId: 类型(1优惠、2发现、3海淘、4经验、5晒物)
    recommendIndex:推荐类型
    pageNo:
    pageSize:
    请求方法:get
    是否需要登录:否
    返回参数:
{
  "products": [
    {
      "id": 123,
      “title”: "",
      "time": "",
      "price": "",
      "eb": "",(电商名称)
      "image": "http://xxx",
      "invalid": (1已失效,0未失效)
    }
  ],
  "pageNo": 1,
  "pageSize": 20,
  "total": 100
}
晒物和经验没有的字段,填入空字符串

4.1 添加收藏

    url:http://192.168.50.32:8082/intf/iphone/collectForApp.jsp
    
    参数:
    common_session_id: 登录后session,Cookies中
    topicId:12312
    type: 类型(1优惠、2发现、3海淘、4经验、5晒物)//暂时不用
    
    请求方法:post
    是否需要登录:否
    返回参数:
{
  "result": {
    "status": (1成功,0失败),
    "msg": (失败后的提示)
  }
}

4.2 删除收藏

    url:http://192.168.50.32:8082/intf/iphone/deleteCollectForApp.jsp
    参数:
    common_session_id: 登录后session,Cookies中
    topicIds:12312,57847   id的串,用逗号分隔,可单个可多个
    type: 类型(1优惠、2发现、3海淘、4经验、5晒物)//暂时不用
    
    请求方法:post
    是否需要登录:否
    返回参数:
{
  "result": {
    "status": (1成功,0失败),
    "msg": (失败后的提示)
  }
}

5.0 晒货

    url:
    参数:
    common_session_id: 登录后session,Cookies中
    pageNo:
    pageSize:
    
    请求方法:get
    是否需要登录:否
    返回参数:
{
topics: [   帖子数组
    {
        id: 48074,   id
        image: "http://img0.pconline.com.cn/pconline/jrzcz/1311/28525424_1384151163247_0_1024x1024.jpg",   导读图
        title: "晒屌丝破车升级20寸轮毂+土豪邻居新车",    标题
        time: "2013-11-13"   发表时间
        cmtCount: 12   评论数量
    }
]

6.0 我的消息数

    url:
    参数:
    common_session_id: 登录后session,Cookies中
    
    请求方法:post
    是否需要登录:否
    返回参数:
{
  "blCount":100   爆料数量
}

7.0 我的爆料

    url:
    参数:
    common_session_id: 登录后session,Cookies中
    pageNo:
    pageSize:
    typeId: 类型(1优惠、2发现、3海淘、4经验、5晒物)//暂时不用
    
    请求方法:get
    是否需要登录:否
    返回参数:
{
  "list": [
    {
      "id": 123,
      "url": "",
      "time": "",
      "image": "http://xxx",
      "status": -1(1已通过,0审核中,-1不通过)
      "reason": "抄袭!"
    },
   {
      "id": 123,
      "url": "",
      "time": "",
      "image": "http://xxx",
      "status": 1(1已通过,0审核中,-1不通过)
      "award": "奖励5金币",
    }
  ]
}

8.0 签到

    url:
    参数:
    common_session_id: 登录后session,Cookies中
    
    请求方法:post
    是否需要登录:是
    返回参数:
{
"result": 1(1成功,0失败)
“count”: 2,(已签到次数)
“addgold”:2,(金币增加)
"addpoint"4,(积分增加)
“gold”:100,(金币总数)
"point"100,(积分总数)
}

9.0用户基本信息

    url:
    参数:
    common_session_id: 登录后session,Cookies中
    
    请求方法:get
    是否需要登录:是
    返回参数:
{
"name":"用户名",
"gold":50,
"point"100
}
已过期:
{
"result":TRUE
}