| 1 | | 1.基本约定 |
| 2 | | |
| 3 | | {{{ |
| 4 | | 1.基本约定 |
| 5 | | |
| 6 | | 1.当接口处理正常时,HTTP STATUS CODE 返回给200。包括有正常的业务数据和数据为空的情况。 |
| 7 | | |
| 8 | | 2.当接口处理异常时,HTTP STATUS CODE 返回给500,并且给出具体的错误信息。 |
| 9 | | { |
| 10 | | "uri" : "/intf/albums-by-type.jsp", |
| 11 | | "error-desc":"Need you follow uid.", |
| 12 | | "user-notice":"给用户的提示放在这里" |
| 13 | | }` |
| 14 | | |
| 15 | | 3.接口默认的字符编码是UTF-8,接口需要实现对req-enc和resp-enc参数的支持。在JSP的最顶部,实现类似下面的代码: |
| 16 | | |
| 17 | | String queryString = request.getQueryString(); |
| 18 | | String requestEncoding = getParam(queryString,"req_enc"); |
| 19 | | String responseEncoding = getParam(queryString,"resp_enc"); |
| 20 | | if(isNotBlank(requestEncoding)){ |
| 21 | | request.setCharacterEncoding(requestEncoding); |
| 22 | | } |
| 23 | | if(isNotBlank(responseEncoding)){ |
| 24 | | response.setCharacterEncoding(responseEncoding); |
| 25 | | } |
| 26 | | |
| 27 | | 4.所有有写操作的数据接口,必须用POST方式提交,在接口里需要判断提交方式,拒绝GET的调用请求。 |
| 28 | | |
| 29 | | 5.接口中的JSON字符串,key都用双引号("")包裹,value是字符串类型时,也用双引号("")包裹;是数字类型时,不用引号 |
| 30 | | }}} |
| | 1 | [[TOC]] |
| | 2 | |
| | 3 | == 一.基本约定 == |
| | 4 | |
| | 5 | {{{ |
| | 6 | 1.基本约定 |
| | 7 | |
| | 8 | 1.当接口处理正常时,HTTP STATUS CODE 返回给200。包括有正常的业务数据和数据为空的情况。 |
| | 9 | |
| | 10 | 2.当接口处理异常时,HTTP STATUS CODE 返回给500,并且给出具体的错误信息。 |
| | 11 | { |
| | 12 | "uri" : "/intf/albums-by-type.jsp", |
| | 13 | "error-desc":"Need you follow uid.", |
| | 14 | "user-notice":"给用户的提示放在这里" |
| | 15 | }` |
| | 16 | |
| | 17 | 3.接口默认的字符编码是UTF-8,接口需要实现对req-enc和resp-enc参数的支持。在JSP的最顶部,实现类似下面的代码: |
| | 18 | |
| | 19 | String queryString = request.getQueryString(); |
| | 20 | String requestEncoding = getParam(queryString,"req_enc"); |
| | 21 | String responseEncoding = getParam(queryString,"resp_enc"); |
| | 22 | if(isNotBlank(requestEncoding)){ |
| | 23 | request.setCharacterEncoding(requestEncoding); |
| | 24 | } |
| | 25 | if(isNotBlank(responseEncoding)){ |
| | 26 | response.setCharacterEncoding(responseEncoding); |
| | 27 | } |
| | 28 | |
| | 29 | 4.所有有写操作的数据接口,必须用POST方式提交,在接口里需要判断提交方式,拒绝GET的调用请求。 |
| | 30 | |
| | 31 | 5.接口中的JSON字符串,key都用双引号("")包裹,value是字符串类型时,也用双引号("")包裹;是数字类型时,不用引号 |
| | 32 | }}} |
| | 33 | |
| | 34 | == 二.接口列表 == |
| | 35 | === 1.0首页 === |
| | 36 | {{{ |
| | 37 | 备注:首页 |
| | 38 | 请求URL:http:// |
| | 39 | HTTP请求方式:get |
| | 40 | 是否需要登录:否 |
| | 41 | 返回格式:JSON |
| | 42 | 缓存方式:无 |
| | 43 | 缓存时间:无 |
| | 44 | 请求参数: |
| | 45 | status:1备孕,2怀孕,3育儿 |
| | 46 | weeks:第几周 |
| | 47 | |
| | 48 | 返回参数: |
| | 49 | { |
| | 50 | focus:[ |
| | 51 | { |
| | 52 | id: |
| | 53 | image: |
| | 54 | title: |
| | 55 | type:论坛(1列表、2终端);亲子学院(3列表、4终端);活动(5列表、6终端);工具(7终端);食谱(8终端);资讯(9终端);问答(10终端);百科(11终端) |
| | 56 | } |
| | 57 | ], |
| | 58 | recommend:[ |
| | 59 | { |
| | 60 | id: |
| | 61 | image: |
| | 62 | title: |
| | 63 | type:论坛(1列表、2终端);亲子学院(3列表、4终端);活动(5列表、6终端);工具(7终端);食谱(8终端);资讯(9终端);问答(10终端);百科(11终端) |
| | 64 | } |
| | 65 | ], |
| | 66 | hotChannels:[ |
| | 67 | { |
| | 68 | id: |
| | 69 | name: |
| | 70 | type: |
| | 71 | image: |
| | 72 | } |
| | 73 | ] |
| | 74 | } |
| | 75 | }}} |
| | 76 | === 2.0工具 === |
| | 77 | ==== 2.1工具首页 ==== |
| | 78 | {{{ |
| | 79 | 备注:工具类首页 |
| | 80 | 请求URL:http:// |
| | 81 | HTTP请求方式:get |
| | 82 | 是否需要登录:否 |
| | 83 | 返回格式:html页面 |
| | 84 | 缓存方式:无 |
| | 85 | 缓存时间:无 |
| | 86 | 请求参数: |
| | 87 | |
| | 88 | 协议: |
| | 89 | 点击二胎政策查询,pcbabybible://policy-search |
| | 90 | 点击备孕日历,pcbabybible://pregnancy-calendar |
| | 91 | 点击其他工具,正常HTTP协议 |
| | 92 | }}} |
| | 93 | |
| | 94 | ==== 2.2其他工具 ==== |
| | 95 | {{{ |
| | 96 | 备注:其他工具 |
| | 97 | 请求URL:http:// |
| | 98 | HTTP请求方式:get |
| | 99 | 是否需要登录:否 |
| | 100 | 返回格式:html页面 |
| | 101 | 缓存方式:无 |
| | 102 | 缓存时间:无 |
| | 103 | 请求参数: |
| | 104 | }}} |
| | 105 | |
| | 106 | === 3.0每日知识 === |
| | 107 | ==== 3.0每日知识首页 ==== |
| | 108 | {{{ |
| | 109 | 备注:每日知识首页 |
| | 110 | 请求URL:http:// |
| | 111 | HTTP请求方式:get |
| | 112 | 是否需要登录:否 |
| | 113 | 返回格式:JSON |
| | 114 | 缓存方式:无 |
| | 115 | 缓存时间:无 |
| | 116 | 请求参数: |
| | 117 | status:1备孕,2怀孕,3育儿 |
| | 118 | weeks:第几周 |
| | 119 | |
| | 120 | 返回参数: |
| | 121 | { |
| | 122 | tips:"", |
| | 123 | cookbook:[ |
| | 124 | { |
| | 125 | id: |
| | 126 | image: |
| | 127 | title: |
| | 128 | des: |
| | 129 | } |
| | 130 | ], |
| | 131 | timeline:[ |
| | 132 | { |
| | 133 | "title":"优生优育", |
| | 134 | "section":[ |
| | 135 | { |
| | 136 | id: |
| | 137 | image: |
| | 138 | title: |
| | 139 | type:论坛(1列表、2终端);亲子学院(3列表、4终端);活动(5列表、6终端);工具(7终端);食谱(8终端);资讯(9终端);问答(10终端);百科(11终端) |
| | 140 | }, |
| | 141 | { |
| | 142 | id: |
| | 143 | image: |
| | 144 | title: |
| | 145 | type: |
| | 146 | } |
| | 147 | ] |
| | 148 | }, |
| | 149 | { |
| | 150 | "title":"生男生女", |
| | 151 | "section":[ |
| | 152 | { |
| | 153 | id: |
| | 154 | image: |
| | 155 | title: |
| | 156 | type: |
| | 157 | }, |
| | 158 | { |
| | 159 | id: |
| | 160 | image: |
| | 161 | title: |
| | 162 | type: |
| | 163 | } |
| | 164 | ] |
| | 165 | } |
| | 166 | ] |
| | 167 | } |
| | 168 | }}} |
| | 169 | |
| | 170 | ==== 3.1周期 ==== |
| | 171 | {{{ |
| | 172 | 备注:周期 |
| | 173 | 请求URL:http:// |
| | 174 | HTTP请求方式:get |
| | 175 | 是否需要登录:否 |
| | 176 | 返回格式:JSON |
| | 177 | 缓存方式:无 |
| | 178 | 缓存时间:无 |
| | 179 | 请求参数: |
| | 180 | status:1备孕,2怀孕,3育儿 |
| | 181 | 返回参数: |
| | 182 | { |
| | 183 | weeks:[ |
| | 184 | { |
| | 185 | num:1, |
| | 186 | tips:"多吃含钙食物" |
| | 187 | }, |
| | 188 | { |
| | 189 | num:1, |
| | 190 | tips:"多吃含tie食物" |
| | 191 | } |
| | 192 | ] |
| | 193 | } |
| | 194 | }}} |
| | 195 | |
| | 196 | ==== 3.1食谱列表 ==== |
| | 197 | {{{ |
| | 198 | 备注:食谱列表 |
| | 199 | 请求URL:http:// |
| | 200 | HTTP请求方式:get |
| | 201 | 是否需要登录:否 |
| | 202 | 返回格式:JSON |
| | 203 | 缓存方式:无 |
| | 204 | 缓存时间:无 |
| | 205 | 请求参数: |
| | 206 | status:1备孕,2怀孕,3育儿 |
| | 207 | type:1每日知识,2食谱 |
| | 208 | weeks:第几周 |
| | 209 | 返回参数 |
| | 210 | { |
| | 211 | id: |
| | 212 | cookbook:[ |
| | 213 | [//第一天 |
| | 214 | { |
| | 215 | id: |
| | 216 | name: |
| | 217 | image: |
| | 218 | des: |
| | 219 | time:(早餐,午餐、晚餐) |
| | 220 | }, |
| | 221 | { |
| | 222 | id: |
| | 223 | name: |
| | 224 | image: |
| | 225 | des: |
| | 226 | time:(早餐,午餐、晚餐) |
| | 227 | }, { |
| | 228 | id: |
| | 229 | name: |
| | 230 | image: |
| | 231 | des: |
| | 232 | time:(早餐,午餐、晚餐) |
| | 233 | } |
| | 234 | |
| | 235 | ], |
| | 236 | [//第二天 |
| | 237 | { |
| | 238 | id: |
| | 239 | name: |
| | 240 | image: |
| | 241 | des: |
| | 242 | time:(早餐,午餐、晚餐) |
| | 243 | }, |
| | 244 | { |
| | 245 | id: |
| | 246 | name: |
| | 247 | image: |
| | 248 | des: |
| | 249 | time:(早餐,午餐、晚餐) |
| | 250 | }, { |
| | 251 | id: |
| | 252 | name: |
| | 253 | image: |
| | 254 | des: |
| | 255 | time:(早餐,午餐、晚餐) |
| | 256 | } |
| | 257 | ] |
| | 258 | ] |
| | 259 | } |
| | 260 | }}} |
| | 261 | |
| | 262 | |
| | 263 | ==== 3.2食谱详情 ==== |
| | 264 | {{{ |
| | 265 | 备注:食谱详情 |
| | 266 | 请求URL:http:// |
| | 267 | HTTP请求方式:get |
| | 268 | 是否需要登录:否 |
| | 269 | 返回格式:JSON |
| | 270 | 缓存方式:无 |
| | 271 | 缓存时间:无 |
| | 272 | 请求参数: |
| | 273 | id:食谱id |
| | 274 | 返回参数 |
| | 275 | { |
| | 276 | id: |
| | 277 | name: |
| | 278 | picDes:[ |
| | 279 | { |
| | 280 | id: |
| | 281 | image: |
| | 282 | des: |
| | 283 | } |
| | 284 | ] |
| | 285 | } |
| | 286 | }}} |