offer message
This commit is contained in:
@@ -419,29 +419,38 @@ long WrenchMarketInterestQuestionList(CVars in, CVars &out) {
|
||||
try {
|
||||
out["status"] = "0";
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
//long interest_id = REQ_LONG(in, "interest_id", 1, -1);
|
||||
REQ_STRING(in, "offer_uid", 1, 55, "(.*)");
|
||||
REQ_STRING(in, "interest_uid", 1, 55, "(.*)");
|
||||
//REQ_STRING(in, "offer_code", 1, 15, "(.*)"); //offer_code
|
||||
REQ_STRING(in, "msg_type", 1, 15, "(.*)"); //msg_type
|
||||
|
||||
const PGresult *res = pgsql_query("SELECT o.*,o.member_id AS client_id,jo.offer_code "
|
||||
" FROM members_messages o "
|
||||
" LEFT JOIN members_jobs_offer jo ON jo.id=o.offer_id WHERE jo.uid='%s' AND o.uid=%lu", in["offer_uid"].c_str(), in["interest_uid"].c_str());
|
||||
|
||||
const PGresult *res = pgsql_query("SELECT moi.offer_id,mjo.offer_code,mm.* "
|
||||
"FROM members_offer_interest moi "
|
||||
"LEFT JOIN members_jobs_offer mjo ON mjo.id=moi.offer_id "
|
||||
"LEFT JOIN members_messages mm ON mm.memo=mjo.offer_code "
|
||||
"WHERE moi.uid = '%s' ", in["interest_uid"].c_str());
|
||||
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
map<const char*, const char*>f = pgsql_fetch_assoc(res, 0);
|
||||
if (!f.empty()) {
|
||||
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);
|
||||
out = rec;
|
||||
|
||||
snprintf(vname, sizeof (vname), "msg_uid_%05d", i);
|
||||
out[vname] = rec["uid"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "added_%05d", i);
|
||||
out[vname] = rec["added"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "msg_%05d", i);
|
||||
out[vname] = rec["msg"];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ret = PHP_CREATED_OK;
|
||||
ret = PHP_API_OK;
|
||||
out["status"] = "OK";
|
||||
|
||||
} catch (bad_parameter) {
|
||||
out["log_status"] = "Error WrenchMarketInterestQuestionList";
|
||||
|
||||
Reference in New Issue
Block a user