From fcedae86cb34f46d8db1c710b7b80b42b2322a57 Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 26 May 2025 17:05:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9Apersonal=5Fissues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/pm/weekly_issues_controller.rb | 20 +++++++++++++++++-- config/routes/api.rb | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/pm/weekly_issues_controller.rb b/app/controllers/api/pm/weekly_issues_controller.rb index dad170780..8f7b0b8b6 100644 --- a/app/controllers/api/pm/weekly_issues_controller.rb +++ b/app/controllers/api/pm/weekly_issues_controller.rb @@ -62,5 +62,21 @@ class Api::Pm::WeeklyIssuesController < Api::Pm::BaseController @this_week_all_issues = @this_week_all_issues.order('created_on desc') @this_week_all_issues = kaminari_paginate(@this_week_all_issues) end - -end \ No newline at end of file + def personal_issues + @enterprise_identifier = params[:enterprise_identifier] || '' + return render_error('请输入正确的用户ID.') if params[:user_id].blank? + @all_issues = Issue.joins(:issue_participants).where(issue_participants: {participant_id: params[:user_id], participant_type: ['authored', 'assigned']}) + @all_issues = @all_issues.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3]) + @this_week_all_issues = @all_issues.where("due_date >= ? and start_date <= ?", Date.today.beginning_of_week.to_s, Date.today.end_of_week.to_s).distinct + @this_week_all_issues = @this_week_all_issues.order('created_on desc') + @next_week_all_issues = @all_issues.where("due_date >= ? and start_date <=?", (Date.today.beginning_of_week+1.week).to_s, (Date.today.end_of_week+1.week).to_s).distinct + @next_week_all_issues = @next_week_all_issues.order('created_on desc') + this_week_page = params[:this_week_page] || 1 + this_week_limit = params[:this_week_limit] || 15 + @this_week_all_issues = @this_week_all_issues.page(this_week_page).per(this_week_limit) + next_week_page = params[:next_week_page] || 1 + next_week_limit = params[:next_week_limit] || 15 + @next_week_all_issues = @next_week_all_issues.page(next_week_page).per(next_week_limit) + end +end + diff --git a/config/routes/api.rb b/config/routes/api.rb index 25f3b0ad8..09cc2f065 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -6,6 +6,7 @@ defaults format: :json do get :personal get :group get :group_issues + get :personal_issues end end resources :dashboards,only: [:index] do