family wallet

This commit is contained in:
CHIEFSOFT\ameye
2023-10-24 04:47:30 -04:00
parent 22d44551a8
commit dbe3e6d136
4 changed files with 98 additions and 20 deletions
+18
View File
@@ -40,5 +40,23 @@ long WrenchUpdateSiteGallery(CVars in, CVars &out);
long WrenchReturnStartJobList(CVars in, CVars &out);
long WrenchLoadDashData(CVars in, CVars &out);
long LoginLogger( long member_id, long login_mode);
long WrenchBoardMobileSendMoney(CVars in, CVars &out);
long WrenchBoardMobileSendJobInterest(CVars in, CVars &out);
long WrenchReturnPendingJobList(CVars in, CVars &out);
long WrenchBoardMobileSendUserWallet(CVars in, CVars &out);
long WrenchBoardStartBalanceTopup(CVars in, CVars &out);
long WrenchBoardCompleteBalanceTopup(CVars in, CVars &out);
long WrenchResendSendReferLoadLink(CVars in, CVars &out);
long WrenchBoardDeleteAccount(CVars in, CVars &out);
long VerifyWrenchAccountLink(CVars in, CVars &out);
long LoginWrenchBoardAuxAccount(CVars in, CVars &out);
long WrenchDeleteUsersCCard(CVars in, CVars &out);
long WrenchFlutterCreditHook(CVars in, CVars &out);
long WrenchBoardTopupResult(CVars in, CVars &out);
long WrenchRegisterMyFileUpload(CVars in, CVars &out);
long WrenchGetRecentDash(CVars in, CVars &out);
long LoginWrenchBoardQRAccount(CVars in, CVars &out);
#endif
+1 -17
View File
@@ -113,23 +113,7 @@ status INT DEFAULT 1,
created timestamp without time zone DEFAULT now()
);
*/
long LoginLogger( long member_id, long login_mode);
long WrenchBoardMobileSendMoney(CVars in, CVars &out);
long WrenchBoardMobileSendJobInterest(CVars in, CVars &out);
long WrenchReturnPendingJobList(CVars in, CVars &out);
long WrenchBoardMobileSendUserWallet(CVars in, CVars &out);
long WrenchBoardStartBalanceTopup(CVars in, CVars &out);
long WrenchBoardCompleteBalanceTopup(CVars in, CVars &out);
long WrenchResendSendReferLoadLink(CVars in, CVars &out);
long WrenchBoardDeleteAccount(CVars in, CVars &out);
long VerifyWrenchAccountLink(CVars in, CVars &out);
long LoginWrenchBoardAuxAccount(CVars in, CVars &out);
long WrenchDeleteUsersCCard(CVars in, CVars &out);
long WrenchFlutterCreditHook(CVars in, CVars &out);
long WrenchBoardTopupResult(CVars in, CVars &out);
long WrenchRegisterMyFileUpload(CVars in, CVars &out);
long WrenchGetRecentDash(CVars in, CVars &out);
long LoginWrenchBoardQRAccount(CVars in, CVars &out);
long test() {
FILE* oldFile = Output2FILE::Stream();
+78 -3
View File
@@ -16,9 +16,10 @@
#include "jobs_manager.h"
#include "family_acc.h"
#include "common_tool.h"
#include "account.h"
long WrenchFamilyList(CVars in, CVars &out);
long WrenchFamilyWallet(CVars in, CVars &out);
long WrenchFamilyWallet(CVars in, CVars &out);
long WrenchFamilyAdd(CVars in, CVars &out);
long WrenchFamilyUpdate(CVars in, CVars &out);
long WrenchFamilyManage(CVars in, CVars &out);
@@ -385,9 +386,83 @@ long WrenchSampleTasks(CVars in, CVars &out){
}
long WrenchFamilyWallet(CVars in, CVars &out){
logfmt(logINFO, "ENTER CALL long WrenchFamilyWallet");
logfmt(logINFO, "ENTER CALL long WrenchFamilyWallet");
char vname[30];
long ret = PHP_API_BAD_PARAM;
const PGresult *res0;
try {
long member_id = REQ_LONG(in, "member_id", 1, -1);
REQ_STRING(in, "family_uid", 2, 50, "(.*)");
REQ_STRING(in, "uid", 2, 50, "(.*)");
REQ_STRING(in, "sessionid", 2, 149, "(.*)");
logfmt(logINFO, "WrenchFamilyWallet() Verify Session ");
CVars rec0;
if ( VerifySession(in, out) != PHP_API_OK ){
return 0;
}
res0 = pgsql_query("SELECT family_member_id FROM members_family WHERE member_id = %lu AND uid='%s' ", in["member_id"].Long(), in["family_uid"].c_str());
if (res0 != NULL && pgsql_num_rows(res0) > 0) {
map<const char*, const char*>f = pgsql_fetch_assoc(res0, 0);
map_to_cvars(f, rec0);
}
else{
return 0;
}
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 "
"WHERE w.member_id = %lu ORDER BY c.lorder DESC", rec0["family_member_id"].Long());
if (res != NULL && pgsql_num_rows(res) > 0) {
out["total_record"] = pgsql_num_rows(res);
for (int i = 0, n = pgsql_num_rows(res); i < n; i++) {
map<const char*, const char*>f = pgsql_fetch_assoc(res, i);
if (f.empty()) continue;
CVars rec;
map_to_cvars(f, rec);
snprintf(vname, sizeof (vname), "amount_%05d", i);
out[vname] = rec["amount"];
snprintf(vname, sizeof (vname), "currency_%05d", i);
out[vname] = rec["currency"];
// amount | id | code | description | symbol | action_type | lorder | current_balance
snprintf(vname, sizeof (vname), "description_%05d", i);
out[vname] = rec["description"];
snprintf(vname, sizeof (vname), "symbol_%05d", i);
out[vname] = rec["symbol"];
snprintf(vname, sizeof (vname), "action_type_%05d", i);
out[vname] = rec["action_type"];
snprintf(vname, sizeof (vname), "code_%05d", i);
out[vname] = rec["code"];
snprintf(vname, sizeof (vname), "country_%05d", i);
out[vname] = rec["country"];
snprintf(vname, sizeof (vname), "transfer_limit_%05d", i);
out[vname] = rec["transfer_limit"];
snprintf(vname, sizeof (vname), "wallet_uid_%05d", i);
out[vname] = rec["wallet_uid"];
}
}
ret = PHP_API_OK;
out["status"] = "OK";
} catch (bad_parameter) {
logfmt(logINFO, "ERROR CALL long WrenchFamilyWallet(CVars in, CVars &out)");
}
logfmt(logINFO, "EXIT CALL long WrenchFamilyWallet");
return 0;
+1
View File
@@ -761,6 +761,7 @@ class ResultFormatter extends Model
break;
case WRENCHBOARD_ACCOUNT_WALLETS:
case WRENCHBOARD_FAMILY_WALLET:
$total = $out["total_record"];
$res = array(
"status" => $out["status"],