Update README.md
This commit is contained in:
parent
06dc454b4c
commit
c4eb5c8de4
10
README.md
10
README.md
@ -206,11 +206,11 @@ APIJSON是一种JSON传输结构协议。<br />
|
||||
|
||||
客户端对应不同需求的请求 | 传统方式 | APIJSON
|
||||
-------- | ------------ | ------------
|
||||
User | http://localhost:8080/get/user?id=1 | [http://localhost:8080/get/{"User":{"id":1}}](http://localhost:8080/get/{"User":{"id":38710}})
|
||||
User和对应的Work | 分两次请求<br />User: http://localhost:8080/get/user?id=1<br />Work: http://localhost:8080/get/work?userId=1 | [http://localhost:8080/get/{"User":{"id":1}, "Work":{"userId@":"User/id"}}](http://localhost:8080/get/{"User":{"id":38710}, "Work":{"userId@":"User/id"})
|
||||
User列表 | http://localhost:8080/get/user/list?page=1&count=5&sex=0 | [http://localhost:8080/get/{"[]":{"page":1, "count":5, "User":{"sex":0}}}](http://localhost:8080/get/{"[]":{"page":1,"count":5,"User":{"sex":0}}})
|
||||
type为1的Work列表,每个Work包括发布者User和前3条Comment | Work里必须有User的Object和Comment的Array<br /> http://localhost:8080/get/work/list?page=1&count=5&type=1&commentCount=3 | [http://localhost:8080/get/{"[]":{"page":1, "count":5, "Work":{"type":1}, "User":{"workId@":"/Work/id"}, "[]":{"count":3, "Comment":{"workId@":"[]/Work/id"}}}}](http://localhost:8080/get/{"[]":{"page":1,"count":5,"Work":{"type":1},"User":{"workId@":"/Work/id"},"[]":{"count":3,"Comment":{"workId@":"[]/Work/id"}}}})
|
||||
1个User发布的Work列表,每个Work包括发布者User和前3条Comment | 把以上请求里的type=1改为userId=1 | 有以下几种方法:<br />①把以上请求里的"Work":{"type":1}, "User":{"workId@":"/Work/id"}改为"User":{"id":1}, "Work":{"userId@":"/User/id"}<br /><br />②或这样省去4条重复User<br />[http://localhost:8080/get/{"User":{"id":1}, "[]":{"page":1, "count":5, "Work":{"userId@":"User/id"}, "[]":{"count":3, "Comment":{"workId@":"[]/Work/id"}}}}](http://localhost:8080/get/{"User":{"id":1},"[]":{"page":1,"count":5,"Work":{"userId@":"User/id"},"[]":{"count":3,"Comment":{"workId@":"[]/Work/id"}}}})<br /><br />③如果User之前已经获取到了,还可以这样省去所有重复User<br />[http://localhost:8080/get/{"[]":{"page":1, "count":5, "Work":{"userId":1}, "[]":{"count":3, "Comment":{"workId@":"[]/Work/id"}}}}](http://localhost:8080/get/{"[]":{"page":1,"count":5,"Work":{"userId":1},"[]":{"count":3,"Comment":{"workId@":"[]/Work/id"}}}})
|
||||
User | http://localhost:8080/get/user?id=1 | [http://localhost:8080/get/{"User":{"id":1}}](http://139.196.140.118:8080/get/{"User":{"id":38710}})
|
||||
User和对应的Work | 分两次请求<br />User: http://localhost:8080/get/user?id=1<br />Work: http://localhost:8080/get/work?userId=1 | [http://localhost:8080/get/{"User":{"id":1}, "Work":{"userId@":"User/id"}}](http://139.196.140.118:8080/get/{"User":{"id":38710}, "Work":{"userId@":"User/id"})
|
||||
User列表 | http://localhost:8080/get/user/list?page=1&count=5&sex=0 | [http://localhost:8080/get/{"[]":{"page":1, "count":5, "User":{"sex":0}}}](http://139.196.140.118:8080/get/{"[]":{"page":1,"count":5,"User":{"sex":0}}})
|
||||
type为1的Work列表,每个Work包括发布者User和前3条Comment | Work里必须有User的Object和Comment的Array<br /> http://localhost:8080/get/work/list?page=1&count=5&type=1&commentCount=3 | [http://localhost:8080/get/{"[]":{"page":1, "count":5, "Work":{"type":1}, "User":{"workId@":"/Work/id"}, "[]":{"count":3, "Comment":{"workId@":"[]/Work/id"}}}}](http://139.196.140.118:8080/get/{"[]":{"page":1,"count":5,"Work":{"type":1},"User":{"workId@":"/Work/id"},"[]":{"count":3,"Comment":{"workId@":"[]/Work/id"}}}})
|
||||
1个User发布的Work列表,每个Work包括发布者User和前3条Comment | 把以上请求里的type=1改为userId=1 | 有以下几种方法:<br />①把以上请求里的"Work":{"type":1}, "User":{"workId@":"/Work/id"}改为"User":{"id":1}, "Work":{"userId@":"/User/id"}<br /><br />②或这样省去4条重复User<br />[http://localhost:8080/get/{"User":{"id":1}, "[]":{"page":1, "count":5, "Work":{"userId@":"User/id"}, "[]":{"count":3, "Comment":{"workId@":"[]/Work/id"}}}}](http://139.196.140.118:8080/get/{"User":{"id":1},"[]":{"page":1,"count":5,"Work":{"userId@":"User/id"},"[]":{"count":3,"Comment":{"workId@":"[]/Work/id"}}}})<br /><br />③如果User之前已经获取到了,还可以这样省去所有重复User<br />[http://localhost:8080/get/{"[]":{"page":1, "count":5, "Work":{"userId":1}, "[]":{"count":3, "Comment":{"workId@":"[]/Work/id"}}}}](http://139.196.140.118:8080/get/{"[]":{"page":1,"count":5,"Work":{"userId":1},"[]":{"count":3,"Comment":{"workId@":"[]/Work/id"}}}})
|
||||
|
||||
服务端对应不同请求的返回结果 | 传统方式 | APIJSON
|
||||
-------- | ------------ | ------------
|
||||
|
Loading…
Reference in New Issue
Block a user