From 51962cebeec05c6fa8291ffd8c5d09e733e0627d Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Thu, 30 May 2024 11:59:04 -0400 Subject: [PATCH] ,amount AS default_wallet_balance --- wrenchboard/src/shared_tool/account.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/wrenchboard/src/shared_tool/account.cc b/wrenchboard/src/shared_tool/account.cc index 08ed1838..c4ebb2c6 100644 --- a/wrenchboard/src/shared_tool/account.cc +++ b/wrenchboard/src/shared_tool/account.cc @@ -2433,15 +2433,16 @@ long LoginWrenchBoardAccount(CVars in, CVars &out) { " FROM members WHERE status=1 AND " " LOWER(username)=LOWER('%s') AND password= md5('%s')", in["username"].c_str(), in["password"].c_str()); if (ret > 0) { - + out["wallet_status"] = "-1"; if ( out["country"] !=""){ + out["wallet_status"] = "0"; CVars vw; load_db_record(vw, "SELECT code AS currency FROM currency WHERE country='%s'",out["country"].c_str()); if ( vw["currency"] !=""){ - //vw["currency"] = "NAIRA"; // this might become a variable based on the country vw["currency"].set_valid( true ); long wallet_id = CheckWallet(out["member_id"].Long(),vw); - load_db_record( out, "SELECT amount AS balance FROM members_wallet WHERE member_id = %lu AND currency='%s' ", out["member_id"].Long(), vw["currency"].c_str()); // retired + load_db_record( out, "SELECT amount AS balance,amount AS default_wallet_balance FROM members_wallet WHERE member_id = %lu AND currency='%s' ", out["member_id"].Long(), vw["currency"].c_str()); // retired + out["wallet_status"] = "1"; } } @@ -2463,7 +2464,6 @@ long LoginWrenchBoardAccount(CVars in, CVars &out) { out["password"] = ""; out["active_job_count"] = WrenchJobCount( out["member_id"].Long() ); out["active_family_count"] = WrenchFamilyCount( out["member_id"].Long() ); - out["wallet_status"] = "-1"; LoginLogger(out["member_id"].Long(),login_mode); } else { out["status"] = "Session check failed"; @@ -2686,15 +2686,17 @@ long LoginWrenchBoardExternal(CVars in, CVars &out) { ret = load_db_record(out, "SELECT *,id AS member_id,country FROM members WHERE id='%ld'", out["member_id"].Long()); } if (out["member_id"].Long() > 0) { - + out["wallet_status"] = "-1"; if ( out["country"] !=""){ // need to construct wallet if needed. + out["wallet_status"] = "0"; CVars vw; load_db_record(vw, "SELECT code AS currency FROM currency WHERE country='%s'",out["country"].c_str()); if ( vw["currency"] !=""){ //vw["currency"] = "NAIRA"; // this might become a variable based on the country vw["currency"].set_valid( true ); long wallet_id = CheckWallet(out["member_id"].Long(),vw); - load_db_record( out, "SELECT amount AS balance FROM members_wallet WHERE member_id = %lu AND currency='%s' ", out["member_id"].Long(), vw["currency"].c_str()); // retired + load_db_record( out, "SELECT amount AS balance,amount AS default_wallet_balance FROM members_wallet WHERE member_id = %lu AND currency='%s' ", out["member_id"].Long(), vw["currency"].c_str()); // retired + out["wallet_status"] = "1"; } }