help contents

This commit is contained in:
CHIEFSOFT\ameye
2023-12-09 12:49:46 -05:00
parent a07a88ec49
commit d9532dbdbe
6 changed files with 134 additions and 28 deletions
+4
View File
@@ -345,6 +345,10 @@ long account_calls(CVars in, CVars &out) {
return WrenchReturnMemberNotifications(in, out);
break;
case WRENCHBOARD_ACCT_HELPITEMS:
return WrenchReturnHelpItems( in, out);
break;
case WRENCHBOARD_ACCOUNT_DASHDATA:
return WrenchLoadDashData(in, out);
break;
@@ -14,6 +14,66 @@
#include "payments.h"
#include "account.h"
long WrenchReturnHelpItems(CVars in, CVars &out){
logfmt(logINFO, "WrenchReturnHelpItems()");
char vname[30];
long ret = PHP_API_BAD_PARAM;
/*
wrenchboard=> SELECT * FROM help_items WHERE status=1 ORDER BY lorder ASC;
id | uid | icon | title | contents | lorder | status | added
----+--------------------------------------+-------------+----------------------------+--------------------------------------+--------+--------+----------------------------
1 | 82fabd0f-91c9-4472-9e84-8425010db4b4 | message.svg | What is WrenchBoard? | Coming soon - Contents will be fixed | 1 | 1 | 2023-12-09 12:27:14.68754
2 | 10392635-0098-42df-b338-9a8ec98cae93 | message.svg | Family Account | Coming soon - Contents will be fixed | 1 | 1 | 2023-12-09 12:27:14.692123
3 | d4e84174-5586-47b1-84fe-a2a339a33a8d | message.svg | How does Wrenchboard work? | Coming soon - Contents will be fixed | 1 | 1 | 2023-12-09 12:27:14.694878
*/
try {
long limit = REQ_LONG(in, "limit", 1, -1);
long member_id = REQ_LONG(in, "member_id", 1, -1);
REQ_LONG(in, "page", 1, -1);
out["total_record"] = "0";
const PGresult *res;
res = pgsql_query("SELECT * FROM help_items WHERE status=1 ORDER BY lorder ASC");
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), "icon_%05d", i);
out[vname] = rec["icon"];
snprintf(vname, sizeof (vname), "title_%05d", i);
out[vname] = rec["title"];
snprintf(vname, sizeof (vname), "contents_%05d", i);
out[vname] = rec["contents"];
snprintf(vname, sizeof (vname), "added_%05d", i);
out[vname] = rec["added"];
}
}
ret = PHP_API_OK;
out["status"] = "OK";
} catch (bad_parameter) {
logfmt(logINFO, "ERROR CALL long WrenchReturnHelpItems(CVars in, CVars &out)");
}
logfmt(logINFO, "/WrenchReturnHelpItems()");
return ret;
return ret;
}
long WrenchReturnMemberNotifications(CVars in, CVars &out){
/*