,amount AS default_wallet_balance

This commit is contained in:
CHIEFSOFT\ameye
2024-05-30 11:59:04 -04:00
parent 01f923c513
commit 51962cebee
+8 -6
View File
@@ -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";
}
}