/** * @Purpose: * 平台礼包领取 * @Param $player_id 玩家ID * @Param $type 礼包类型(1:360加速球2:360游戏大厅) */ public function receive_platform_bag($player_id, $type) { $player_id = intval($player_id); $type = intval($type); $operator_id = OPERATOR_ID; #获取玩家微端礼包信息; $data = $this->get_data('PlayerDetail')->get_player_detail($player_id, 'platform_bag_info'); if (empty($data) || !isset($data[$operator_id][$type]) || $data[$operator_id][$type] != 2) { #获取平台礼包配置表 $platformbag_table = Cache_PlatformBag::getInstance()->get_platform_bag_info(array('platform' => $operator_id, 'type' => $type)); if (empty($platformbag_table)) { $this->throw_error('10109'); #配置表读取错误 } #领奖时间验证 $start_time = Com_FmtData::format_table_time($platformbag_table['start_time']); $over_time = Com_FmtData::format_table_time($platformbag_table['over_time']); if (time() < $start_time || $over_time <= time()) { $this->throw_error('21001'); #非领奖时间 } if ($data[$operator_id][$type] == 2) { $this->throw_error('6010063'); #奖励领取过 } if ($platformbag_table['is_activate'] == 1 && $data[$operator_id][$type] != 1) { $this->throw_error('21002'); #礼包未激活 } $prop_list = Com_FmtData::format_table_prop($platformbag_table['prop_info']); $prop_info = Com_FmtData::format_send_prop($prop_list); $data[$operator_id][$type] = 2; $this->start_trans(); $update_res = $this->get_data('PlayerDetail')->update_player_detail($player_id, array('platform_bag_info' => $data)); if (!$update_res) { $this->throw_error('10104'); } #道具发送 if (Com_Array::is_good_arr($prop_info)) { $result = $this->get_game('Reward')->send_reward($player_id, $prop_info, array('cmd_id' => '2105', 'bind_flag' => 0), 1); if ($result !== true) { $this->throw_error('10104'); } } $this->commit(); $this->get_game('Reward')->add_reward_log(); $fun_id = 0; if ($type == 1) { $fun_id = 91101; } else { if ($type == 2) { $fun_id = 91102; } } if ($fun_id > 0) { #礼包全部领完后,通知前端隐藏ICON $func_data = array(); $func_data[0][$fun_id] = array('operate' => 2, 'func_id' => $fun_id, 'open' => 0, 'guide' => 0, 'cd' => 0, 'tip' => array()); Protocol::input($player_id, 8, 7, 741, $func_data); } return array(intval($data[$operator_id][$type]), $type); } }