diff --git a/app/api/mobile/apis/blockchains.rb b/app/api/mobile/apis/blockchains.rb index d2379348d..a4b8ea88c 100644 --- a/app/api/mobile/apis/blockchains.rb +++ b/app/api/mobile/apis/blockchains.rb @@ -50,6 +50,29 @@ module Mobile present result_hash end + desc "加入已经创建的项目" + params do + requires :username, type: String + requires :password, type: String + requires :ownername, type: String + requires :reponame, type: String + end + post 'join' do + authenticate! + owner = User.find_by_login(ownername) + if owner + project = Project.where(:user_id => owner.id, :name => reponame) + if project + blockchain = Blockchain.find_by_project_id(project.id) + {status:0, genesis_content:blockchain.genesis_content, network_id:blockchain.network_id, connect_ip:blockchain.connect_ip, port:blockchain.port, enode:blockchain.enode} + else + {status:-1, message: '该项目不存在' } + end + else + {status:-1, message: '该项目不存在或已被删除啦' } + end + end + end end end diff --git a/app/services/blockchains_service.rb b/app/services/blockchains_service.rb index a23a10150..f73e5fad7 100644 --- a/app/services/blockchains_service.rb +++ b/app/services/blockchains_service.rb @@ -41,4 +41,9 @@ class BlockchainsService return status, nil end + # 读取配置信息 + def get_repo_config(project, user, params) + + end + end diff --git a/app/services/projects_service.rb b/app/services/projects_service.rb index cb5bb604d..5b542b017 100644 --- a/app/services/projects_service.rb +++ b/app/services/projects_service.rb @@ -498,4 +498,10 @@ class ProjectsService return project_names end + + # 获取对应name和user_id的项目 + def get_project_by_name_user_id user + + end + end