public static function pusher4PopUp($ids) { // IMBAuth::checkOAuth(); // pr($_POST); if ($ids == "") { die("Please insert Customer ID"); } // if($camp_id == "")die("Please insert Campaign ID"); $ps = new PushNotPopUp(); // $arrPS = $ps->getWhere("camp_app_popup = 1 AND camp_active = 1 ORDER BY camp_id DESC LIMIT 0,1"); //berdasarkan request 27 Jan 2016, skrg bisa multiple send push not $arrPS = $ps->getWhere("camp_app_popup = 1 AND camp_active = 1 ORDER BY camp_id DESC"); if (count($arrPS) > 0) { foreach ($arrPS as $ps) { // $ps = $arrPS[0]; // $exp = explode(",", $ids); // $arrAcc = array(); // foreach ($exp as $ac) { // $arrAcc[] = trim(rtrim($ac)); // } //dijadikan singular... $arrAcc = array(); $arrAcc[] = $ids; $_POST['no_echo'] = 1; //from acc get device ID Pusher::sendUsingAccountArray($arrAcc, $ps, 0); //1 for testing } } }
public static function kerjakan($VRO, $dob = "", $acquire = 0) { //print $VRO->saveXML(); $json = array(); //$map = new VRCustMapper($VRO); //pr($map); //pr($VRO->CustomerBody->EntityInformation->Individual->PersonalSummary->BirthDate); //pr($VRO); if ($_GET['test']) { echo "in1" . $dob; } $ll = VRCustMapper::parseToLLAccount($VRO); /* * tambahan 9 nov 2015 * untuk handle kalau tokenstatus != '1' , 4 adalah sdh tidak aktif */ if ($ll->macc_token_status != '1') { //request ulang, tetapi apa yang terjadi kalau request nanti berkali2 ? //request sekali lagi saja ... $VRO = VRCustModel::findByID($ll->macc_id); $ll = VRCustMapper::parseToLLAccount($VRO); } //pr($ll); if ($_GET['test']) { echo "finished : "; pr($ll); } if ($dob != "") { if ($ll->macc_dob != $dob) { $json['status_code'] = 0; $json['status_message'] = Efiwebsetting::getData("Constant_invalid_credential"); echo json_encode($json); die; } } $ll = VRCustMapper::getBeginDate($ll); //pr($ll); if ($_GET['test']) { echo "getbegindate : "; pr($ll); } $statement = VRCustModel::statement($ll, $ll->macc_id, $ll->macc_member_tier); if ($_GET['test']) { echo "statement : "; pr($statement); } /* * $datetime1 = new DateTime('2009-10-11'); $datetime2 = new DateTime('2009-10-13'); $interval = $datetime1->diff($datetime2); pr($interval); */ $parsed_statement = VRCustMapper::parseStatement($statement, $ll); $ll = VRCustMapper::getExpiryDate($ll, $parsed_statement); $ll->statements = $parsed_statement; $ll->statement_cash_total = $parsed_statement->cash_total; $ll->statement_point_total = $parsed_statement->point_total; $ll->statement_total_transaction = $parsed_statement->total_transaction; $ll->macc_acquire = $acquire; //pr($parsed_statement); //pr($statement); //pr($ll); if ($_GET['test']) { echo "getexpiry : "; pr($parsed_statement); echo "ll final sebelum save"; pr($ll); } //request : 6 jan 2016 : firstimer dapat msg $firstime = 0; //save tanggal acquire if ($ll->macc_acquire_date == "0000-00-00 00:00:00" || $ll->macc_acquire_date == "") { $ll->macc_acquire_date = leap_mysqldate(); //request : 6 jan 2016 : firstimer dapat msg $firstime = 1; } $ll->macc_login_date = leap_mysqldate(); //update lyb_expiry_date // update database // insert on duplicate key updates $succ = $ll->save(1); if ($succ) { //request : 6 jan 2016 : firstimer dapat msg //send msg here if ($firstime) { $_POST['acc_id'] = $ll->macc_id; $_POST['no_echo'] = 1; $pnw = new PushNotWeb(); $pnw->save(); PushNotPopUp::pusher4PopUp($ll->macc_id); } //logged all login 19 nov 2015 roy $logged = new LL_AccountLogger(); $logged->log_acc_id = $ll->macc_id; $logged->log_date = leap_mysqldate(); $logged->save(); if ($_GET['test']) { echo "succ : " . $succ; pr($ll); } $json['status_code'] = 1; $obj = $ll; $obj->default_read_coloms = $obj->crud_webservice_allowed; $main_id = $obj->main_id; $exp = explode(",", $obj->crud_webservice_allowed); $sem = array(); foreach ($exp as $attr) { if (!isset($obj->{$attr}) || $obj->{$attr} == NULL) { $obj->{$attr} = 0; } $sem[$attr] = $obj->{$attr}; } $json['results'] = $sem; return $json; //echo json_encode($json); //die(); } else { $json['status_code'] = 0; $json['status_message'] = "Save Failed"; echo json_encode($json); die; } }