change the api of getPushInfo

This commit is contained in:
nigel007 2019-05-26 15:50:50 +08:00
parent f59d3f5114
commit 5bbec0b311
1 changed files with 9 additions and 4 deletions
app/api/mobile/apis

View File

@ -77,8 +77,7 @@ module Mobile
params do
requires :username, type: String
requires :password, type: String
requires :newHash, type: String
requires :oldHash, type: String
requires :shaList, type: Array
requires :branch, type: String
requires :ownername, type: String
requires :reponame, type: String
@ -90,8 +89,14 @@ module Mobile
project = Project.find_by_user_id_name(owner.id, params[:reponame])
if project
g = Gitlab.client # 用于通过gitlab api进行查询
diff_result = g.commit_diff(project.gpid, params[:oldHash])
{status:0, diff_result:diff_result}
result = []
for i in 0..params[:shaList].length
sha = params[:shaList][i]
Rails.logger.info sha
commit = g.commit(project.gpid, sha)
result << commit
end
{status:0, result:result}
else
Rails.logger.info "project not found"
end