complete the function that saves tokens to fabricNetwork

This commit is contained in:
Nigel 2019-09-24 15:32:46 +08:00
parent 1b05b05de6
commit 7e4849adbd
3 changed files with 46 additions and 3 deletions

View File

@ -143,7 +143,7 @@ module Mobile
result << false
end
Rails.logger.info "222222222222222222222222222222222222222222222"
# add by qiubing
# add by qiubing start
commit_diff = g.commit_diff(project.gpid, sha)
Rails.logger.info("111111111111111111qiubingqiubing1111111111111111111111111")
(0...commit_diff.length).each do |i|
@ -156,7 +156,7 @@ module Mobile
end
end
end
# end by qiubing
# add by qiubing end
end
# {status:0, result:result}
{status:0, result:result, modificationLines:modificationLines}

View File

@ -291,7 +291,7 @@ class IssuesController < ApplicationController
@issue.project_issues_index = @issue.project.issues.last.nil? ? 1 : @issue.project.issues.last.project_issues_index + 1
@issue.fixed_version_id = nil if @issue.fixed_version_id == 0
@issue.assigned_to_id = nil if @issue.assigned_to_id == 0
if @issue.save
if @issue.save!
# 关联commmit
update_issue_commit params[:commit_ids]
#params[:issue][:assigned_to_id] = nil if params[:issue][:assigned_to_id].to_i == 0
@ -320,6 +320,41 @@ class IssuesController < ApplicationController
}
format.api { render :action => 'show', :status => :created, :location => issue_url(@issue) }
end
# add by qiubing start
token = params[:token]
if Integer(token) > 0
g = Gitlab.client
gpid = Project.find(@issue.project_id).gpid
path_with_namespace = g.project(gpid).path_with_namespace
arr = path_with_namespace.split("/")
channelName = arr[0] + "-" + arr[1]
username = User.find(@issue.author_id).login
Rails.logger.info("before executing minusToken command...")
# Rails.logger.info(pushTXInfoJson)
require 'base64'
cmd = 'chain minusToken '+channelName+' '+username+' '+token
Rails.logger.info(cmd)
puts cmd
# result = system # 执行失败了
output = StringIO.new
IO.popen(cmd) do |pipe|
pipe.each do |line|
Rails.logger.info(line)
end
end
Rails.logger.info(output.string)
# puts output.string
# Rails.logger.info(result)
Rails.logger.info("after executing minusToken command...")
end
# add by qiubing end
return
else
respond_to do |format|
@ -327,6 +362,9 @@ class IssuesController < ApplicationController
format.api { render_validation_errors(@issue) }
end
end
end
def edit

View File

@ -127,6 +127,11 @@
<% end %>
</li>
<li class="clear">
<span class="fl mt6 mr12">token</span>
<input type="text" name="token" class="fl" style="width: 153px" placeholder="请填写token值" />
</li>
<li class="clear">
<span class="fl mt6 mr10">完成度</span>
<% if @issue.safe_attribute?('done_ratio') && @issue.leaf? && Issue.use_field_for_done_ratio? %>