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


PHP Network::put方法代码示例

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


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

示例1: adjustHouseAdNetwork

 public function adjustHouseAdNetwork($add_ahid, $del_ahid)
 {
     $retVal = "doNothing";
     fb("adjusthouseAdNet", "start");
     $networks = $this->getNetworks();
     if ($networks != null) {
         foreach ($networks as $type => $network) {
             if ($type == Network::NETWORK_TYPE_HOUSE) {
                 $houseAdNet = $network;
             }
         }
     }
     $appHouseAds = AppHouseAdUtil::getAppHouseAdsByAid($this->id);
     $count = count($appHouseAds);
     if ($count == 0 && $add_ahid != null) {
         $count++;
     } else {
         if ($count == 1 && $appHouseAds['0']->id == $del_ahid) {
             $count--;
         }
     }
     fb("appHouseAds", $appHouseAds);
     fb($count, 'count');
     fb(isset($houseAdNet), 'hasHouseAdNet');
     if ($count > 0 && !isset($houseAdNet)) {
         // add houseAdNet
         fb("Should Add");
         $network = new Network();
         $network->id = SDB::uuid();
         $network->aid = $this->id;
         $network->type = Network::NETWORK_TYPE_HOUSE;
         $network->adsOn = 0;
         $network->weight = 0;
         $network->priority = 99;
         $network->keys = array("_CUSTOMS_");
         $network->put();
         $retVal = "add";
     } else {
         if ($count == 0 && isset($houseAdNet)) {
             // should remove or turn off
             $hasHouseAds = count(HouseAdUtil::getHouseAdsByUid($_SESSION['uid'])) > 0;
             if ($hasHouseAds) {
                 fb("should turn off");
                 $houseAdNet->adsOn = 0;
                 $houseAdNet->put();
                 $retVal = "turnOff";
             } else {
                 fb("Should Remove", $houseAdNet);
                 $houseAdNet->delete();
                 unset($networks['9']);
                 $retVal = "delete";
             }
             App::setWeights($networks);
             App::setPriorities($networks);
         }
     }
     fb("adjustHouseAdNet", "end");
     return $retVal;
 }
开发者ID:amoikevin,项目名称:adwhirl.servers-website,代码行数:59,代码来源:App.php

示例2: appNetworksSubmit

 public function appNetworksSubmit()
 {
     $this->printHeader = false;
     $this->printFooter = false;
     $this->needsApp();
     if ($this->user->id != $this->app->uid) {
         die;
     }
     $nids = isset($_POST['nid']) ? $_POST['nid'] : null;
     $priorities = isset($_POST['priority']) ? $_POST['priority'] : null;
     $weights = isset($_POST['weight']) ? $_POST['weight'] : null;
     $adsOn = isset($_POST['adsOn']) ? $_POST['adsOn'] : null;
     fb('nids', $nids);
     fb('priorities', $priorities);
     fb('adsOn', $adsOn);
     fb('weights', $weights);
     $off = array();
     $on = array();
     for ($i = 0; $i < count($nids); $i++) {
         $nid = $nids[$i];
         if (!empty($nid)) {
             $network = new Network($nid);
             $network->postGet();
         } else {
             continue;
             /* We don't need this, since we can only add change things once they have keys
               	$network = new Network();
               	$nid = SDB::uuid();
               	$network->id = $nid;
               	*/
         }
         $network->aid = $this->app->id;
         $network->weight = isset($weights[$i]) ? $weights[$i] : null;
         $network->adsOn = $adsOn[$i];
         if ($adsOn[$i] == "1") {
             $network->priority = $priorities[$i];
             $on[$network->priority * 1000 + $i] = $network;
         } else {
             $network->priority = Network::MAX_PRIORITY;
             $network->put();
         }
     }
     ksort($on);
     fb("on", $on);
     $count = 0;
     foreach ($on as $network) {
         $network->priority = ++$count;
         $network->put();
     }
     return "OK";
     //return $this->appNetworks();
 }
开发者ID:amoikevin,项目名称:adwhirl.servers-website,代码行数:52,代码来源:oneApp.php


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