164 lines
5.5 KiB
PHP
164 lines
5.5 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
class WrenchFamily extends BaseController
|
|
{
|
|
|
|
public function __construct()
|
|
{
|
|
$this->request = $request = \Config\Services::request();
|
|
}
|
|
public function index()
|
|
{
|
|
return [];
|
|
}
|
|
|
|
public function familyConnectMembers(){
|
|
|
|
$raw_json = file_get_contents('php://input');
|
|
$in = json_decode($raw_json, true);
|
|
$out =[];
|
|
|
|
$in["action"] = 0;
|
|
$endpoint = "FAMILY_CONNECT_MEMBERS-". $in["family_uid"]; // str_pad($in["uid"], 12, "0", STR_PAD_LEFT);
|
|
$out = $this->getCache($endpoint); // try find in cache
|
|
if ( count($out) == 0 ){
|
|
$local_url = "http://".$this->micro_service_net1.":3032/familyConnectMembers";
|
|
$out = $this->APIcall('GET', $local_url, $in);
|
|
log_message('critical', "familyConnectMembers ********* ALL ".serialize($out["result_list"]) );
|
|
log_message('critical', "familyConnectMembers ********* COUNT ".serialize(count($out["result_list"])) );
|
|
$this->saveCache($endpoint,$out,1500);
|
|
}
|
|
return $this->summaryReturnData($in,$out); //json_encode( $final_out );
|
|
|
|
}
|
|
|
|
public function familyConnectInvite(){
|
|
|
|
$raw_json = file_get_contents('php://input');
|
|
$in = json_decode($raw_json, true);
|
|
$out =[];
|
|
|
|
// $in["action"] = WRENCHBOARD_RELATIVES_EDITKIDS;
|
|
// $ret = $this->wrenchboard->wrenchboard_api($in, $out);
|
|
|
|
$out["current_invitation"] =[
|
|
[
|
|
"name" => "Faith",
|
|
"time" => "0000-00-00",
|
|
"expire" => 1000
|
|
]
|
|
];
|
|
$out["allow_invite"] = 100;
|
|
$out['internal_return'] = 0;
|
|
|
|
return $this->summaryReturnData($in,$out);
|
|
}
|
|
public function familyConnect(){
|
|
|
|
$raw_json = file_get_contents('php://input');
|
|
$in = json_decode($raw_json, true);
|
|
$out =[];
|
|
|
|
// $in["action"] = WRENCHBOARD_RELATIVES_EDITKIDS;
|
|
// $ret = $this->wrenchboard->wrenchboard_api($in, $out);
|
|
|
|
$out["current_invitation"] =[
|
|
[
|
|
"name" => "Faith",
|
|
"time" => "0000-00-00",
|
|
"expire" => 1000
|
|
]
|
|
];
|
|
$out["allow_invite"] = 100;
|
|
$out['internal_return'] = 0;
|
|
|
|
return $this->summaryReturnData($in,$out);
|
|
}
|
|
public function relativeEditKids(){
|
|
$raw_json = file_get_contents('php://input');
|
|
$in = json_decode($raw_json, true);
|
|
$out =[];
|
|
|
|
$in["action"] = WRENCHBOARD_RELATIVES_EDITKIDS;
|
|
$ret = $this->wrenchboard->wrenchboard_api($in, $out);
|
|
$out['internal_return'] = $ret;
|
|
|
|
return $this->summaryReturnData($in,$out);
|
|
}
|
|
public function relativeSettings(){
|
|
$raw_json = file_get_contents('php://input');
|
|
$in = json_decode($raw_json, true);
|
|
$out =[];
|
|
|
|
$in["action"] = WRENCHBOARD_RELATIVES_SETTINGS;
|
|
$ret = $this->wrenchboard->wrenchboard_api($in, $out);
|
|
$out['internal_return'] = $ret;
|
|
|
|
return $this->summaryReturnData($in,$out);
|
|
}
|
|
public function relativeReminder(){
|
|
$raw_json = file_get_contents('php://input');
|
|
$in = json_decode($raw_json, true);
|
|
$out =[];
|
|
|
|
$in["action"] = WRENCHBOARD_RELATIVES_REMINDER;
|
|
$ret = $this->wrenchboard->wrenchboard_api($in, $out);
|
|
$out['internal_return'] = $ret;
|
|
|
|
return $this->summaryReturnData($in,$out);
|
|
}
|
|
|
|
public function familyBanners(){
|
|
|
|
$raw_json = file_get_contents('php://input');
|
|
$in = json_decode($raw_json, true);
|
|
|
|
$in["action"] = WRENCHBOARD_FAMILY_HOMEBANNERS;
|
|
$endpoint = "FAMILY_BANNERS-". $in["uid"]; // str_pad($in["uid"], 12, "0", STR_PAD_LEFT);
|
|
$out = $this->getCache($endpoint); // try find in cache
|
|
if ( count($out) == 0 ){
|
|
$local_url = "http://".$this->micro_service_net1.":3032/familybanners";
|
|
$out = $this->APIcall('GET', $local_url, $in);
|
|
log_message('critical', "familyBanners ********* ALL ".serialize($out["result_list"]) );
|
|
log_message('critical', "familyBanners ********* COUNT ".serialize(count($out["result_list"])) );
|
|
$this->saveCache($endpoint,$out,1500);
|
|
}
|
|
return $this->summaryReturnData($in,$out); //json_encode( $final_out );
|
|
}
|
|
|
|
public function familySampleTasks(){
|
|
|
|
$raw_json = file_get_contents('php://input');
|
|
$in = json_decode($raw_json, true);
|
|
|
|
$in["action"] = WRENCHBOARD_FAMILY_SAMPLETASKS;
|
|
$endpoint = "FAMILY_SAMPLE_TASKS";
|
|
$out = $this->getCache($endpoint);
|
|
if ( count($out) == 0 ){
|
|
$ret = $this->wrenchboard->wrenchboard_api($in, $out);
|
|
$out['internal_return'] = $ret;
|
|
if ($ret == 0)
|
|
$this->saveCache($endpoint,$out,65000);
|
|
}
|
|
return $this->summaryReturnData($in,$out); //json_encode( $final_out );
|
|
}
|
|
|
|
|
|
public function familyRewardHx(){
|
|
|
|
$raw_json = file_get_contents('php://input');
|
|
$in = json_decode($raw_json, true);
|
|
|
|
$in["action"] = WRENCHBOARD_FAMILY_TRANSFERHX;
|
|
$endpoint = "FAMILY_REWARD_HX-". $in["uid"]; // str_pad($in["uid"], 12, "0", STR_PAD_LEFT);
|
|
$out = $this->getCache($endpoint); // try find in cache
|
|
if ( count($out) == 0 ){
|
|
$ret = $this->wrenchboard->wrenchboard_api($in, $out);
|
|
$out['internal_return'] = $ret;
|
|
$this->saveCache($endpoint,$out,1000);
|
|
}
|
|
return $this->summaryReturnData($in,$out); //json_encode( $final_out );
|
|
}
|
|
} |