public static function getInstatnce()
 {
     if (self::$instance === null) {
         self::$instance = new RedisFactory();
     }
     return self::$instance;
 }
 /**
  * 获取campaign
  * @param int $campaignId
  * @return array
  */
 static function getById($campaignId)
 {
     $redis = RedisFactory::open()->connect($campaignId);
     $key = sprintf(self::$REDIS_KEYS['getById'], $campaignId);
     $result = $redis->get($key)->getResult();
     if ($result === false) {
         // 初始化
         $db = DatabaseFactory::open();
         $result = $db->createCommand("SELECT * FROM g_campaign WHERE id=:id")->findFirst(array(':id' => $campaignId));
         if (empty($result)) {
             $result = array();
         }
         $redis->set($key, $result);
     }
     return $result;
 }
 /**
  * 获取redis
  * @return IRedis
  */
 static function getRedis()
 {
     return RedisFactory::open(self::REDIS_CONFIG);
 }
<?php

set_time_limit(0);
define('ROOT', dirname(__DIR__));
include ROOT . '/include/common.php';
$week = date('w');
$nowtime = time() + 1800;
$difftime = 259200;
$logdir = __DIR__ . '/logs/' . date('Ym') . '/';
!is_dir($logdir) && mkdir($logdir, 0755, true);
$logfile = $logdir . date('Ymd') . '.log';
//if ($week != "6")
//{/
//exit("run time error!!!!");
//}
$redis_handle = RedisFactory::get();
$system_rank_handle = SystemRank::instance();
$lastSendDate = $redis_handle->get(NameMapper::get_arena_challenge_week_bonus_time_redis_key());
if (empty($lastSendDate)) {
    //$init_date = $system_rank_handle::get_current_week_6_day();
    $init_data = date("Y-m-d", strtotime("- 3 day"));
    $redis_handle->set(NameMapper::get_arena_challenge_week_bonus_time_redis_key(), $init_data);
    $lastSendDate = $init_date;
}
$lastSendDateTime = strtotime($lastSendDate . ' 20:00:00');
if ($nowtime - $lastSendDateTime < $difftime) {
    exit("run time error!!!!");
}
error_log("\r\n start send bonus time:" . date("Y-m-d H:i:s"), 3, $logfile);
$last_rank_list = $system_rank_handle->get_full_challenge_list();
$rank_count = count($last_rank_list);