country list
This commit is contained in:
@@ -58,9 +58,10 @@ long WrenchDeleteUsersCCard(CVars in, CVars &out);
|
||||
long WrenchFlutterCreditHook(CVars in, CVars &out);
|
||||
long WrenchBoardTopupResult(CVars in, CVars &out);
|
||||
long WrenchRegisterMyFileUpload(CVars in, CVars &out);
|
||||
long WrenchSignUpCountry(CVars in, CVars &out);
|
||||
long WrenchGetRecentDash(CVars in, CVars &out);
|
||||
long LoginWrenchBoardQRAccount(CVars in, CVars &out);
|
||||
long WrenchBoardFamilyAccMemberID(CVars in, CVars &out);
|
||||
long LoginWrenchBoardQRAccount(CVars in, CVars &out);
|
||||
long WrenchBoardFamilyAccMemberID(CVars in, CVars &out);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ enum { PARTNER_STRIPE };
|
||||
#define WRENCHBOARD_USER_LOGOUT 301
|
||||
#define WRENCHBOARD_CREATE_ACCOUNT 320
|
||||
|
||||
|
||||
#define WRENCHBOARD_SIGNUP_COUNTRY 648
|
||||
#define WRENCHBOARD_GET_MEDIA 650
|
||||
#define WRENCHBOARD_SAVE_MEDIA 652
|
||||
|
||||
|
||||
@@ -586,6 +586,66 @@ logfmt(logINFO, "WrenchGetRecentDash()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
Called directly for country list at signup
|
||||
|
||||
wrenchboard=> SELECT code,country,phone_code,jobs FROM country
|
||||
WHERE allow is not null AND status = 1 ORDER BY country ASC;
|
||||
code | country | phone_code | jobs
|
||||
------+---------------+------------+----------------------------
|
||||
GH | Ghana | 233 |
|
||||
NG | Nigeria | 234 | 2022-04-09 20:43:48.007359
|
||||
US | United States | 1 |
|
||||
(3 rows)
|
||||
|
||||
*/
|
||||
long WrenchSignUpCountry(CVars in, CVars &out) {
|
||||
char vname[30];
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
logfmt(logINFO, "WrenchSignUpCountry()");
|
||||
|
||||
|
||||
try {
|
||||
out["total_record"] = "0";
|
||||
const PGresult *res;
|
||||
res = pgsql_query("SELECT code,country,phone_code,jobs,uid FROM country "
|
||||
" WHERE allow is not null AND status = 1 ORDER BY country ASC");
|
||||
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
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);
|
||||
|
||||
snprintf(vname, sizeof (vname), "code_%05d", i);
|
||||
out[vname] = rec["code"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "country_%05d", i);
|
||||
out[vname] = rec["country"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "phone_code_%05d", i);
|
||||
out[vname] = rec["phone_code"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "jobs_%05d", i);
|
||||
out[vname] = rec["jobs"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "uid_%05d", i);
|
||||
out[vname] = rec["uid"];
|
||||
|
||||
}
|
||||
}
|
||||
ret = PHP_API_OK;
|
||||
out["status"] = "OK";
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL long WrenchSignUpCountry(CVars in, CVars &out)");
|
||||
}
|
||||
logfmt(logINFO, "/WrenchSignUpCountry()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
long WrenchRegisterMyFileUpload(CVars in, CVars &out) {
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
logfmt(logINFO, "WrenchRegisterMyFileUpload()");
|
||||
|
||||
@@ -56,6 +56,9 @@ long wrenchboard_api_main(CVars in, CVars &out) {
|
||||
return SendSMSMessage(in, out);
|
||||
}
|
||||
|
||||
if(action == WRENCHBOARD_SIGNUP_COUNTRY){
|
||||
return WrenchSignUpCountry(in, out);
|
||||
}
|
||||
|
||||
if( action == WRENCHBOARD_SAVE_MEDIA ){
|
||||
return WrenchSaveStoredMedia(in, out);
|
||||
|
||||
@@ -145,6 +145,7 @@ define('CONTRACT_REQUEST_TIMELINE', 2);
|
||||
define('CONTRACT_ACCEPT_COMPLETE', 5);
|
||||
define('CONTRACT_REJECT_COMPLETE', 1);
|
||||
|
||||
const WRENCHBOARD_SIGNUP_COUNTRY = 648;
|
||||
const WRENCHBOARD_GET_MEDIA = 650;
|
||||
const WRENCHBOARD_SAVE_MEDIA = 652;
|
||||
|
||||
|
||||
@@ -248,6 +248,7 @@ class WrenchApi extends BaseController
|
||||
$in["action"] = WRENCHBOARD_COUPON_MEMLIST;
|
||||
break;
|
||||
case 'signupcountry':
|
||||
$in["action"] = WRENCHBOARD_SIGNUP_COUNTRY;
|
||||
// checi if in cache if not read
|
||||
$local_out = [
|
||||
'result'=>'100',
|
||||
@@ -256,7 +257,7 @@ class WrenchApi extends BaseController
|
||||
['US', 'United States']
|
||||
]
|
||||
];
|
||||
$call_backend = false;
|
||||
// $call_backend = true; we will call backend
|
||||
break;
|
||||
case 'blogitem':
|
||||
$blogData = (new \App\Models\ResultFormatter() )->getBlogItem();
|
||||
|
||||
@@ -497,6 +497,28 @@ class ResultFormatter extends Model
|
||||
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_SIGNUP_COUNTRY:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
'result'=>'100',
|
||||
'signup_country'=>[ ['NG', 'Nigeria'],['US', 'United States'] ],
|
||||
"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(
|
||||
"code" => $out["code_${key}"],
|
||||
"country" => $out["country_${key}"],
|
||||
"phone_code" => $out["phone_code_${key}"],
|
||||
"uid"=> $out["uid_${key}"],
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
case WRENCHBOARD_MOBILE_TASKMESSAGE:
|
||||
|
||||
$total = $out["total_record"];
|
||||
|
||||
Reference in New Issue
Block a user