区块链确权相关

This commit is contained in:
2023-03-02 13:49:50 +08:00
parent 5216e61479
commit b1c10d66f9
26 changed files with 1354 additions and 97 deletions

View File

@@ -151,6 +151,7 @@ class IssuesController < ApplicationController
end
@issue.project_trends.create(user_id: current_user.id, project_id: @project.id, action_type: "create")
@issue.project_trends.create(user_id: current_user.id, project_id: @project.id, action_type: ProjectTrend::CLOSE) if params[:status_id].to_i == 5
@@ -159,6 +160,15 @@ class IssuesController < ApplicationController
# 新增时向grimoirelab推送事件
IssueWebhookJob.set(wait: 5.seconds).perform_later(@issue.id)
# author: zxh
# 扣除发起人的token
if @issue.blockchain_token_num > 0
Blockchain::CreateIssue.call(user_id: @issue.author_id, project_id: @issue.project_id, token_num: @issue.blockchain_token_num)
end
# 调用上链API存证
push_activity_2_blockchain("issue_create", @issue)
render json: {status: 0, message: "创建成功", id: @issue.id}
else
normal_status(-1, "创建失败")
@@ -546,7 +556,8 @@ class IssuesController < ApplicationController
branch_name: params[:branch_name].to_s,
issue_classify: "issue",
author_id: current_user.id,
project_id: @project.id
project_id: @project.id,
blockchain_token_num: params[:blockchain_token_num]
}
end