From f990a1199e4e14f1d9b2a62538fc6b082ff07936 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Mon, 3 Jul 2023 16:11:13 -0400 Subject: [PATCH] Suggest task --- wrenchboard/src/shared_tool/family_acc.cc | 38 +++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/wrenchboard/src/shared_tool/family_acc.cc b/wrenchboard/src/shared_tool/family_acc.cc index 7c4aab31..b227805f 100644 --- a/wrenchboard/src/shared_tool/family_acc.cc +++ b/wrenchboard/src/shared_tool/family_acc.cc @@ -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) { + mapf = 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");