Exemple #1
0
 public static function out($player_id, $player_info = null)
 {
     if (!empty(self::$_guide_list)) {
         $out = array();
         $logs = array();
         $data = self::get_data('PlayerDetail')->get_player_detail($player_id, 'guide');
         foreach (self::$_guide_list as $guide) {
             $out[$guide['guide_id']] = array('guide_id' => $guide['guide_id'], 'step' => $guide['step']);
             $logs[$guide['guide_id']] = array('type' => 1, 'task_id' => $guide['guide_id'], 'step' => $guide['step'], 'status' => 0);
             $data[$guide['guide_id']] = 1;
         }
         $result = self::get_data('PlayerDetail')->update_player_detail($player_id, array('guide' => $data));
         if (!$result) {
             return;
         }
         if (!IS_FRONT || defined('FROM_GATEWAY')) {
             $cmd0 = 8;
         } else {
             $cmd0 = 3;
         }
         //            Com_Log::write('guide_'.$player_id,var_export($out,true));
         Protocol::input($player_id, $cmd0, 7, 787, array(0 => $out));
         if (empty($player_info) || !isset($player_info['level']) || !isset($player_info['vip'])) {
             $player_info = self::get_data('Player')->get_player_info($player_id, array('level', 'vip'));
         }
         Log_Guide::getInstance()->add_multi_guide_log($player_id, $player_info['level'], $player_info['vip'], $logs);
         self::$_guide_list = null;
     }
 }
Exemple #2
0
 /**
  * 保存引导信息
  * @param $player_id
  * @param $guid_id
  * @param $step
  * @return array
  */
 public function set_guid($player_id, $guid_id, $step)
 {
     $player_detail = $this->get_data('PlayerDetail')->get_player_detail($player_id, array('guide'));
     if (empty($player_detail['guide'])) {
         $data = $player_detail['guide'];
     } else {
         $data = array();
     }
     $data[$guid_id] = $step;
     $result = $this->get_data('PlayerDetail')->update_player_detail($player_id, array('guide' => $data));
     if (!$result) {
         $this->throw_error(10110);
     }
     if ($step == 0) {
         $logs[] = array('type' => 1, 'task_id' => $guid_id, 'step' => $step, 'status' => 1);
         $player_info = self::get_data('Player')->get_player_info($player_id, array('level', 'vip'));
         Log_Guide::getInstance()->add_multi_guide_log($player_id, $player_info['level'], $player_info['vip'], $logs);
     }
     $out[0][] = array('guide_id' => $guid_id, 'step' => $step);
     return $out;
 }