This commit is contained in:
CHIEFSOFT\ameye
2023-11-11 15:15:20 -05:00
parent e7fb78daad
commit ed59506e59
+25 -7
View File
@@ -883,10 +883,16 @@ long WrenchBoardMobileSendUserWallet(CVars in, CVars &out) {
if ( VerifySession(in, out) != PHP_API_OK ){
return 0;
}
/*
public function getUserEscrowWallet($member_id) {
$mysql = "SELECT sum(amount),currency FROM members_payments WHERE code ='OFDPS' AND member_id = $member_id AND confirmation IS NOT NULL AND flags = 4 GROUP BY currency";
$query = $this->db->query($mysql);
return $query->result_array();
}
*/
try {
REQ_LONG(in, "member_id", 1, -1);
out["total_record"] = "0";
REQ_LONG(in, "member_id", 1, -1);
out["total_record"] = "0";
const PGresult *res;
res = pgsql_query("SELECT w.amount,c.*,w.amount AS current_balance,c.country,w.transfer_limit,w.uid AS wallet_uid "
"FROM members_wallet w LEFT JOIN currency c ON c.code=w.currency "
@@ -930,11 +936,23 @@ long WrenchBoardMobileSendUserWallet(CVars in, CVars &out) {
snprintf(vname, sizeof (vname), "processor_%05d", i);
out[vname] = rec["processor"];
}
const PGresult *res2;
res2 = pgsql_query("SELECT sum(amount) AS escrow,currency FROM members_payments WHERE code ='OFDPS' AND member_id = %lu "
"AND confirmation IS NOT NULL AND flags = 4 GROUP BY currency", in["member_id"].Long());
if (res2 != NULL && pgsql_num_rows(res2) > 0) {
for (int i = 0, n = pgsql_num_rows(res); i < n; i++) {
map<const char*, const char*>f = pgsql_fetch_assoc(res2, i);
if (f.empty()) continue;
CVars rec2;
map_to_cvars(f, rec2);
snprintf(vname, sizeof (vname), "escrow_%s", rec2["currency"].c_str());
out[vname] = rec2["escrow"];
}
}
}
ret = PHP_API_OK;
out["status"] = "OK";