add loggers

This commit is contained in:
nigel007 2019-07-25 15:53:16 +08:00
parent 0a55604178
commit 5d11315cfc
1 changed files with 17 additions and 3 deletions

View File

@ -15,9 +15,11 @@ module Mobile
requires :connect_ip, type: String
requires :port, type: Integer
requires :enode, type: String
requires :node_id, type: String
# user_id, created_at, updated_at需要在程序中创建
end
post 'create' do
Rails.logger.info(params) # 输出所有参数
authenticate!
ps = ProjectsService.new # 创建项目
user = current_user
@ -25,6 +27,7 @@ module Mobile
if status == 0
# 表示项目创建成功
# 创建版本库
Rails.logger.info("项目创建成功...")
rs = RepositoriesService.new
params_repository = ActiveSupport::HashWithIndifferentAccess.new(identifier: project.name)
status, repository = rs.createNewRepoBlockchain project, params_repository
@ -32,13 +35,24 @@ module Mobile
gitUrl = gitlab_address.to_s+"/"+project.owner.to_s+"/"+ repository.identifier + "."+"git"
gitUrl = Base64.encode64(gitUrl)
if status == 0
Rails.logger.info("版本库创建成功...")
bs = BlockchainsService.new
status, blockchain = bs.create_item project, user, params # 创建blockchain item
present :status, status # status -1:表示创建失败; 1:表示创建成功
present :gitUrl, gitUrl
if status == 0
Rails.logger.info("插入blockchains表成功...")
# 表示插入blockchains表成功了
bpcs = BlockchainProjectClientsService.new
status, bpc = bpcs.create_item project, user, params
if status == 0
Rails.logger.info("插入blockchain_project_clients表成功...")
# 表示插入blockchain_project_clients表也成功了
present :gitUrl, gitUrl
end
end
present :status, status # status -1:表示创建失败; 0:表示创建成功
end
end
present :status, status # status -1:表示创建失败; 1:表示创建成功
present :status, status # status -1:表示创建失败; 0:表示创建成功
end
desc "获取用户已经创建的东西"