Пример #1
0
 public function calMarketingLinkAction()
 {
     $this->_log("*********  START " . date("Y-m-d H:i:s") . " - Marketing Link *********");
     //Update Register
     $character_obj = new \HaiQuan\Backend\Models\Character();
     $character_banner = $character_obj->getCharacterLink()->toArray();
     $link = new \HaiQuan\Backend\Models\Link();
     if (!empty($character_banner)) {
         foreach ($character_banner as $banner) {
             if (isset($banner["banner"]) && !empty($banner["banner"])) {
                 $link->updateLinkByID(array("link_register" => $banner["value"]), base64_decode($banner["banner"]));
             }
         }
     }
     //Update Revenue
     $payment_obj = new \HaiQuan\Backend\Models\Payment();
     $payment_revenue = $payment_obj->marketingRevenue()->toArray();
     if (!empty($payment_revenue)) {
         foreach ($payment_revenue as $revenue) {
             if (isset($revenue["pid"]) && !empty($revenue["pid"])) {
                 $link->updateLinkByID(array("link_revenue" => $revenue["totalmoney"]), base64_decode($revenue["pid"]));
             }
         }
     }
     //Update Nau
     $nau_link = $character_obj->nauByPID()->toArray();
     if (!empty($nau_link)) {
         foreach ($nau_link as $banner) {
             if (isset($banner["pid"]) && !empty($banner["pid"])) {
                 $link->updateLinkByID(array("link_nau" => $banner["total"]), base64_decode($banner["pid"]));
             }
         }
     }
     //Update PU
     $payment_revenue = $payment_obj->marketingPU()->toArray();
     if (!empty($payment_revenue)) {
         foreach ($payment_revenue as $revenue) {
             if (isset($revenue["pid"]) && !empty($revenue["pid"])) {
                 $link->updateLinkByID(array("link_pu" => $revenue["total"]), base64_decode($revenue["pid"]));
             }
         }
     }
     $this->_log("********* END - Marketing Link *********");
     $this->calMarketingLinkDate();
     //  $this->sendNotice();
     echo "success";
     exit;
 }