/** * * @param unknown $instant_ntf 0:提前通知 1:到点通知 * @param unknown $type_id 活动id * @param unknown $category 玩法类型 */ public function activity_send_notice($player_id, $instant_ntf, $sid) { $player_id = intval($player_id); $instant_ntf = intval($instant_ntf); $sid = intval($sid); #{活动名}活动10分钟后开启,请广大玩家做好准备,海量丰厚奖励等着你! #{活动名}活动开启了,立刻参与,活动奖励轻松获得! $activity_info = Cache_ActivityHall::getInstance()->get_activity_info($sid); if (!Com_Array::is_good_arr($activity_info)) { return false; } $code = $activity_info['func_id']; $arrPushConfig = Cache_PushUpgrade::getInstance()->get_upgrade_info($code, $instant_ntf + 1); if (!Com_Array::is_good_arr($arrPushConfig)) { return false; } $replace_info = array(); $replace_info[] = array('rep_type' => 7, 'txt' => $activity_info['name']); if ($arrPushConfig['go_name']) { $replace_info[] = array('rep_type' => 1, 'rep_val' => $code, 'txt' => strval($arrPushConfig['go_name'])); } else { $replace_info[] = array('rep_type' => 7, 'txt' => ''); } $msg = Language_Message::make_message($arrPushConfig['code'], $replace_info, 0, '', true); $this->get_game('SystemNotice')->send_system_msg($player_id, $msg, $arrPushConfig['need_broadcas'], 1, 2, $sid); }
/** * 推送玩家获得道具、兑换、等级、名次、强化、品阶、连胜等 * @param unknown $func_id * @param unknown $sub_func_id * @param unknown $replace_info * @param number $val */ public function push_system_notice($player_id, $func_id, $sub_func_id, $replace_info, $val = 0, $need_broadcas = 0) { $gm = $this->get_data('Player')->get_player_info($player_id, 'gm'); if ($gm == 1 || $gm == 2) { return false; } $arrPushConfig = Cache_PushUpgrade::getInstance()->get_upgrade_info($func_id, $sub_func_id); if (!$replace_info) { return false; } if (!empty($arrPushConfig)) { Com_Log::write('xgame.push_system_notice', "player_id={$player_id},func_id={$func_id},sub_func_id={$sub_func_id},val={$val},need_broadcas={$need_broadcas}"); Com_Log::write('xgame.push_system_notice', var_export($replace_info, true)); $code = $arrPushConfig['code']; $go_name = $arrPushConfig['go_name']; if ($arrPushConfig['need_broadcas'] == 99) { if (!$need_broadcas) { return false; } $push_type = $need_broadcas; } else { if ($arrPushConfig['condition']) { $arr_condition = explode(",", $arrPushConfig['condition']); if (!in_array($val, $arr_condition)) { return false; } } $push_type = $arrPushConfig['need_broadcas']; } if (!$push_type) { return false; } $arr_push_type = explode(",", $push_type); if (empty($arr_push_type)) { $arr_push_type[] = $push_type; } $last_index = count($replace_info); foreach ($replace_info as $key => $info) { $rep_type = $info["rep_type"]; $rep_val = $info["rep_val"]; if ($go_name && !isset($replace_info[$index])) { //最后前往 if ($rep_type == 1) { $replace_info[$last_index] = $replace_info[$key]; $replace_info[$last_index]['txt'] = $go_name; $replace_info[$last_index]['rep_underline'] = 1; } else { $replace_info[$last_index] = array('rep_type' => 1, 'rep_val' => $func_id, 'rep_pid' => $func_id); $replace_info[$last_index]['txt'] = $go_name; $replace_info[$last_index]['rep_underline'] = 1; } } $replace_info[$key]['rep_color'] = ""; if ($rep_type == 0) { $name = $this->get_data('Player')->get_player_info($rep_val, 'name'); $replace_info[$key]['txt'] = $name; } } if (!$go_name) { $replace_info[$last_index] = array("rep_type" => 7, "txt" => ""); } $go_replace_info = $replace_info[$last_index]; $replace_info[$last_index] = array("rep_type" => 7, "txt" => ""); foreach ($arr_push_type as $location) { if ($location) { if ($location == 1) { $replace_info[$last_index] = $go_replace_info; } $msg = Language_Message::make_message($code, $replace_info); $this->send_system_msg($player_id, $msg, $location); if ($location == 5) { $this->get_game('PlayerFriend')->add_player_news($player_id, json_encode($msg)); } $replace_info[$last_index] = array("rep_type" => 7, "txt" => ""); } } Com_Log::write('xgame.push_system_notice', "-----------ok-------------"); Com_Log::write('xgame.push_system_notice', var_export($replace_info, true)); return $msg; } }