Open ben7th opened 9 years ago
针对指定的用户,统计只针对chat类型的聊天信息, 返回每个时间小段的该用户发言次数统计
result = ChatLine.query_by_username(username, room_id, time_str_type, start_time_str, end_time_str)
# result 结构举例
# username: 用户名
# room_id
# time_str_type: 'month', 还可以是 ('week' , 'day', 'hour', 'minute')
# start_time_str = '2012-09'
# end_time_str = '2012-11'
{
"2012-09" => 20,
"2012-10" => 30,
"2012-11" => 15,
}
http api
url
/api/chat_lines/query_user_stat
method
get
params
username
room_id
# 指定按什么时间段统计,可以是 month | week | day | hour | minute
by
# 起始时间,同模型方法接收的参数格式一致
start
# 结束时间,同模型方法接收的参数格式一致
end
response
{
:by => "month",
:username => '张三',
:data => {
"2012-09" => 20,
"2012-10" => 23,
"2012-11" => 43
}
}
需求描述: