add outputs
This commit is contained in:
parent
9d0d3854ae
commit
192ee15a59
|
@ -57,6 +57,7 @@ module Mobile
|
|||
requires :repo_url, type: String
|
||||
end
|
||||
post 'join' do
|
||||
Rails.logger.info("!!!!!!!!!!in the join service")
|
||||
authenticate!
|
||||
# 根据repo_git_url找到repository对应的项目
|
||||
rs = RepositoriesService.new
|
||||
|
@ -64,9 +65,10 @@ module Mobile
|
|||
if project
|
||||
blockchain = Blockchain.find_by_project_id(project.id)
|
||||
if blockchain
|
||||
Rails.logger.info("!!!!!!!this is the return values")
|
||||
Rails.logger.info("!!!!!!!!!find the project's blockchain info")
|
||||
{status:status, genesis_content:blockchain.genesis_content, network_id:blockchain.network_id, connect_ip:blockchain.connect_ip, port:blockchain.port, enode:blockchain.enode}
|
||||
else
|
||||
Rails.logger.info("!!!!!!!!!not find the project's blockchain info")
|
||||
{status:-1, message: '数据库有问题,blockchain信息不存在'}
|
||||
end
|
||||
else
|
||||
|
|
|
@ -55,16 +55,21 @@ class RepositoriesService
|
|||
|
||||
owner = User.find_by_login(owner_name)
|
||||
if owner
|
||||
Rails.logger.info("!!!!!!!!!!find the owner")
|
||||
projects = Project.find_all_by_user_id(owner.id)
|
||||
if projects.length <= 0
|
||||
return status, nil
|
||||
else
|
||||
Rails.logger.info("!!!!!!!!!!!!!find the owner's projects")
|
||||
projects.each do |project|
|
||||
gpid = project.gpid
|
||||
if gpid
|
||||
Rails.logger.info("!!!!!!!!!!This project has gpid")
|
||||
http_url_to_repo = Gitlab.client.project(gpid).try(:http_url_to_repo)
|
||||
if http_url_to_repo
|
||||
Rails.logger.info("!!!!!!!!!!!find the repo_url for this gpid")
|
||||
if repo_url == http_url_to_repo
|
||||
Rails.logger.info("!!!!!!!!!!!!repo_url equals")
|
||||
status = 0
|
||||
return status, project # 表示找到了
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue