コード例 #1
0
ファイル: dashboardController.php プロジェクト: 7s4r/eBidix
 function get_online_users()
 {
     $dir = _DIR_ . '/data/';
     $files = scandir($dir);
     $count = 0;
     foreach ($files as $filename) {
         if (is_dir($dir . $filename)) {
             continue;
         }
         if (substr($filename, 0, 11) == 'user_count_') {
             $isOnline = tools::readCache($filename);
             if (!empty($isOnline)) {
                 $count++;
             } else {
                 tools::deleteCache($filename);
             }
         }
     }
     return $count;
 }
コード例 #2
0
ファイル: daemons.php プロジェクト: 7s4r/eBidix
                                $peak = tools::isPeakNow(true);
                                if (strtotime($peak['peak_start']) < time()) {
                                    $peak['peak_start'] = date('Y-m-d H:i:s', strtotime($peak['peak_start']) + 86400);
                                }
                                $seconds_after_peak = strtotime($auction['end_time']) - strtotime($peak['peak_end']);
                                $time = strtotime($peak['peak_start']) + $seconds_after_peak;
                                $endTime = date('Y-m-d H:i:s', $time);
                                if (strtotime($endTime) < time()) {
                                    $endTime = date('Y-m-d H:i:s', strtotime($endTime) + 86400);
                                }
                                $db->update('auctions', "end_time = '{$endTime}'", "id = {$auction['id']}");
                            } else {
                                $data['auction_peak_start'] = get('auction_peak_start');
                                $data['auction_peak_end'] = get('auction_peak_end');
                                $data['isPeakNow'] = $isPeakNow;
                                $data['time_increment'] = get('time_increment', $auction['id'], 0);
                                $data['bid_debit'] = get('bid_debit', $auction['id'], 0);
                                $data['price_increment'] = get('price_increment', $auction['id'], 0);
                                placeAutobid($auction['id'], $data, false, 3);
                            }
                        } else {
                            closeAuction($auction);
                        }
                    }
                }
            }
            usleep(500000);
        }
        tools::deleteCache('close.pid');
        break;
}
コード例 #3
0
ファイル: appController.php プロジェクト: 7s4r/eBidix
 private function getUserInfos()
 {
     if (isset($_SESSION['user_id']) && !empty($_SESSION['user_id'])) {
         $isOnline = tools::readCache('user_count_' . $_SESSION['user_id']);
         if (!empty($isOnline)) {
             tools::deleteCache('user_count_' . $_SESSION['user_id']);
             tools::writeCache('user_count_' . $_SESSION['user_id'], $_SESSION['user_id'], 300);
         } else {
             tools::writeCache('user_count_' . $_SESSION['user_id'], $_SESSION['user_id'], 300);
         }
         $balance = $this->db->select("fetch", "bids", "SUM(credit) - SUM(debit) AS total", array("user_id" => $_SESSION['user_id']));
         $this->user['balance'] = $balance['total'];
     }
 }
コード例 #4
0
ファイル: daemons_functions.php プロジェクト: 7s4r/eBidix
function clearCache($auction_id = null, $user_id = null)
{
    if (!empty($auction_id)) {
        tools::deleteCache('auction_view_' . $auction_id);
        tools::deleteCache('auction_' . $auction_id);
    }
    if (!empty($user_id)) {
        tools::deleteCache('bids_balance_' . $user_id);
    }
}