Skip to content

Commit be22bd5

Browse files
authored
Update README.md
1 parent 716e5f8 commit be22bd5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ APIJSON是一种JSON传输结构协议。<br />
277277
Moment和对应的User | 分两次请求<br />Moment: base_url/get/moment?userId=1<br />User: base_url/get/user?id=1 | [base_url/get/{"Moment":{"userId":1}, "User":{"id":1}}](http://139.196.140.118:8080/get/{"Moment":{"userId":38710},"User":{"id":38710}})
278278
User列表 | base_url/get/user/list?page=0&count=3&sex=0 | [base_url/get/{"[]":{"page":0, "count":3, "User":{"sex":0}}}](http://139.196.140.118:8080/get/{"[]":{"page":0,"count":3,"User":{"sex":0}}})
279279
Moment列表,每个Moment包括发布者User和前3条Comment | Moment里必须有User的Object和Comment的Array<br /> base_url/get/moment/list?page=0&count=3&commentCount=3 | [base_url/get/{"[]":{"page":0, "count":3, "Moment":{}, "User":{"id@":"/Moment/userId"}, "[]":{"count":3, "Comment":{"momentId@":"[]/Moment/id"}}}}](http://139.196.140.118:8080/get/{"[]":{"page":0,"count":3,"Moment":{},"User":{"id@":"%252FMoment%252FuserId"},"[]":{"count":3,"Comment":{"momentId@":"[]%252FMoment%252Fid"}}}})
280-
User发布的Moment列表,每个Moment包括发布者User和前3条Comment | Moment里必须有User的Object和Comment的Array<br /> base_url/get/moment/list?page=0&count=3&commentCount=3&userId=1 | 有以下几种方法:<br />①把以上请求里的"Moment":{}, "User":{"id@":"/Moment/userId"}改为["Moment":{"userId":1}, "User":{"id":1}](http://139.196.140.118:8080/get/{"[]":{"page":0,"count":3,"Moment":{"userId":38710},"User":{"id":38710},"[]":{"count":3,"Comment":{"momentId@":"[]%252FMoment%252Fid"}}}}) <br /><br />②或这样省去4条重复User<br />[base_url/get/{"User":{"id":1}, "[]":{"page":0, "count":3, "Moment":{"userId":1}, "[]":{"count":3, "Comment":{"momentId@":"[]/Moment/id"}}}}](http://139.196.140.118:8080/get/{"User":{"id":38710},"[]":{"page":0,"count":3,"Moment":{"userId":38710},"[]":{"count":3,"Comment":{"momentId@":"[]%252FMoment%252Fid"}}}})<br /><br />③如果User之前已经获取到了,还可以这样省去所有重复User<br />[base_url/get/{"[]":{"page":0, "count":3, "Moment":{"userId":1}, "[]":{"count":3, "Comment":{"momentId@":"[]/Moment/id"}}}}](http://139.196.140.118:8080/get/{"[]":{"page":0,"count":3,"Moment":{"userId":38710},"[]":{"count":3,"Comment":{"momentId@":"[]%252FMoment%252Fid"}}}})
280+
User发布的Moment列表,每个Moment包括发布者User和前3条Comment | Moment里必须有User的Object和Comment的Array<br /> base_url/get/moment/list?page=0&count=3&commentCount=3&userId=1 | 有以下几种方法:<br /> ① 把以上请求里的"Moment":{}, "User":{"id@":"/Moment/userId"}改为["Moment":{"userId":1}, "User":{"id":1}](http://139.196.140.118:8080/get/{"[]":{"page":0,"count":3,"Moment":{"userId":38710},"User":{"id":38710},"[]":{"count":3,"Comment":{"momentId@":"[]%252FMoment%252Fid"}}}}) <br /><br /> ② 或这样省去4条重复User<br />[base_url/get/{"User":{"id":1}, "[]":{"page":0, "count":3, "Moment":{"userId":1}, "[]":{"count":3, "Comment":{"momentId@":"[]/Moment/id"}}}}](http://139.196.140.118:8080/get/{"User":{"id":38710},"[]":{"page":0,"count":3,"Moment":{"userId":38710},"[]":{"count":3,"Comment":{"momentId@":"[]%252FMoment%252Fid"}}}})<br /><br /> ③ 如果User之前已经获取到了,还可以这样省去所有重复User<br />[base_url/get/{"[]":{"page":0, "count":3, "Moment":{"userId":1}, "[]":{"count":3, "Comment":{"momentId@":"[]/Moment/id"}}}}](http://139.196.140.118:8080/get/{"[]":{"page":0,"count":3,"Moment":{"userId":38710},"[]":{"count":3,"Comment":{"momentId@":"[]%252FMoment%252Fid"}}}})
281281

282282
### <h3 id="2.6">2.6 服务端对应不同请求的返回结果<h3/>
283283
服务端对应不同请求的返回结果 | 传统方式 | APIJSON
@@ -286,7 +286,7 @@ APIJSON是一种JSON传输结构协议。<br />
286286
Moment和对应的User | 分别返回两次请求的结果<br />Moment: {"status":200, "message":"success", "data":{"id":1, "name":"xxx"...}}<br />User: {"status":200, "message":"success", "data":{"id":1, "name":"xxx"...}} | {"status":200, "message":"success", "Moment":{"id":1, "content":"xxx"...}, "User":{"id":1, "name":"xxx"...}}
287287
User列表 | {"status":200, "message":"success", "data":[{"id":1, "name":"xxx"...}, {"id":2...}...]} | {"status":200, "message":"success", "[]":[{"User":{"id":1, "name":"xxx"...}}, {"User":{"id":2...}}...]}
288288
Moment列表,每个Moment包括发布者User和前3条Comment | {"status":200, "message":"success", "data":[{"id":1, "content":"xxx"..., "User":{...}, "Comment":[...]}, {"id":2...}...]} | {"status":200, "message":"success", "[]":[{"Moment":{"id":1, "content":"xxx", ...}, "User":{...}, "[]":[{"Comment":{...}}, ...]}, ...]}
289-
User发布的Moment列表,每个Moment包括发布者User和前3条Comment | {"status":200, "message":"success", "data":[{"id":1, "content":"xxx"..., "User":{...}, "Comment":[...]}, {"id":2...} ...]} | 以上不同请求方法的结果:<br />{"status":200, "message":"success", "[]":[{"User":{"id":1, "name":"xxx", ...}, "Moment":{...}, "[]":[{"Comment":{...}}, ...]}, ...]}<br /><br />{"status":200, "message":"success", "User":{...}, "[]":[{"Moment":{"id":1, "content":"xxx", ...}, "[]":[{"Comment":{...}, ...}, ...]}, ...]}<br /><br />{"status":200, "message":"success", "[]":[{"Moment":{"id":1, "content":"xxx", ...}, "[]":[{"Comment":{}}, ...]}, ...]}
289+
User发布的Moment列表,每个Moment包括发布者User和前3条Comment | {"status":200, "message":"success", "data":[{"id":1, "content":"xxx"..., "User":{...}, "Comment":[...]}, {"id":2...} ...]} | 以上不同请求方法的结果:<br />{"status":200, "message":"success", "[]":[{"User":{"id":1, "name":"xxx", ...}, "Moment":{...}, "[]":[{"Comment":{...}}, ...]}, ...]}<br /><br />{"status":200, "message":"success", "User":{...}, "[]":[{"Moment":{"id":1, "content":"xxx", ...}, "[]":[{"Comment":{...}, ...}, ...]}, ...]}<br /><br />{"status":200, "message":"success", "[]":[{"Moment":{"id":1, "content":"xxx", ...}, "[]":[{"Comment":{}}, ...]}, ...]}
290290

291291

292292
1.base_url指基地址,一般是顶级域名,其它分支url都是在base_url后扩展。如base_url:http://www.google.com/ ,对应的GET分支url:http://www.google.com/get/ ,下同。<br >
@@ -323,12 +323,12 @@ DELETE:删除数据,非明文 | base_url/delete/ | {TableName:{"id":id}, "ta
323323
 键值对格式 | 功能 与 作用 | 使用示例
324324
------------ | ------------ | ------------
325325
"key[]":{},后面是JSONObject | 查询数组 | [{"User[]":{"User":{"sex":1}}}](http://139.196.140.118:8080/get/{"User[]":{"count":3,"User":{"sex":1}}}),查询性别为女的一个User数组
326-
"key{}":[],后面是JSONArray,作为key可取的值的选项 | 匹配选项范围 | [{"[]":{"User":{"id{}":[38710,82001,70793]}}}](http://139.196.140.118:8080/get/{"[]":{"count":3,"User":{"id{}":[38710,82001,70793]}}}),查询id符合38710,82001,70793中任意一个的一个User数组
327-
"key{}":"条件0,条件1...",条件为任意SQL比较表达式字符串,非Number类型必须用''包含条件的值,如'a' | 匹配条件范围 | [{"[]":{"User":{"id{}":"<=80000,\>90000"}}}](http://139.196.140.118:8080/get/{"[]":{"count":3,"User":{"id{}":"<=80000,\>90000"}}}),查询id符合id\<=80000 \| id>90000的一个User数组
328-
"key<\>":Object => "key<\>":[Object],key对应值的类型必须为JSONArray,Object类型不能为JSON | 包含选项范围 | [{"[]":{"User":{"friendIdList<\>":38710}}}](http://139.196.140.118:8080/get/{"[]":{"count":3,"User":{"friendIdList<\>":38710}}}),查询friendIdList包含38710的一个User数组
326+
"key{}":[],后面是JSONArray,作为key可取的值的选项 | 匹配选项范围 | [{"User[]":{"User":{"id{}":[38710,82001,70793]}}}](http://139.196.140.118:8080/get/{"User[]":{"count":3,"User":{"id{}":[38710,82001,70793]}}}),查询id符合38710,82001,70793中任意一个的一个User数组
327+
"key{}":"条件0,条件1...",条件为任意SQL比较表达式字符串,非Number类型必须用''包含条件的值,如'a' | 匹配条件范围 | [{"User[]":{"User":{"id{}":"<=80000,\>90000"}}}](http://139.196.140.118:8080/get/{"User[]":{"count":3,"User":{"id{}":"<=80000,\>90000"}}}),查询id符合id\<=80000 \| id>90000的一个User数组
328+
"key<\>":Object => "key<\>":[Object],key对应值的类型必须为JSONArray,Object类型不能为JSON | 包含选项范围 | [{"User[]":{"User":{"friendIdList<\>":38710}}}](http://139.196.140.118:8080/get/{"User[]":{"count":3,"User":{"friendIdList<\>":38710}}}),查询friendIdList包含38710的一个User数组
329329
"key()":"函数表达式", 函数表达式为 function(Type0:value0,Type1:value1...) | 远程调用函数 |  ["isPraised()":"isContain(Collection:praiseUserIdList,userId)"](http://139.196.140.118:8080/get/{"Moment":{"id":301,"isPraised()":"isContain(Collection:praiseUserIdList,userId)"}}),请求完成后会调用 boolean isContain(Collection collection, Object object) 函数,然后变为 "isPraised":true 这种(假设点赞用户id列表包含了userId,即这个User点了赞)。函数参数类型为Object或泛型时可省略类型,即 Object:value 改写为 value
330330
"key@":"依赖路径",依赖路径为用/分隔的字符串 | 依赖引用 | ["userId@":"/User/id"](http://139.196.140.118:8080/get/{"User":{"id":38710},"Moment":{"userId@":"%252FUser%252Fid"}}),userId依赖引用同级User内的id值,假设id=1,则请求完成后会变成 "userId":1
331-
"key$":"SQL搜索表达式" => "key$":["SQL搜索表达式"],任意SQL搜索表达式字符串,如 %key%, %k%e%y% 等 | 模糊搜索 | [{"[]":{"User":{"name$":"%m%"}}}](http://139.196.140.118:8080/get/{"[]":{"count":3,"User":{"name$":"%2525m%2525"}}}),查询name包含"m"的一个User数组
331+
"key$":"SQL搜索表达式" => "key$":["SQL搜索表达式"],任意SQL搜索表达式字符串,如 %key%, %k%e%y% 等 | 模糊搜索 | [{"User[]":{"User":{"name$":"%m%"}}}](http://139.196.140.118:8080/get/{"User[]":{"count":3,"User":{"name$":"%2525m%2525"}}}),查询name包含"m"的一个User数组
332332
"name:alias",name映射为alias,用alias替代name。可用于 column,Table,SQL函数 等。只用于GET类方法、HEAD类方法的请求 | 新建别名 | ["@column":"toId:parentId"](http://139.196.140.118:8080/get/{"Comment":{"@column":"id,toId:parentId","id":51}}),将查询的字段toId变为parentId返回
333333
"key+":key指定类型的Object,且类型为Number,String,JSONArray中的一种。如 1,"apijson",["url0","url1"] 等。只用于PUT请求 | 增加 或 扩展 | "praiseUserIdList+":[1],添加一个点赞用户id,即该用户点了赞
334334
"key-":key指定类型的Object,同"key+" | 减少 或 去除 | "balance-":100.00,余额减少100.00,即花费了100元

0 commit comments

Comments
 (0)