change chain

This commit is contained in:
sylor_huang@126.com
2020-06-09 18:55:09 +08:00
parent d586f526c9
commit 79641e859c
11 changed files with 114 additions and 101 deletions

View File

@@ -13,11 +13,11 @@ class Gitea::Chain::ChainGetService < Gitea::ChainService
private
def request_params
Hash.new.merge(data: params["chain_params"])
params[:chain_params]
end
def url
chain_type = params["type"].to_s
chain_type = params[:type].to_s
case chain_type
when "query"
"/repos/amount/query".freeze

View File

@@ -13,11 +13,11 @@ class Gitea::Chain::ChainPostService < Gitea::ChainService
private
def request_params
Hash.new.merge(data: params["chain_params"])
Hash.new.merge(data: params[:chain_params])
end
def url
chain_type = params["type"].to_s
chain_type = params[:type].to_s
case chain_type
when "create"
"/repos/create".freeze

View File

@@ -18,8 +18,10 @@ class Gitea::ChainService < ApplicationService
def get(url, params={})
conn.get do |req|
req.url = "#{request_url}"
req.body = params[:data].to_json
req.url "#{request_url}"
params.each_pair do |key, value|
req.params["#{key}"] = value
end
end
end

View File

@@ -21,7 +21,7 @@ class Repositories::CreateService < ApplicationService
username: user.try(:login),
reponame: @repository.try(:identifier),
token_name: @repository.try(:identifier),
total_supply: 0
total_supply: 1000000
}
}
PostChainJob.perform_later(chain_params) #创建上链操作