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


PHP Neuron_Core_Tools::timestampToMysqlDatetime方法代码示例

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


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

示例1: moveUnit

 public function moveUnit($target)
 {
     // Calculate distance
     $distance = Dolumar_Map_Map::getDistanceBetweenVillages($this->getLocation(), $target);
     $duration = $this->getTravelDuration($distance);
     // Update
     $db = Neuron_Core_Database::__getInstance();
     $db->update('villages_specialunits', array('vsu_moveStart' => Neuron_Core_Tools::timestampToMysqlDatetime(time()), 'vsu_moveEnd' => Neuron_Core_Tools::timestampToMysqlDatetime(time() + $duration), 'vsu_location' => $target->getId()), "vsu_id = " . $this->getId());
 }
开发者ID:Toxicat,项目名称:dolumar,代码行数:9,代码来源:SpecialUnits.php

示例2: cleanServer

 public static function cleanServer()
 {
     $db = Neuron_Core_Database::__getInstance();
     $log = array();
     // Kill players
     $last = Neuron_Core_Tools::timestampToMysqlDatetime(time() - 60 * 60 * 24 * 45);
     $l = $db->select('n_players', array('plid', 'killCounter'), "lastRefresh < '" . $last . "' AND isPlaying = 1");
     foreach ($l as $v) {
         if ($v['killCounter'] < 5) {
             $db->update('n_players', array('killCounter' => '++'), "plid = '" . $v['plid'] . "'");
         } else {
             // Kill!
             $player = Neuron_GameServer::getPlayer($v['plid']);
             if (!$player->isModerator()) {
                 $player->doResetAccount();
                 /*
                 $log[] = array
                 (
                 	'action' => 'reset',
                 	'subject' => 'account',
                 	'name' => $player->getNickname ()
                 );
                 */
                 $player->__destruct();
             }
         }
     }
     // Kill villages
     $last = Neuron_Core_Tools::timestampToMysqlDatetime(time() - 60 * 60 * 24 * 5);
     //$last = Neuron_Core_Tools::timestampToMysqlDatetime (time ());
     $l = $db->select('villages', array('vid'), "isActive = '0' AND (removalDate < '{$last}' OR removalDate IS NULL)");
     foreach ($l as $v) {
         $village = Dolumar_Players_Village::getVillage($v['vid'], false, true, true);
         $village->destroyVillage();
         $village->__destruct();
     }
     // Remove old login data (2 weeks old)
     $rem = $db->remove('n_login_log', "l_datetime < '" . date('Y-m-d H:i:s', time() - 60 * 60 * 24 * 7 * 2) . "'");
     $log[] = "Removed " . $rem . " login logs.\n";
     // Remove old game log data (2 months old)
     //$db->remove ('game_log', "l_date < '".date ('Y-m-d H:i:s', time () - 60*60*31*2)."'");
     // Remove old battle reports (2 months old)
     $rem = $db->remove('battle_report', "fightDate < '" . (time() - 60 * 60 * 24 * 31 * 2) . "'");
     $log[] = "Removed " . $rem . " battle reports.\n";
     return $log;
 }
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:46,代码来源:Server.php

示例3: setTemporaryKey

 public static function setTemporaryKey(Neuron_GameServer_Player $player, $key, $timeout)
 {
     $db->update('n_players', array('tmp_key' => $key, 'tmp_key_end' => Neuron_Core_Tools::timestampToMysqlDatetime($timeout)), "plid = " . $player->getId());
 }
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:4,代码来源:PlayerMapper.php

示例4: sendLostPassword

 public function sendLostPassword($email)
 {
     // Check the database for this user
     $db = Neuron_Core_Database::__getInstance();
     $user = $db->select('n_players', array('plid', 'email', 'nickname'), "email = '" . $db->escape($email) . "' AND email_cert = 1 AND isRemoved = 0");
     if (count($user) != 1) {
         $this->warning = 'user_not_found';
         return false;
     }
     // User is found: let's continue the process.
     $password = substr($this->getRandomPassword(), 0, 6);
     // Remove all other temporary password from this user
     $db->remove('n_temp_passwords', "p_plid = " . $user[0]['plid'] . " OR p_expire < NOW()");
     // Add this new one
     $db->insert('n_temp_passwords', array('p_plid' => $user[0]['plid'], 'p_pass' => $password, 'p_expire' => Neuron_Core_Tools::timestampToMysqlDatetime(time() + 60 * 60 * 24 * 2)));
     // Send this temporary password to the user.
     $this->sendLostPasswordMail($user[0]['email'], $user[0]['nickname'], $password);
     return true;
 }
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:19,代码来源:Login.php


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