private function calMarketingLinkDate() { $this->_log("********* START " . date("Y-m-d H:i:s") . " - Marketing Link Date *********"); //Update Register $date = date("Y-m-d"); // $date = "2015-05-18"; $character_obj = new \HaiQuan\Backend\Models\Character(); $character_banner = $character_obj->getCharacterLinkByDate($date)->toArray(); if (!empty($character_banner)) { foreach ($character_banner as $banner) { if (isset($banner["banner"]) && !empty($banner["banner"])) { $this->updateLinkDate("link_register", $banner["value"], $banner["banner"], $date); } } } //Update Revenue $payment_obj = new \HaiQuan\Backend\Models\Payment(); $payment_revenue = $payment_obj->marketingRevenueDate($date)->toArray(); if (!empty($payment_revenue)) { foreach ($payment_revenue as $revenue) { if (isset($revenue["pid"]) && !empty($revenue["pid"])) { $this->updateLinkDate("link_revenue", $revenue["totalmoney"], $revenue["pid"], $date); } } } //Update Nau $nau_link = $character_obj->nauByPIDAndDate($date)->toArray(); if (!empty($nau_link)) { foreach ($nau_link as $banner) { if (isset($banner["pid"]) && !empty($banner["pid"])) { $this->updateLinkDate("link_nau", $banner["total"], $banner["pid"], $date); } } } //Update PU $payment_revenue = $payment_obj->marketingPUAndDate($date)->toArray(); if (!empty($payment_revenue)) { foreach ($payment_revenue as $revenue) { if (isset($revenue["pid"]) && !empty($revenue["pid"])) { $this->updateLinkDate("link_pu", $revenue["total"], $revenue["pid"], $date); } } } //Update DAU $daus = $character_obj->dauByPIDAndDate($date)->toArray(); if (!empty($daus)) { foreach ($daus as $dau) { if (isset($dau["pid"]) && !empty($dau["pid"])) { $this->updateLinkDate("link_dau", $dau["total"], $dau["pid"], $date); } } } $this->_log("********* END - Marketing Link Date *********"); }