diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 84ceacd26..afffb9963 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -345,7 +345,11 @@ class ShixunsController < ApplicationController #合作者 def collaborators @user = current_user - @members = @shixun.shixun_members.includes(:user) + ## 分页参数 + page = params[:page] || 1 + limit = params[:limit] || 10 + @member_count = @shixun.shixun_members.count + @members = @shixun.shixun_members.includes(:user).page(page).per(limit) end def fork_list diff --git a/app/views/shixuns/collaborators.json.jbuilder b/app/views/shixuns/collaborators.json.jbuilder index e5f612dba..88412eeab 100644 --- a/app/views/shixuns/collaborators.json.jbuilder +++ b/app/views/shixuns/collaborators.json.jbuilder @@ -18,4 +18,5 @@ json.array! @members do |member| json.user_id member.user_id end json.follow follow?(member.user.id, @user.id) -end \ No newline at end of file +end +json.member_count @member_count \ No newline at end of file