public function createDummyData() { // die("tidak active"); ?> <h1>Create Device Logger</h1> <?php $dev = new DeviceLogger(); // $dev->getByID(1); // $type = array("android","ios"); for ($x = 0; $x < 100; $x++) { //random if ada account atau tidak $adaAcc = rand(0, 9); if ($adaAcc > 6) { $accID = 0; } else { $acc = new LL_Account(); $r = rand(0, 113); $arrAcc = $acc->getOrderBy("macc_id ASC LIMIT {$r},1"); $accku = $arrAcc[0]; $accID = $accku->macc_id; } //random type $type = "ios"; $rtype = rand(0, 9); if ($rtype > 2) { $type = "android"; } $minusan = 12620550 - $x * 100; // $minusan = 75000; //random date $int = mt_rand(time() - $minusan, time()); $log = new DeviceLogger(); $log->log_acc_id = $accID; $log->log_dev_id = "dev_" . $accID; $log->log_dev_type = $type; $log->log_date = date("Y-m-d H:i:s", $int); echo $log->save(); if ($accID) { $accl = new LL_AccountLogger(); $accl->log_acc_id = $accID; $accl->log_date = date("Y-m-d H:i:s", $int); echo $accl->save(); } } }
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); } //save tanggal acquire if ($ll->macc_acquire_date == "0000-00-00 00:00:00" || $ll->macc_acquire_date == "") { $ll->macc_acquire_date = leap_mysqldate(); } $ll->macc_login_date = leap_mysqldate(); //update lyb_expiry_date // update database // insert on duplicate key updates $succ = $ll->save(1); if ($succ) { //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; } }