WrenchFamilyTransferStart
This commit is contained in:
@@ -341,6 +341,9 @@ enum { PARTNER_STRIPE };
|
||||
#define WRENCHBOARD_FAMILY_LIST 22010
|
||||
#define WRENCHBOARD_FAMILY_WALLET 22012
|
||||
|
||||
#define WRENCHBOARD_FAMILY_TRANSFERSTART 22013
|
||||
#define WRENCHBOARD_FAMILY_TRANSFER 22014
|
||||
|
||||
#define WRENCHBOARD_FAMILY_ADD 22015
|
||||
#define WRENCHBOARD_FAMILY_UPDATE 22020
|
||||
#define WRENCHBOARD_FAMILY_MANAGE 22025
|
||||
|
||||
@@ -28,6 +28,7 @@ long WrenchSuggestTasks(CVars in, CVars &out);
|
||||
long WrenchSuggestList(CVars in, CVars &out);
|
||||
long WrenchSuggestWaitingList(CVars in, CVars &out);
|
||||
long WrenchSuggestTaskStatus(CVars in, CVars &out);
|
||||
long WrenchFamilyTransferStart(CVars in, CVars &out);
|
||||
|
||||
long family_calls(CVars in, CVars &out){
|
||||
logfmt(logINFO, "family_calls()");
|
||||
@@ -48,6 +49,14 @@ long family_calls(CVars in, CVars &out){
|
||||
return WrenchFamilyWallet(in, out);
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_FAMILY_TRANSFERSTART:
|
||||
return WrenchFamilyTransferStart(CVars in, CVars &out)
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_FAMILY_TRANSFER:
|
||||
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_FAMILY_SAMPLETASKS:
|
||||
return WrenchSampleTasks(in, out);
|
||||
break;
|
||||
@@ -385,6 +394,94 @@ long WrenchSampleTasks(CVars in, CVars &out){
|
||||
return ret;
|
||||
}
|
||||
|
||||
long WrenchFamilyTransferStart(CVars in, CVars &out){
|
||||
logfmt(logINFO, "ENTER CALL long WrenchFamilyWallet");
|
||||
char vname[30];
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
long family_member_id = 0;
|
||||
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, "wallet_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);
|
||||
family_member_id = rec0["family_member_id"].Long();
|
||||
}
|
||||
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 AND w.uid='%s' ORDER BY c.lorder DESC", rec0["family_member_id"].Long(), in["wallet_uid"].c_str());
|
||||
|
||||
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, 0);
|
||||
if (f.empty()) continue;
|
||||
CVars rec;
|
||||
map_to_cvars(f, rec);
|
||||
|
||||
out = 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 WrenchFamilyTransferStart(CVars in, CVars &out)");
|
||||
}
|
||||
|
||||
logfmt(logINFO, "EXIT CALL long WrenchFamilyTransferStart");
|
||||
return 0;
|
||||
}
|
||||
|
||||
long WrenchFamilyWallet(CVars in, CVars &out){
|
||||
logfmt(logINFO, "ENTER CALL long WrenchFamilyWallet");
|
||||
char vname[30];
|
||||
|
||||
Reference in New Issue
Block a user