family manage

This commit is contained in:
CHIEFSOFT\ameye
2023-05-20 09:46:41 -04:00
parent 2c41e68c7d
commit 691b8cf9e9
+24 -2
View File
@@ -176,8 +176,30 @@ wrenchboard=> select * from members_family;
----+-----------+-----------+----------+-----+--------+--------+-------+---------
(0 rows)
*/
logfmt(logINFO, "WrenchFamilyManage()");
return 0;
long ret = PHP_API_BAD_PARAM;
logfmt(logINFO, "WrenchFamilyManage()");
long family_id = 0;
try {
long member_id = REQ_LONG(in, "member_id", 1, -1);
REQ_STRING(in, "uid", 2, 45, "(.*)");
REQ_STRING(in, "family_uid", 2, 45, "(.*)");
const PGresult *res = pgsql_query(" SELECT id AS family_id,* FROM members_family "
" WHERE member_id=%lu AND uid='%s' ", member_id,in["family_uid"].c_str());
if (res != NULL && pgsql_num_rows(res) > 0) {
map<const char*, const char*>f = pgsql_fetch_assoc(res, 0);
CVars rec;
map_to_cvars(f, rec);
out = rec;
ret = PHP_API_OK;
}
out["status"] = "OK";
} catch (bad_parameter) {
logfmt(logINFO, "ERROR CALL long WrenchFamilyUpdate(CVars in, CVars &out)");
}
logfmt(logINFO, "/WrenchFamilyManage()");
return ret;
}