public function __construct() { $this->user = User::getInstance(); $this->session = Session::getInstance(); $this->trackingUtils = TrackingUtils::getInstance(); $this->user->auth('*****@*****.**', 'tenant'); }
$utils = Utils::getInstance(); $trackUtils = TrackingUtils::getInstance(); $json = $utils->iJsonDoc($app->request()->post('json'), 255); $track = ['user_id' => $json->user_id, 'phone_id' => $json->phone_id, 'event' => $json->event, 'target' => $json->target, 'description' => $json->description]; $res = $trackUtils->addTrack($track); $err = $res == false ? '' : $session->flushError(); $res = $res == false ? 'false' : $res; $res = ['req' => 'trckrj', 'res' => $res, 'err' => $err]; print json_encode($res); header('Content-Type: application/json'); return; }); $app->post('/trckr/', function () use($app) { $session = Session::getInstance(); $utils = Utils::getInstance(); $trackUtils = TrackingUtils::getInstance(); $uid = $utils->iStr($app->request()->post('user_id'), 64); $pid = $utils->iStr($app->request()->post('phone_id'), 64); $event = $utils->iStr($app->request()->post('event'), 256); $target = $utils->iStr($app->request()->post('target'), 256); $description = $utils->iStr($app->request()->post('description'), 256); $track = ['user_id' => $uid, 'phone_id' => $pid, 'event' => $event, 'target' => $target, 'description' => $description]; $res = $trackUtils->addTrack($track); $err = false == $res ? '' : $session->flushError(); $res = false == $res ? 'false' : $res; $res = ['req' => 'trackr', 'res' => $res, 'err' => $err]; print json_encode($res); header('Content-Type: application/json'); return; }); $app->get('/social/', function () use($app) {