forked from Trustie/forgeplus
更改:分页查询数据
This commit is contained in:
parent
f5e9c6d54d
commit
29a9f44d8b
|
|
@ -7,6 +7,9 @@ class Api::V1::Users::MemosController < Api::V1::BaseController
|
|||
@resident_expert.increment!(:visits)
|
||||
return render_error("用户未完成专家入驻") if @resident_expert.blank?
|
||||
@memos = @observe_user.memos.order("#{sort_by} #{sort_direction}")
|
||||
@total_viewed_count = @memos.sum(:viewed_count)
|
||||
@total_praises_count = @memos.sum(:praises_count)
|
||||
@total_replies_count =@memos.sum(:replies_count)
|
||||
@memos = kaminari_paginate(@memos)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ json.total_count @memos.total_count
|
|||
json.resident_expert do
|
||||
json.partial! 'api/v1/resident_experts/resident_expert', locals: { resident_expert: @resident_expert }
|
||||
end
|
||||
json.total_viewed_count @memos.sum(:viewed_count)
|
||||
json.total_praises_count @memos.sum(:praises_count)
|
||||
json.total_replies_count @memos.sum(:replies_count)
|
||||
json.total_viewed_count @total_viewed_count
|
||||
json.total_praises_count @total_praises_count
|
||||
json.total_replies_count @total_replies_count
|
||||
json.memos @memos do |memo|
|
||||
json.partial! 'api/v1/users/memos/memo', locals: { memo: memo, current_user: current_user }
|
||||
end
|
||||
Loading…
Reference in New Issue