From 015d221ccfbdd52c13180a440c2e9271777193a3 Mon Sep 17 00:00:00 2001 From: zhangxunhui Date: Thu, 2 Feb 2023 20:42:38 +0800 Subject: [PATCH] fix bug of blockchain_balance_one_project function --- app/controllers/users_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 1cc3a504..7f33dbf2 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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