diff --git a/wrenchboard/src/include/mobile.h b/wrenchboard/src/include/mobile.h index a4549702..2b6538aa 100644 --- a/wrenchboard/src/include/mobile.h +++ b/wrenchboard/src/include/mobile.h @@ -10,6 +10,7 @@ long WrenchReturnJobOffersList(CVars in, CVars &out); long WrenchReturnUserProfile(CVars in, CVars &out); long WrenchReturnUserAccount(CVars in, CVars &out); +long WrenchUpdateUserProfile(CVars in, CVars &out); #endif diff --git a/wrenchboard/src/include/wrenchboard_api.h b/wrenchboard/src/include/wrenchboard_api.h index 4924aea4..320f4a98 100644 --- a/wrenchboard/src/include/wrenchboard_api.h +++ b/wrenchboard/src/include/wrenchboard_api.h @@ -251,6 +251,7 @@ enum { PARTNER_STRIPE }; #define WRENCHBOARD_MOBILE_OFFERSLIST 15010 #define WRENCHBOARD_MOBILE_ACTIVEJOB 15020 #define WRENCHBOARD_MOBILE_LOADPROFILE 15030 +#define WRENCHBOARD_MOBILE_UPDATEPROFILE 15031 #define WRENCHBOARD_MOBILE_ACCOUNT 15040 #define WRENCHBOARD_MOBILE_MESSAGE 15045 #define WRENCHBOARD_MOBILE_PAYMENTHX 15046 diff --git a/wrenchboard/src/shared_tool/mobile.cc b/wrenchboard/src/shared_tool/mobile.cc index 15b4744c..ed195f87 100644 --- a/wrenchboard/src/shared_tool/mobile.cc +++ b/wrenchboard/src/shared_tool/mobile.cc @@ -34,7 +34,9 @@ long mobile_calls(CVars in, CVars &out) { case WRENCHBOARD_MOBILE_LOADPROFILE: return WrenchReturnUserProfile(in, out); break; - + case WRENCHBOARD_MOBILE_UPDATEPROFILE: + return long WrenchUpdateUserProfile(in, out); + break; case WRENCHBOARD_MOBILE_ACCOUNT: return WrenchReturnUserAccount(in, out); break; @@ -182,6 +184,32 @@ long WrenchReturnUserProfile(CVars in, CVars &out) { return ret; } +/* This profile apps*/ +long WrenchUpdateUserProfile(CVars in, CVars &out) { + logfmt(logINFO, "WrenchReturnUserProfile()"); + long ret = PHP_API_BAD_PARAM; + + try { + long member_id = REQ_LONG(in, "member_id", 1, -1); + out["total_record"] = "0"; + const PGresult *res; + res = pgsql_query("SELECT * FROM members WHERE id = %lu", member_id ); + + if (res != NULL && pgsql_num_rows(res) > 0) { + out["total_record"] = pgsql_num_rows(res); + mapf = pgsql_fetch_assoc(res, 0); + map_to_cvars(f, out); + ret = PHP_API_OK; + out["status"] = "OK"; + } + + } catch (bad_parameter) { + logfmt(logINFO, "ERROR CALL long WrenchReturnUserProfile(CVars in, CVars &out)"); + } + logfmt(logINFO, "/WrenchReturnUserProfile()"); + return ret; +} + /* This return the list of jobs on the home page of the apps*/ long WrenchReturnJobOffersList(CVars in, CVars &out) { logfmt(logINFO, "WrenchReturnJobOffersList()"); diff --git a/www-api/app/Config/Constants.php b/www-api/app/Config/Constants.php index d1985516..b6b71b56 100644 --- a/www-api/app/Config/Constants.php +++ b/www-api/app/Config/Constants.php @@ -242,7 +242,8 @@ define('WRENCHBOARD_CONTRACT_STATUS', 14015); define('WRENCHBOARD_MOBILE_OFFERSLIST', 15010); define('WRENCHBOARD_MOBILE_ACTIVEJOB', 15020); -define('WRENCHBOARD_MOBILE_LOADPROFILE', 15030); +define('WRENCHBOARD_MOBILE_LOADPROFILE', 15030); +define('WRENCHBOARD_MOBILE_UPDATEPROFILE',15031); define('WRENCHBOARD_MOBILE_ACCOUNT', 15040); define('WRENCHBOARD_MOBILE_MESSAGE', 15045); define('WRENCHBOARD_MOBILE_PAYMENTHX', 15046); diff --git a/www-api/app/Config/Routes.php b/www-api/app/Config/Routes.php index 0f875b9d..f9947fa0 100644 --- a/www-api/app/Config/Routes.php +++ b/www-api/app/Config/Routes.php @@ -53,6 +53,7 @@ $routes->post('/en/wrench/api/v1/getjobsdata', 'WrenchApi::apigate'); $routes->post('/en/wrench/api/v1/offerslist', 'WrenchApi::apigate'); $routes->post('/en/wrench/api/v1/activejoblist', 'WrenchApi::apigate'); $routes->post('/en/wrench/api/v1/loadprofile', 'WrenchApi::apigate'); +$routes->post('/en/wrench/api/v1/updateprofile', 'WrenchApi::apigate'); $routes->post('/en/wrench/api/v1/account', 'WrenchApi::apigate'); $routes->post('/en/wrench/api/v1/message', 'WrenchApi::apigate'); $routes->post('/en/wrench/api/v1/pendingjob', 'WrenchApi::apigate'); diff --git a/www-api/app/Controllers/WrenchApi.php b/www-api/app/Controllers/WrenchApi.php index bed4b75d..01fb501e 100644 --- a/www-api/app/Controllers/WrenchApi.php +++ b/www-api/app/Controllers/WrenchApi.php @@ -42,6 +42,7 @@ class WrenchApi extends BaseController 'offerslist' => ['POST'], 'activejoblist' => ['POST'], 'loadprofile' => ['POST'], + 'updateprofile' => ['POST'], 'account' => ['POST'], 'message' => ['POST'], 'pendingjob' => ['POST'], @@ -223,6 +224,8 @@ class WrenchApi extends BaseController case 'loadprofile': $in["action"] = WRENCHBOARD_MOBILE_LOADPROFILE; break; + case 'updateprofile': $in["action"] = WRENCHBOARD_MOBILE_UPDATEPROFILE; + break; case 'account': $in["action"] = WRENCHBOARD_MOBILE_ACCOUNT; break; case 'getpendingjobs': diff --git a/www-api/public/svs/user/constants.php b/www-api/public/svs/user/constants.php index 2aca604e..3cde64c8 100755 --- a/www-api/public/svs/user/constants.php +++ b/www-api/public/svs/user/constants.php @@ -150,6 +150,7 @@ define('WRENCHBOARD_CONTRACT_STATUS', 14015); define('WRENCHBOARD_MOBILE_OFFERSLIST', 15010); define('WRENCHBOARD_MOBILE_ACTIVEJOB', 15020); define('WRENCHBOARD_MOBILE_LOADPROFILE', 15030); +define('WRENCHBOARD_MOBILE_UPDATEPROFILE',15031); define('WRENCHBOARD_MOBILE_ACCOUNT', 15040); define('WRENCHBOARD_MOBILE_MESSAGE', 15045); define('WRENCHBOARD_MOBILE_PAYMENTHX', 15046); diff --git a/www-api/public/svs/user/formarter.php b/www-api/public/svs/user/formarter.php index 0132c71c..c2cf0136 100755 --- a/www-api/public/svs/user/formarter.php +++ b/www-api/public/svs/user/formarter.php @@ -274,6 +274,29 @@ function processOutJson($in, $out) { break; + case WRENCHBOARD_ACCOUNT_USER_RECIPEINT: + + $total = $out["total_record"]; + $res = array( + "status" => $out["status"], + "total_record" => ($total - 1), + "internal_return" => $out["internal_return"], + "result_list" => array(), + ); + for ($i = 0; $i < $total; $i++) { + $key = sprintf("%05d", $i); + $res["result_list"][] = array( + "recipient" => $out["recipient_${key}"], + "account_no" => $out["account_no_${key}"], + "recipient_id" => $out["id_${key}"], + "recipient_uid" => $out["uid_${key}"], + "country" => $out["country_${key}"], + "added" => $out["added_${key}"] + ); + } + + break; + case WRENCHBOARD_ACCOUNT_WALLETS: $total = $out["total_record"]; $res = array( diff --git a/www-api/public/svs/user/userve.php b/www-api/public/svs/user/userve.php index 356e1c31..09daa53d 100755 --- a/www-api/public/svs/user/userve.php +++ b/www-api/public/svs/user/userve.php @@ -21,6 +21,7 @@ $endpoints = array( 'offerslist' => array('POST'), 'activejoblist' => array('POST'), 'loadprofile' => array('POST'), + 'updateprofile'=> array('POST'), 'account' => array('POST'), 'message' => array('POST'), 'pendingjob' => array('POST'), @@ -256,6 +257,8 @@ switch ($endpoint) { case 'loadprofile': $in["action"] = WRENCHBOARD_MOBILE_LOADPROFILE; break; + case 'updateprofile': $in["action"] = WRENCHBOARD_MOBILE_UPDATEPROFILE; + break; case 'account': $in["action"] = WRENCHBOARD_MOBILE_ACCOUNT; break; case 'getpendingjobs':