change bugs

This commit is contained in:
sylor_huang@126.com 2020-07-14 22:44:58 +08:00
parent 2e7d0abcbf
commit ae037203e8
1 changed files with 38 additions and 30 deletions

View File

@ -10,7 +10,6 @@ class SyncProjectsJob < ApplicationJob
begin
url = "#{gitea_main}/sync_forges" #trustie上的相关路由
uri = URI.parse(url)
http = Net::HTTP.new(uri.hostname, uri.port)
http.use_ssl = true
@ -23,6 +22,7 @@ class SyncProjectsJob < ApplicationJob
SyncLog.sync_project_log("==========target_jsons: #{target_jsons}============")
update_new_project(target_jsons[:targets_params][0], sync_params[:new_project_id])
else
SyncLog.sync_project_log("========== #{sync_params[:type]}============")
create_target(target_jsons[:targets_params], sync_params[:type].to_s)
end
else
@ -47,6 +47,7 @@ class SyncProjectsJob < ApplicationJob
end
def create_target(target_jsons, target_type)
begin
SyncLog.sync_project_log("***【#{target_type}】. begin_to_create_target---------------")
return SyncLog.sync_log("*** no target_jsons") if target_jsons.blank?
target_jsons.each_with_index do |re,index|
@ -66,6 +67,7 @@ class SyncProjectsJob < ApplicationJob
new_target.assigned_to_id = assing_u_id
end
if new_target.save!
SyncLog.sync_project_log("***【#{target_type}】. create_success---------------")
if re[:journals].present?
create_journals(re[:journals], "Journal", new_target.id)
end
@ -79,10 +81,16 @@ class SyncProjectsJob < ApplicationJob
MemberRole.create!(m.merge(member_id: new_target.id)) if m.present?
end
end
else
SyncLog.sync_project_log("***【#{target_type}】. create_failed---------------")
end
end
end
SyncLog.sync_project_log("***111222. end_to_create_target---------------")
rescue => e
SyncLog.sync_project_log("=========***【#{target_type}】creat_had_erros:#{e}===================")
end
end
def create_journals(target_jsons, target_type,issue_id)