From d1f84f19c86aa0f1c2787d169373b1efa962ed0f Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 17 Dec 2019 15:51:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E5=90=88=E4=BD=9C=E8=80=85?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BF=BB=E9=A1=B5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 6 +++++- app/views/shixuns/collaborators.json.jbuilder | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) 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