fix bug of blockchain_balance_one_project function

This commit is contained in:
zhangxunhui 2023-02-02 20:42:38 +08:00
parent 2f6c568688
commit 015d221ccf
1 changed files with 2 additions and 2 deletions

View File

@ -91,7 +91,7 @@ class UsersController < ApplicationController
(count_user * 1.0 / (count_all + 0.000000001)).round(5)
end
if @project.use_blockchain == true or @project.use_blockchain == 1
if @project['use_blockchain'] == true or @project['use_blockchain'] == 1
balance_user = Blockchain::BalanceQueryOneProject.call({"user_id": user_id, "project_id": project_id})[:balance]
balance_all = Blockchain::RepoBasicInfo.call({"project_id": project_id})["cur_supply"]
scores = {
@ -439,7 +439,7 @@ class UsersController < ApplicationController
if owner.nil?
normal_status(-1, "创建者无法找到")
else
p = Project.find_by(user_id: owner.id, name: params['project_name'])
p = Project.find_by(user_id: owner.id, identifier: params['project_identifier'])
results = Blockchain::BalanceQueryOneProject.call({"user_id": params['user_id'].to_i, "project_id": p.id.to_i})
render json: { status: results[:status], balance: results[:balance]}
end