留言分页

This commit is contained in:
lizanle 2015-05-23 17:13:38 +08:00
parent 8af59f6f39
commit 6353a2e2c8
2 changed files with 2 additions and 1 deletions

View File

@ -98,6 +98,7 @@ module Mobile
params do
requires :token, type: String
requires :user_id, type: Integer,desc: '被留言的用户id'
requires :page,type:Integer,desc:'请求数据的页码'
end
get ':user_id/messages' do
us = UsersService.new

View File

@ -158,7 +158,7 @@ class UsersService
# 获取某个用户的所有留言信息
def get_all_messages params
user = User.find(params[:user_id])
jours = user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
jours = user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC').page(params[:page] || 1).per(10)
jours.update_all(:is_readed => true, :status => false)
jours.each do |journal|
fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)