family list
This commit is contained in:
@@ -33,6 +33,8 @@ long WrenchFamilyTransferStart(CVars in, CVars &out);
|
||||
long WrenchFamilyTransfer(CVars in, CVars &out);
|
||||
long WrenchFamilyTransferHx(CVars in, CVars &out);
|
||||
long WrenchFamilyInvite(CVars in, CVars &out);
|
||||
long WrenchFamilyInviteList(CVars in, CVars &out);
|
||||
|
||||
|
||||
long family_calls(CVars in, CVars &out){
|
||||
logfmt(logINFO, "family_calls()");
|
||||
@@ -107,14 +109,68 @@ long family_calls(CVars in, CVars &out){
|
||||
break;'
|
||||
case WRENCHBOARD_FAMILY_RELLIST:
|
||||
logfmt(logINFO, "ENTER CALL long WRENCHBOARD_FAMILY_RELLIST");
|
||||
return WrenchFamilyInviteList(in, out);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
long WrenchFamilyInviteList(CVars in, CVars &out){
|
||||
logfmt(logINFO, "ENTER CALL long WrenchFamilyInviteList");
|
||||
char vname[30];
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
const PGresult *res;
|
||||
try{
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
long offset = REQ_LONG(in, "offset", 1, -1);
|
||||
long limit = REQ_LONG(in, "limit", 1, -1);
|
||||
|
||||
out["total_record"] = "0";
|
||||
res = pgsql_query("SELECT * "
|
||||
" FROM members_family_relative "
|
||||
" WHERE member_id = %lu ) "
|
||||
" AND sg.status IN ( 1,2,3,4,5) "
|
||||
" ORDER BY id DESC ", member_id );
|
||||
|
||||
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), "uid_%05d", i);
|
||||
out[vname] = rec["uid"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "firstname_%05d", i);
|
||||
out[vname] = rec["firstname"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "lastname_%05d", i);
|
||||
out[vname] = rec["lastname"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "email_%05d", i);
|
||||
out[vname] = rec["email"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "family_type_%05d", i);
|
||||
out[vname] = rec["family_type"];
|
||||
|
||||
}
|
||||
}
|
||||
ret = PHP_API_OK;
|
||||
out["status"] = "OK";
|
||||
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL long WrenchFamilyInviteList");
|
||||
}
|
||||
|
||||
logfmt(logINFO, "WrenchFamilyInviteList()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
long WrenchFamilyInvite(CVars in, CVars &out){
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
// const PGresult *res;
|
||||
try{
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
REQ_STRING(in, "uid", 3, 150, "(.*)");
|
||||
@@ -124,9 +180,11 @@ long WrenchFamilyInvite(CVars in, CVars &out){
|
||||
REQ_STRING(in, "family_type", 3, 25, "(.*)");
|
||||
|
||||
out["invite_id"] ="0";// we will set if all okay
|
||||
const PGresult *res = pgsql_query("SELECT id FROM members_family_relative "
|
||||
" WHERE LOWER('%s') = LOWER(email) AND member_id= %lu", in["email"].c_str(), member_id);
|
||||
if (res != NULL && pgsql_num_rows(res) == 0 ) {
|
||||
// const PGresult *res = pgsql_query("SELECT id FROM members_family_relative "
|
||||
// " WHERE LOWER('%s') = LOWER(email) AND member_id= %lu", in["email"].c_str(), member_id);
|
||||
if ( load_db_record(out, "SELECT id FROM members_family_relative "
|
||||
" WHERE LOWER('%s') = LOWER(email) AND member_id= %lu", in["email"].c_str(), member_id)== 0){
|
||||
// if (res != NULL && pgsql_num_rows(res) == 0 ) {
|
||||
|
||||
CVars xx;
|
||||
xx["member_id"] = member_id;
|
||||
|
||||
Reference in New Issue
Block a user