Suggest task

This commit is contained in:
CHIEFSOFT\ameye
2023-07-03 16:11:13 -04:00
parent 3585695701
commit f990a1199e
+38
View File
@@ -22,6 +22,7 @@ long WrenchFamilyAdd(CVars in, CVars &out);
long WrenchFamilyUpdate(CVars in, CVars &out);
long WrenchFamilyManage(CVars in, CVars &out);
long WrenchSampleTasks(CVars in, CVars &out);
long WrenchSuggestTasks(CVars in, CVars &out);
long family_calls(CVars in, CVars &out){
logfmt(logINFO, "family_calls()");
@@ -56,6 +57,7 @@ long family_calls(CVars in, CVars &out){
case WRENCHBOARD_FAMILY_SGGESTTASKS:
logfmt(logINFO, "ENTER CALL long WRENCHBOARD_FAMILY_SGGESTTASKS");
return WrenchSuggestTasks(in, out);
break;
case WRENCHBOARD_FAMILY_SGGESTLIST:
@@ -65,6 +67,42 @@ long family_calls(CVars in, CVars &out){
}
return 0;
}
/*
'member_id' => int 188
'sessionid' => string '2620D99AC6E222F1C68A98BC77DC3B28410FC62AE129FA4148FB38196F09305E' (length=64)
'uid' => string '745db27f-db41-4045-a9a8-6c2a4abceea7' (length=36)
'title' => string 'This is the job title 8564 job title' (length=36)
'description' => string 'This is the job description 5790 job description' (length=48)
'action' => int 13010
*/
long WrenchSuggestTasks(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, "(.*)");
REQ_STRING(in, "title", 3, 150, "(.*)");
REQ_STRING(in, "description", 3, 299, "(.*)");
const PGresult *res = pgsql_query("SELECT * FROM members WHERE id=%lu AND uid='%s'", member_id, in["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);
ret = PHP_API_OK;
out["status"] = "ACCOUNT FOUND";
out = rec;
}
} catch (bad_parameter) {
logfmt(logINFO, "ERROR CALL long WrenchSuggestTasks");
}
logfmt(logINFO, "WrenchSuggestTasks()");
return ret;
}
long WrenchSampleTasks(CVars in, CVars &out){
logfmt(logINFO, "ENTER CALL long WrenchSampleTasks");