Browse Source

Merge branch 'develop' into standalone_develop

pull/313/head
yystopf 3 years ago
parent
commit
bc0222ac21
2 changed files with 14 additions and 9 deletions
  1. +2
    -1
      app/services/api/v1/projects/contents/batch_create_service.rb
  2. +12
    -8
      app/views/api/v1/projects/contents/batch.json.jbuilder

+ 2
- 1
app/services/api/v1/projects/contents/batch_create_service.rb View File

@@ -13,7 +13,6 @@ class Api::V1::Projects::Contents::BatchCreateService < ApplicationService


def initialize(project, params, token=nil)
puts params
@project = project
@owner = project&.owner.login
@repo = project&.identifier
@@ -63,6 +62,7 @@ class Api::V1::Projects::Contents::BatchCreateService < ApplicationService
committer: Time.at(committer_timeunix.to_i)
},
message: message,
branch: branch,
new_branch: new_branch,
signoff: false
}
@@ -77,6 +77,7 @@ class Api::V1::Projects::Contents::BatchCreateService < ApplicationService
end

def excute_data_to_gitea
puts request_body.to_json
@gitea_data = $gitea_client.post_repos_contents_batch_by_owner_repo(owner, repo, {body: request_body.to_json, query: request_params}) rescue nil
raise Error, '创建文件失败!' unless @gitea_data.is_a?(Hash)
end


+ 12
- 8
app/views/api/v1/projects/contents/batch.json.jbuilder View File

@@ -3,12 +3,16 @@ json.commit do
json.authored_time render_unix_time(@result_object['commit']['author']['date'])
json.commited_time render_unix_time(@result_object['commit']['committer']['date'])
end
json.contents @result_object['contents'].each do |content|
json.name content['name']
json.path content['path']
json.sha content['sha']
json.type content['type']
json.size content['size']
json.encoding content['encoding']
json.content content['content']
if @result_object['contents'].is_a?(Array)
json.contents @result_object['contents'].each do |content|
json.name content['name']
json.path content['path']
json.sha content['sha']
json.type content['type']
json.size content['size']
json.encoding content['encoding']
json.content content['content']
end
else
json.contents []
end

Loading…
Cancel
Save