SELECT
tid
FROM
record
WHERE
create_time >= CURRENT_TIMESTAMP - 3600000
GROUP BY tid
ORDER BY SUM(point) DESC
LIMIT 3
如果用APIJSON,可以这样请求:
{
"[]": {
"Record": {
"@column": "tid",
"create_time{}": ">=CURRENT_TIMESTAMP-3600000",
"@group": "tid",
"@order": "SUM(point)-"
},
"count": 3
}
}
然后服务器会返回:
{
"[]": [
{
"Record": {
"tid": 82001
}
},
{
"Record": {
"tid": 82002
}
},
{
"Record": {
"tid": 82003
}
}
],
"code": 200,
"msg": "success"
}
可以提取出tid:
{
"Record-tid[]": {
"Record": {
"@column": "tid",
"create_time{}": ">=CURRENT_TIMESTAMP-3600000",
"@group": "tid",
"@order": "SUM(point)-"
},
"count": 3
}
}
然后服务器会返回:
{
"Record-tid[]": [
82001,
82002,
82003
],
"code": 200,
"msg": "success"
}
一个可直接在线测试的demo:
http://39.108.143.172/
{
"Comment-userId[]": {
"Comment": {
"@column": "userId",
"date{}": ">=CURRENT_TIMESTAMP-3600000",
"@group": "userId",
"@order": "SUM(momentId)-"
},
"count": 3
}
}
用APIJSON,后端不用写接口和文档,前端/客户端 定制返回JSON的内容和结构^_^
https://github.com/TommyLemon...