/** * 当保存活动或者演讲时 * 如果开始时间大于当前时间 --> 则保存到当前预告中 否则是热门活动或者是热门演讲 * * @param $act 活动对象 */ public function save_activity($act) { $actmod = new ActivityModule(); $act_id = $actmod->save_activity($act); if ($act->id) { $act = $actmod->get_by_id($act_id); return $act; } date_default_timezone_set("Asia/Shanghai"); $act = $actmod->get_by_id($act_id); // 如果创建新的演讲或活动,更新到预告中去 if ($act->type == ActivityModel::type_talk) { $channel = strtotime($act->start_time) > strtotime(date('Y-m-d H:i:s')) ? RECENT_TALK_CHANNEL : 0; if ($channel && $channel != 0) { $chmod = new ChannelModule(); $chmod->add_activity($channel, $act->id, 0); } } else { if ($act->type == ActivityModel::type_activity) { $channel = strtotime($act->start_time) > strtotime(date('Y-m-d H:i:s')) ? RECENT_ACTIVITY_CHANNEL : 0; if ($channel && $channel != 0) { $chmod = new ChannelModule(); $chmod->add_activity($channel, $act->id, 0); } } } return $act; }