Fix select

This commit is contained in:
CHIEFSOFT\ameye
2023-05-09 18:19:39 -04:00
parent e0cd3ad9a9
commit fd0bc9af69
+16 -7
View File
@@ -103,15 +103,24 @@ long jobs_calls(CVars in, CVars &out) {
}
long WrenchJobPostAgree(CVars in, CVars &out) {
long member_id = REQ_LONG(in, "member_id", 1, -1);
REQ_STRING(in, "uid", 1, 500, "(.*)"); //uid
if (load_db_record(out, "SELECT * FROM members WHERE id = %lu AND uid='%s' AND post_jobs IS NULL", in["message_id"].Long(), in["uid"].c_str()) ){
pgsql_exec("UPDATE members SET post_jobs = now() WHERE id = %lu AND uid='%s'", in["message_id"].Long(), in["uid"].c_str());
logfmt(logINFO, "WrenchJobPostAgree()");
long ret = PHP_API_BAD_PARAM;
try {
long member_id = REQ_LONG(in, "member_id", 1, -1);
REQ_STRING(in, "uid", 1, 500, "(.*)"); //uid
if (load_db_record(out, "SELECT id AS member_id, * FROM members WHERE id = %lu AND uid='%s' AND post_jobs IS NULL", in["member_id"].Long(), in["uid"].c_str()) ){
if ( out["member_id"].Long() > 0 )
{
pgsql_exec("UPDATE members SET post_jobs = now() WHERE id = %lu AND uid='%s'", in["message_id"].Long(), in["uid"].c_str());
load_db_record(out, "SELECT * FROM members WHERE id = %lu AND uid='%s' AND post_jobs IS NOT NULL", in["member_id"].Long(), in["uid"].c_str());
}
}
ret = PHP_CREATED_OK;
} catch (bad_parameter) {
out["log_status"] = "Error WrenchMarketInterestQuestion";
}
logfmt(logINFO, "/WrenchJobPostAgree()");
return 0;
return ret;
}