From 41c485f7aa7dbd3d2418cd209802d19a17bc5182 Mon Sep 17 00:00:00 2001 From: "DESKTOP-GBA0BK8\\Admin" Date: Sun, 16 Apr 2023 15:25:28 -0400 Subject: [PATCH] Case added --- www-api/app/Controllers/WrenchApi.php | 189 +++++++++++++++++++++++++- 1 file changed, 185 insertions(+), 4 deletions(-) diff --git a/www-api/app/Controllers/WrenchApi.php b/www-api/app/Controllers/WrenchApi.php index 51d725c2..96e03c1b 100644 --- a/www-api/app/Controllers/WrenchApi.php +++ b/www-api/app/Controllers/WrenchApi.php @@ -68,9 +68,189 @@ class WrenchApi extends BaseController 'disableaccount' => ['POST'], 'myjobs' => ['POST'] ]; -return $endpoints; + return $endpoints; } + private function prepareEndPointData($endpoint, $in, &$call_backend=true){ + switch ($endpoint) { + case 'disableaccount': + $in['action'] = WRENCHBOARD_USER_DELETEACC; + break; + case 'replyinterestmessage': + $in["action"] = WRENCHBOARD_JOB_REPLY_QUESTION; + break; + case 'sendinterestmessage': + // $in['offer_code'] = $this->input->get('offer_code'); + $in['yourmessage'] = $in["question"]; + //$in['member_id'] = $_SESSION['member_id']; // just maing sure + $in['msg_type'] = 'JOB'; + // $in['action'] = WRENCHBOARD_JOB_SEND_QUESTION; + + $in["action"] = WRENCHBOARD_JOB_SEND_QUESTION; + break; + case 'couponredeem': + $in["action"] = WRENCHBOARD_COUPON_REDEEM; + break; + case 'couponpending': + $in["action"] = WRENCHBOARD_COUPON_PENDLIST; + break; + case 'couponhx': + $in["action"] = WRENCHBOARD_COUPON_MEMLIST; + break; + case 'signupcountry': + // checi if in cache if not read + $local_out = [ + 'result'=>'100', + 'signup_country'=>[ + ['NG', 'Nigeria'], + ['US', 'United States'] + ] + ]; + $call_backend = false; + break; + case 'blogitem': + $blogData = getBlogItem(); + $local_out = [ + 'result'=>'100', + 'blog_data'=> $blogData + ]; + $call_backend = false; + break; + case 'blogdata': + $blogData = getBlogData(); + $local_out = [ + 'result'=>'100', + 'blog_data'=> $blogData + ]; + $call_backend = false; + break; + case 'userscards': + $in["action"] = WRENCHBOARD_CARDS_GETCARDLIST; + $local_out = [ + 'result'=>'100', + 'result_list'=>[ + ['title'=>'This is your coupon', + 'description'=>'This is the description of the description', + 'card_type'=>'COUPON', + 'card_style' =>'card1', + 'card_icon' =>'icon1', + 'assign_id'=> 0, + 'Nigeria'], + ['title'=>'A Recommended Story', + 'description'=>'This is the description of the description', + 'card_type'=>'BLOG', + 'card_style' =>'card2', + 'card_icon' =>'icon1', + 'assign_id'=> 0, + 'United States'], + ['title'=>'You have a new task sent to you', + 'description'=>'This is the description of the description', + 'card_type'=>'NEWTASK', + 'card_style' =>'card1', + 'card_icon' =>'icon1', + 'assign_id'=> 0, + 'United States'], + ['title'=>'You just Earned some token', + 'description'=>'This is the description of the description', + 'card_type'=>'TOKEN', + 'card_style' =>'card2', + 'card_icon' =>'icon1', + 'assign_id'=> 0, + 'United States'] + ] + ]; + // $call_backend = false; + + break; + case 'myjobs': $in["action"] = WRENCHBOARD_ACCOUNT_JOBLIST; + break; + case 'sitecontact': + $local_out = ['result'=>'100','msg'=>'Received']; + $call_backend = false; + break; + case 'generics': + case 'apigate': + //$in["action"] = WRENCHBOARD_ACCOUNT_LOGIN; + break; + case 'startjoblist': $in["action"] = WRENCHBOARD_START_JOBLIST; + if (!array_key_exists("limit",$in)) $in["limit"] = 10; + if (!array_key_exists("page",$in)) $in["page"] = 1; + break; + + case 'createmobileuser': $in["action"] = WRENCHBOARD_CREATE_MOBILEUSER; + $in["loc"] = $_SERVER["REMOTE_ADDR"]; + $in["news"] = 0; + $in["terms"] = 1; + $in["mobile"] = "MOBILE"; + break; + case 'completemobileuser': $in["action"] = WRENCHBOARD_COMPLETE_MOBILEUSER; + $in["loc"] = $_SERVER["REMOTE_ADDR"]; + break; + + case 'startresetpasword': + $in["action"] = WRENCHBOARD_RESET_PASSWORD; + break; + case 'createuser': $in["action"] = WRENCHBOARD_ACCOUNT_PENDING; + $in["street1"] = $in["streetaddress"]; + $in["zipcode"] = $in["zip"]; + $in["country"] = "US"; + $in["loc"] = $_SERVER["REMOTE_ADDR"]; + $in["mobile"] = "MOBILE"; + break; + case 'activejoblist': $in["action"] = WRENCHBOARD_MOBILE_ACTIVEJOB; + break; + case 'message': $in["action"] = WRENCHBOARD_MOBILE_MESSAGE; + + break; + case 'paymenthx': $in["action"] = WRENCHBOARD_MOBILE_PAYMENTHX; + + break; + case 'getjobsdata': $in["action"] = WRENCHBOARD_ACCOUNT_JOBLIST; + break; + + case 'userlogin': $in["action"] = WRENCHBOARD_ACCOUNT_LOGIN; + $in["login_mode"] = MOBILE_LOGIN; + break; + + case 'dashdata': $in["action"] = WRENCHBOARD_ACCOUNT_DASHDATA; + break; + case 'offerslist': $in["action"] = WRENCHBOARD_MOBILE_OFFERSLIST; + break; + + case 'loadprofile': $in["action"] = WRENCHBOARD_MOBILE_LOADPROFILE; + break; + case 'account': $in["action"] = WRENCHBOARD_MOBILE_ACCOUNT; + break; + case 'getpendingjobs': + $in["action"] = WRENCHBOARD_ACCOUNT_PENDJOB; + break; + case 'pendingjob': + + break; + case 'getjob': + + break; + + case 'mybanklist':$in["action"] = WRENCHBOARD_USER_GETBANKLIST; + break; + case 'sendmoney':$in["action"] = WRENCHBOARD_USER_SENDMONEY; + $out["internal_return"] = 0; + break; + case 'sendinterest':$in["action"] = WRENCHBOARD_USER_SENDJOBINT; + $out["internal_return"] = 0; + break; + case 'sendmoneyfee': $in["action"] = WRENCHBOARD_SMONEY_PROCFEE; + break; + case 'taskmessage': $in["action"] = WRENCHBOARD_MOBILE_TASKMESSAGE; + break; + case 'sendtaskmessage': $in["action"] = WRENCHBOARD_MOBILE_SENDTASKMESSAGE; + break; + + case 'getwallets': $in["action"] = WRENCHBOARD_ACCOUNT_WALLETS; + break; + } + return $in; + } public function apigate(){ //$request = service('request'); @@ -123,10 +303,11 @@ return $endpoints; //-- move to another module start $call_backend = true; $in["loc"] = $_SERVER["REMOTE_ADDR"]; + $in = $this->prepareEndPointData($endpoint, $in,$call_backend); - $raw_array =[]; - $res1 = $this->dummyData($raw_array); - return $this->response->setJson($res1); + // $raw_array =[]; + $res1 = $this->dummyData($in); + return $this->response->setJson($res1); } public function apigateDELAY(){