change bugs

This commit is contained in:
sylor_huang@126.com 2020-07-13 20:20:30 +08:00
parent 49be881914
commit 2e8095af58
4 changed files with 14 additions and 7 deletions

View File

@ -2,7 +2,6 @@ class SyncForgeController < ApplicationController
before_action :check_token
def create
ActiveRecord::Base.transaction do
params.permit!
sync_params = params[:sync_params]
@ -22,7 +21,6 @@ class SyncForgeController < ApplicationController
name: sync_params[:name]
}
project = Projects::CreateService.new(project_user, project_params).call
Rails.logger.info("=================new_project_id:#{project.id}========")
if project.present?
if sync_params[:project_score].present?
sync_params.permit!
@ -37,7 +35,7 @@ class SyncForgeController < ApplicationController
end
end
rescue Exception => e
Rails.logger.info("=================has_errors:==#{e.message}")
SyncLog.sync_project_log("=============sync_has_errors:==#{e.message}, project_id==:#{params[:sync_params][:id]}")
end
def sync_users
@ -61,12 +59,12 @@ class SyncForgeController < ApplicationController
new_user.gitea_uid = gitea_user['id']
if new_user.save!
UserExtension.create!(u[:user_extensions].merge(user_id: new_user.id)) if u[:user_extensions].present?
SyncLog.sync_log("=================sync_to_user_success====#{new_user.login}")
else
SyncLog.sync_log("=================sync_to_user_failed==1==#{new_user.login}")
SyncLog.sync_log("=================sync_to_user_failed,user_login==#{new_user.login}")
end
else
SyncLog.sync_log("=================sync_to_user_failed====#{new_user.login}")
SyncLog.sync_project_log("=============sync_to_user_failed,user_login====#{new_user.login}")
SyncLog.sync_log("=================sync_to_user_failed,user_login====#{new_user.login}")
end
end
end

View File

@ -23,7 +23,6 @@ class SyncRepositoryJob < ApplicationJob
SyncLog.sync_log("========check_clone:====cd #{path} && git clone #{image_url}===================")
if check_clone
new_gitlab_url = "http://root:_Trustie_10010@#{gitea_main}/#{user_login}/#{identifier}.git"
shell_remote_1 = system("cd #{path}/#{image_repo_name} && git remote set-url origin #{new_gitlab_url}")
shell5 = system("cd #{path}/#{image_repo_name} && git checkout #{g_default_branch} && git push --force --set-upstream origin #{g_default_branch}")

View File

@ -3,4 +3,9 @@ class SyncLog
@my_log ||= Logger.new("#{Rails.root}/log/sync.log")
@my_log.debug(message) unless message.nil?
end
def self.sync_project_log(message=nil)
@my_log ||= Logger.new("#{Rails.root}/log/sync_error_project.log")
@my_log.debug(message) unless message.nil?
end
end

View File

@ -0,0 +1,5 @@
class RemoveIssuesLockVersionColumn < ActiveRecord::Migration[5.2]
def change
remove_column :issues, :lock_version
end
end