Browse Source

修复

pull/347/head
yystopf 2 years ago
parent
commit
626fa8a7b3
1 changed files with 10 additions and 9 deletions
  1. +10
    -9
      app/controllers/projects_controller.rb

+ 10
- 9
app/controllers/projects_controller.rb View File

@@ -324,17 +324,18 @@ class ProjectsController < ApplicationController
# 如果该项目有所属的项目分类以及为私有项目,需要更新对应数量 # 如果该项目有所属的项目分类以及为私有项目,需要更新对应数量
@project.project_category.decrement!(:private_projects_count, 1) if @project.project_category.present? && !@project.is_public @project.project_category.decrement!(:private_projects_count, 1) if @project.project_category.present? && !@project.is_public
tip_exception("导入失败,请重试!") tip_exception("导入失败,请重试!")
end
# 为了缓存活跃项目的基本信息,后续删除
Cache::V2::ProjectCommonService.new(@project.id).read
# 项目名称,标识,所有者变化时重置缓存
project_common = $redis_cache.hgetall("v2-project-common:#{@project.id}")
if project_common.present?
if project_common["name"] != @project.name || project_common["identifier"] != @project.identifier || project_common["owner_id"] != @project.user_id
Cache::V2::ProjectCommonService.new(@project.id).reset
else
# 为了缓存活跃项目的基本信息,后续删除
Cache::V2::ProjectCommonService.new(@project.id).read
# 项目名称,标识,所有者变化时重置缓存
project_common = $redis_cache.hgetall("v2-project-common:#{@project.id}")
if project_common.present?
if project_common["name"] != @project.name || project_common["identifier"] != @project.identifier || project_common["owner_id"] != @project.user_id
Cache::V2::ProjectCommonService.new(@project.id).reset
end
end end
json_response(@project, current_user)
end end
json_response(@project, current_user)
end end


def recommend def recommend


Loading…
Cancel
Save