71 lines
2.4 KiB
PHP
71 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
use CodeIgniter\API\ResponseTrait;
|
|
|
|
class WrenchAccount extends BaseController
|
|
{
|
|
use ResponseTrait;
|
|
|
|
public function CreateNewAccount(){
|
|
/*
|
|
array (size=10)
|
|
'firstname' => string 'OluNG' (length=5)
|
|
'lastname' => string 'AmeyNG' (length=6)
|
|
'email' => string 'ameye+auglonger3646@chiefsoft.com' (length=33)
|
|
'username' => string 'ameye+auglonger3646@chiefsoft.com' (length=33)
|
|
'password' => string 'may12002' (length=8)
|
|
'terms' => int 1
|
|
'news' => int 1
|
|
'loc' => string '38.101.241.200' (length=14)
|
|
'country' => string 'NG' (length=2)
|
|
'action' => int 11010
|
|
*/
|
|
$out=[];
|
|
|
|
$raw_json = file_get_contents('php://input');
|
|
$raw_array = json_decode($raw_json, true);
|
|
$in = $raw_array;
|
|
|
|
$in["action"] = WRENCHBOARD_ACCOUNT_PENDING;
|
|
$in["street1"] = $in["streetaddress"];
|
|
$in["zipcode"] = $in["zip"];
|
|
if (!isset($in["country"]) || $in["country"]==""){
|
|
$in["country"] = "US";
|
|
}
|
|
$in["loc"] = $_SERVER["REMOTE_ADDR"];
|
|
$in["mobile"] = "MOBILE";
|
|
|
|
// $wrenchboard = new \App\Models\BackendModel();
|
|
$ret = $this->wrenchboard->wrenchboard_api($in, $out);
|
|
$out['internal_return'] = $ret;
|
|
|
|
return $this->respond( $this->summaryReturnData($in,$out), 200);
|
|
|
|
// return $this->summaryReturnData($in,$out); //json_encode( $final_out );
|
|
|
|
}
|
|
|
|
public function loadRefer(){
|
|
$out=[];
|
|
$raw_json = file_get_contents('php://input');
|
|
$raw_array = json_decode($raw_json, true);
|
|
$in = $raw_array;
|
|
$in["action"] = WRENCHBOARD_LOAD_REFERLINK;
|
|
$in["action_path"] = 100;
|
|
$in["loc"] = $_SERVER["REMOTE_ADDR"];
|
|
if (isset($in["path"]) && $in["path"] == 'promoref'){
|
|
$in["refer_link"] = str_replace('REFPROMO-', "", $in["refer_link"]);
|
|
$in["action_path"] = 200;
|
|
}
|
|
|
|
$endpoint = "REFER_LINK-". $in["action_path"]."-". str_replace('-','_', $in["refer_link"]);// $in[""];
|
|
$out = $this->getCache($endpoint);
|
|
if ( count($out)==0 ){
|
|
$ret = $this->wrenchboard->wrenchboard_api($in, $out);
|
|
$out['internal_return'] = $ret;
|
|
$this->saveCache($endpoint,$out,360);
|
|
}
|
|
return $this->respond( $this->summaryReturnData($in,$out), 200);
|
|
}
|
|
} |