Compare commits

...

13 Commits

Author SHA1 Message Date
呱呱呱 27d73f0c11 add admin user_action view filter 2025-06-18 10:09:46 +08:00
xxq250 a8f06eb022 Merge remote-tracking branch 'origin/standalone_develop' into standalone_develop 2025-06-17 11:17:28 +08:00
xxq250 6598eb6b76 fixed 登录更新时间5分钟写入一次 2025-06-17 11:17:21 +08:00
yystopf c97188aff8 Merge branch 'standalone_develop' of https://gitlink.org.cn/Trustie/forgeplus into standalone_develop 2025-06-09 14:09:26 +08:00
yystopf 7d466217c7 更改:查询本周和下周工作项需要增加时间参数 2025-06-09 14:09:14 +08:00
KingChan d86d7f5d3e Merge pull request 'update sonar' (#386) from KingChan/forgeplus:standalone_develop into standalone_develop 2025-06-07 16:42:46 +08:00
KingChan a3517e651f Merge pull request 'update sonar' (#384) from KingChan/forgeplus:standalone_develop into standalone_develop 2025-06-07 16:27:25 +08:00
KingChan 74706ab7a2 Merge pull request 'update sonar' (#382) from KingChan/forgeplus:standalone_develop into standalone_develop 2025-06-07 16:00:48 +08:00
xxq250 f96bcfa162 Merge remote-tracking branch 'origin/standalone_develop' into standalone_develop 2025-06-07 15:01:47 +08:00
xxq250 145463f967 fixed 流水线删除时删除运行记录错误 2025-06-07 15:01:40 +08:00
yystopf 6a6698bc74 Merge branch 'standalone_develop' of https://gitlink.org.cn/Trustie/forgeplus into standalone_develop 2025-06-07 14:51:02 +08:00
yystopf 41cbeae2f7 更改:查看我负责或组织工作项需要按层级展示 2025-06-07 14:48:48 +08:00
KingChan 9645f38e31 Merge pull request 'update sonar' (#380) from KingChan/forgeplus:standalone_develop into standalone_develop 2025-06-07 14:27:29 +08:00
6 changed files with 48 additions and 25 deletions

View File

@ -55,21 +55,39 @@ class Api::Pm::WeeklyIssuesController < Api::Pm::BaseController
def group_issues
@enterprise_identifier = params[:enterprise_identifier] || ''
@all_issues = Issue.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3])
root_id = params[:root_id] || -1
@weekly_begin_date = params[:weekly_begin_date] || Date.today.beginning_of_week.to_s
@weekly_end_date = params[:weekly_end_date] || Date.today.end_of_week.to_s
@all_issues = Issue.none
if root_id.to_i == -1
@all_issues = Issue.where(root_id: nil, enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3])
elsif root_id.to_i.positive?
@all_issues = Issue.where(root_id: root_id, enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3])
else
@all_issues = Issue.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3])
end
@all_issues = @all_issues.where(pm_project_id: params[:pm_project_ids].split(",")) if params[:pm_project_ids].present?
@all_issues = @all_issues.where(pm_issue_type: params[:pm_issue_type].to_i) if params[:pm_issue_type].present?
@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)
@this_week_all_issues = @all_issues.where("due_date >= ? and start_date <= ?", @weekly_begin_date, @weekly_end_date)
@this_week_all_issues = @this_week_all_issues.order('created_on desc')
@this_week_all_issues = kaminari_paginate(@this_week_all_issues)
end
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: ['assigned']})
@weekly_begin_date = params[:weekly_begin_date] || Date.today.beginning_of_week.to_s
@weekly_end_date = params[:weekly_end_date] || Date.today.end_of_week.to_s
root_id = params[:root_id] || -1
@all_issues = Issue.none
if root_id.to_i == -1
@all_issues = Issue.joins(:issue_participants).where(root_id: nil, issue_participants: {participant_id: params[:user_id], participant_type: ['assigned']})
else
@all_issues = Issue.joins(:issue_participants).where(root_id: root_id, issue_participants: {participant_id: params[:user_id], participant_type: ['assigned']})
end
@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 = @all_issues.where("due_date >= ? and start_date <= ?", @weekly_begin_date, @weekly_end_date).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 = @all_issues.where("due_date >= ? and start_date <=?", (@weekly_begin_date.to_date+1.week).to_s, (@weekly_end_date.to_date+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

View File

@ -148,7 +148,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
interactor = Gitea::DeleteFileInteractor.call(current_user.gitea_token, @owner.login, del_content_params(sha).merge(identifier: @project.identifier))
tip_exception(interactor.error) unless interactor.success?
end
Gitea::ActionRun.where(repo_id: @pipeline.project.gpid).destroy_all
Gitea::ActionRun.where(repo_id: @pipeline.project.gpid, workflow_id: "#{@pipeline.pipeline_name}.yml").destroy_all
@pipeline.destroy!
end
render_ok

View File

@ -1,19 +1,19 @@
# == Schema Information
#
# Table name: tokens
#
# id :integer not null, primary key
# user_id :integer default("0"), not null
# action :string(30) default(""), not null
# value :string(40) default(""), not null
# created_on :datetime not null
#
# Indexes
#
# index_tokens_on_user_id (user_id)
# tokens_value (value) UNIQUE
#
# == Schema Information
#
# Table name: tokens
#
# id :integer not null, primary key
# user_id :integer default("0"), not null
# action :string(30) default(""), not null
# value :string(40) default(""), not null
# created_on :datetime not null
#
# Indexes
#
# index_tokens_on_user_id (user_id)
# tokens_value (value) UNIQUE
#
#
@ -50,7 +50,10 @@ class Token < ActiveRecord::Base
token = Token.create(:user => user, :action => type)
Rails.logger.info "###### Token.get_token_from_user is nul and agine create token: #{token&.value}"
else
token.update_attribute(:created_on, Time.now)
unless Rails.cache.read("token::update::created_on::#{token.id}").present?
token.update_attribute(:created_on, Time.now)
Rails.cache.write("token::update::created_on::#{token.id}", true, expires_in: 5.minutes)
end
end
token
end

View File

@ -693,8 +693,9 @@ class User < Owner
def self.try_to_autologin(key)
user = Token.find_active_user('autologin', key)
if user
Rails.cache.fetch("user::update::last_login_on::#{user.id}",:expires_in => 5.minutes) do
unless Rails.cache.read("user::update::last_login_on::#{user.id}").present?
user.update(last_login_on: Time.now)
Rails.cache.write("user::update::last_login_on::#{user.id}", true, expires_in: 5.minutes)
end
end
user

View File

@ -35,6 +35,7 @@ class UserAction < ApplicationRecord
when "DestroyProject" then "删除项目"
when "Login" then "登录"
when "Logout" then "退出登录"
when "DestroyOrganization" then "删除组织"
else self.action_type
end
end

View File

@ -5,7 +5,7 @@
<div class="box search-form-container user-list-form">
<%= form_tag(admins_user_actions_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
操作类型:
<% action_type_options = [['自定义',''],['用户注销','DestroyUser'], ['删除项目', 'DestroyProject']] %>
<% action_type_options = [['自定义',''],['用户注销','DestroyUser'], ['删除项目', 'DestroyProject'], ['删除组织', 'DestroyOrganization']] %>
<%= select_tag(:action_type_select, options_for_select(action_type_options), class: 'form-control') %>
<%= text_field_tag(:action_type, params[:action_type], class: 'form-control col-sm-2 ml-3',style: 'display:;', placeholder: '自定义操作类型检索') %>
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '操作人用户名/邮箱/手机号检索') %>