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


PHP Meta::all方法代码示例

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


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

示例1: fbapps

 /**
  * @before _secure, changeLayout, _admin
  */
 public function fbapps()
 {
     $this->seo(array("title" => "FBApps", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     if (RequestMethods::post("action") == "fbapps") {
         $fbapp = new Meta(array("user_id" => $this->user->id, "property" => "fbapp", "value" => RequestMethods::post("fbapp")));
         $fbapp->save();
         $view->set("message", "FBApp Added Successfully");
     }
     $fbapps = Meta::all(array("property=?" => "fbapp"));
     $view->set("fbapps", $fbapps);
 }
开发者ID:SwiftDeal,项目名称:fbfunapp,代码行数:15,代码来源:items.php

示例2: importCampaigns

 /**
  * Process the Meta table for campaign urls and create the
  * campaign from the corresponding URL
  */
 protected function importCampaigns()
 {
     $metas = \Meta::all(['prop = ?' => 'campImport']);
     $users = [];
     $orgs = [];
     foreach ($metas as $m) {
         $user = Usr::find($users, $m->propid, ['_id', 'org_id', 'email', 'meta']);
         $org = \Organization::find($orgs, $user->org_id);
         $categories = \Category::all(['org_id' => $org->_id], ['_id', 'name']);
         $categories = array_values($categories);
         $category = $categories[array_rand($categories)];
         // fetch ad info foreach URL
         $advert_id = $m->value['advert_id'];
         $comm = $m->value['campaign'] ?? $org->meta;
         if (!isset($comm['model']) || !isset($comm['rate'])) {
             continue;
         }
         $urls = $m->value['urls'];
         foreach ($urls as $url) {
             $ad = \Ad::first(['org_id' => $org->_id, 'url' => $url]);
             if ($ad) {
                 continue;
             }
             // already crawled URL may be due to failed cron earlier
             $data = Utils::fetchCampaign($url);
             $image = Utils::downloadImage($data['image']);
             if (!$image) {
                 $image = '';
             }
             $ad = new \Ad(['user_id' => $advert_id, 'org_id' => $org->_id, 'title' => $data['title'], 'description' => $data['description'], 'url' => $url, 'image' => $image, 'category' => [$category->_id], 'type' => 'article', 'live' => false, 'device' => ['ALL']]);
             if ($ad->validate()) {
                 $ad->save();
                 $rev = $comm['revenue'] ?? 1.25 * (double) $comm['rate'];
                 $commission = new \Commission(['ad_id' => $ad->_id, 'model' => $comm['model'], 'rate' => $comm['rate'], 'revenue' => round($rev, 6), 'coverage' => ['ALL']]);
                 $commission->save();
             } else {
                 var_dump($ad->getErrors());
             }
         }
         $msg = 'Campaigns imported for the user: ' . $user->email;
         $this->log($msg);
         $m->delete();
     }
 }
开发者ID:vNative,项目名称:vnative,代码行数:48,代码来源:cron.php


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