This commit is contained in:
sylor_huang@126.com 2020-07-15 23:23:57 +08:00
parent dea2009270
commit e450188d47
2 changed files with 17 additions and 14 deletions

View File

@ -109,9 +109,9 @@ class SyncForgeController < ApplicationController
def check_sync_project(project,sync_params) def check_sync_project(project,sync_params)
begin begin
gitea_main = "https://www.trustie.net/" gitea_main = "https://www.trustie.net/"
# if request.subdomain === 'testforgeplus' if request.subdomain === 'testforgeplus'
# gitea_main = "https://ucloudtest.trustie.net/" gitea_main = "https://ucloudtest.trustie.net/"
# end end
SyncLog.sync_log("----begin_to_check_sync_project----project_id:#{project.id}---------------") SyncLog.sync_log("----begin_to_check_sync_project----project_id:#{project.id}---------------")
change_project_score(project, sync_params[:project_score], sync_params[:repository]) if sync_params[:repository].present? #更新project_score change_project_score(project, sync_params[:project_score], sync_params[:repository]) if sync_params[:repository].present? #更新project_score
@ -137,9 +137,9 @@ class SyncForgeController < ApplicationController
} }
gitea_main = "https://www.trustie.net/" gitea_main = "https://www.trustie.net/"
# if request.subdomain === 'testforgeplus' if request.subdomain === 'testforgeplus'
# gitea_main = "https://ucloudtest.trustie.net/" gitea_main = "https://ucloudtest.trustie.net/"
# end end
SyncProjectsJob.perform_later(sync_projects_params, gitea_main) SyncProjectsJob.perform_later(sync_projects_params, gitea_main)
SyncLog.sync_log("***8. end_to_sync_new_project---------------") SyncLog.sync_log("***8. end_to_sync_new_project---------------")
end end

View File

@ -47,10 +47,10 @@ class SyncProjectsJob < ApplicationJob
end end
def create_target(target_jsons, target_type) def create_target(target_jsons, target_type)
begin SyncLog.sync_log("***【#{target_type}】. begin_to_create_target---------------")
SyncLog.sync_log("***【#{target_type}】. begin_to_create_target---------------") return SyncLog.sync_log("*** no target_jsons") if target_jsons.blank?
return SyncLog.sync_log("*** no target_jsons") if target_jsons.blank? target_jsons.each_with_index do |re,index|
target_jsons.each_with_index do |re,index| begin
SyncLog.sync_log("***user_login:#{re[:user_login]}----target_type:#{target_type}-----#{index+1}") SyncLog.sync_log("***user_login:#{re[:user_login]}----target_type:#{target_type}-----#{index+1}")
if re[:target_params].present? if re[:target_params].present?
SyncLog.sync_log("***user_login:#{re[:user_login]}----target_type:#{target_type}") SyncLog.sync_log("***user_login:#{re[:user_login]}----target_type:#{target_type}")
@ -85,7 +85,7 @@ class SyncProjectsJob < ApplicationJob
new_target = target_type.constantize.new(re[:target_params].merge(user_id: u_id)) new_target = target_type.constantize.new(re[:target_params].merge(user_id: u_id))
end end
end end
if !is_exists && new_target.save! if !is_exists && new_target.save!
SyncLog.sync_log("***【#{target_type}】. create_success---------------") SyncLog.sync_log("***【#{target_type}】. create_success---------------")
if re[:journals].present? if re[:journals].present?
@ -107,11 +107,14 @@ class SyncProjectsJob < ApplicationJob
SyncLog.sync_log("***【#{target_type}】. create_failed---or has_exists---------------") SyncLog.sync_log("***【#{target_type}】. create_failed---or has_exists---------------")
end end
end end
SyncLog.sync_log("***111222. end_to_create_target---------------")
rescue => e
SyncLog.sync_log("=========***【#{target_type}】creat_had_erros:#{e}===================")
next
end end
SyncLog.sync_log("***111222. end_to_create_target---------------")
rescue => e
SyncLog.sync_log("=========***【#{target_type}】creat_had_erros:#{e}===================")
end end
end end