当前位置: 首页>>代码示例>>PHP>>正文


PHP Meta::campImport方法代码示例

本文整理汇总了PHP中Meta::campImport方法的典型用法代码示例。如果您正苦于以下问题:PHP Meta::campImport方法的具体用法?PHP Meta::campImport怎么用?PHP Meta::campImport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Meta的用法示例。


在下文中一共展示了Meta::campImport方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _import

 protected function _import($org, $advertisers, &$view)
 {
     if (!isset($org->meta['model']) || !isset($org->meta['rate'])) {
         return $view->set('message', 'Please update <a href="/admin/settings">Commission Settings</a>');
     }
     $a = array_values($advertisers)[0];
     $advert_id = RM::post('advert_id', $a->getMongoID());
     $advert = \User::first(['_id = ?' => $advert_id, 'type = ?' => 'advertiser']);
     if (!$advert) {
         return $view->set('message', 'Invalid Request!!');
     }
     if (!isset($advert->meta['campaign'])) {
         return $view->set('message', 'Please Update Advertiser campaign settings!!');
     }
     $csv = $_FILES['csv'];
     $tmp = $csv['tmp_name'];
     if ($csv['type'] !== 'text/csv') {
         return $view->set('message', 'Invalid CSV file!!');
     }
     $file = APP_PATH . '/uploads/' . uniqid() . '.csv';
     if ($csv['error'] > 0 || !move_uploaded_file($tmp, $file)) {
         return $view->set('message', 'Error uploading csv file!!');
     }
     $fp = fopen($file, 'r');
     $urls = [];
     while (($line = fgetcsv($fp)) !== false) {
         $link = $line[0];
         if (!$link) {
             continue;
         }
         $urls[] = $link;
     }
     fclose($fp);
     unlink($file);
     \Meta::campImport($this->user->_id, $advert_id, $urls);
     $view->set('message', 'Campaigns Imported we will process them within an hour!!');
 }
开发者ID:vNative,项目名称:vnative,代码行数:37,代码来源:campaign.php

示例2: _rssFeed

 /**
  * Process the RSS Feed Urls from Platforms Table and queue the AD
  * urls in the Meta Table for campaign importing
  */
 protected function _rssFeed()
 {
     // find all the platforms for the advertisers
     $orgs = \Organization::all([], ['_id']);
     foreach ($orgs as $o) {
         $platforms = \Platform::rssFeeds($o);
         // get feed for each platform
         foreach ($platforms as $p) {
             $meta = $p->meta;
             $rss = $meta['rss'];
             // parsing is stopped
             if (!$rss['parsing']) {
                 continue;
             }
             $lastCrawled = null;
             if (isset($rss['lastCrawled'])) {
                 $lastCrawled = $rss['lastCrawled'];
             }
             $result = \Shared\Rss::getFeed($rss['url'], $lastCrawled);
             $urls = $result['urls'];
             $rss['lastCrawled'] = $result['lastCrawled'];
             $meta['rss'] = $rss;
             $p->meta = $meta;
             $p->save();
             // save the lastCrawled time
             $user = \User::first(['org_id' => $o->_id, 'type' => 'admin'], ['_id']);
             \Meta::campImport($user->_id, $p->user_id, $result['urls'], $rss['campaign']);
         }
     }
 }
开发者ID:vNative,项目名称:vnative,代码行数:34,代码来源:cron.php


注:本文中的Meta::campImport方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。