add blockchain operation after comments
This commit is contained in:
parent
f4f1aef365
commit
cbb666052c
|
@ -21,6 +21,7 @@ class JournalsController < ApplicationController
|
|||
if notes.blank?
|
||||
normal_status(-1, "评论内容不能为空")
|
||||
else
|
||||
ActiveRecord::Base.transaction do
|
||||
journal_params = {
|
||||
journalized_id: @issue.id ,
|
||||
journalized_type: "Issue",
|
||||
|
@ -42,11 +43,22 @@ class JournalsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# author: zxh
|
||||
# 调用上链API
|
||||
success_blockchain = push_activity_2_blockchain("issue_comment_create", journal)
|
||||
if success_blockchain == false
|
||||
normal_status(-1, "评论失败")
|
||||
raise ActiveRecord::Rollback
|
||||
else
|
||||
render json: {status: 0, message: "评论成功", id: journal.id}
|
||||
end
|
||||
|
||||
# @issue.project_trends.create(user_id: current_user.id, project_id: @project.id, action_type: "journal")
|
||||
render :json => { status: 0, message: "评论成功", id: journal.id}
|
||||
# normal_status(0, "评论成功")
|
||||
else
|
||||
normal_status(-1, "评论失败")
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue