/** * 发给玩家道具接口 发道具都通过这个发 * @param $player_id * @param $prop_id 道具id * @param $prop_num 发送的道具数量 * @param $arrLogs 道具日志 * @param null $channel 0包裹满不发邮件 1 包裹满发邮件 * @param $arrPropConfig 新增道具配置 是用在发邮件的时候 装备要线吧装备属性生成 * @return bool|string */ public function send_prop_auto_overlay($player_id, $prop_id, $prop_num, &$arrLogs, $cmd_id, $bind_flag = null, $channel = 0, $arrPropConfig = null, $player_info = null) { if (!Com_System::is_int_numeric($prop_num)) { $this->throw_error('80004'); //道具数量出错! } if (empty($arrPropConfig)) { $arrPropConfig = Cache_Prop::getInstance()->get_prop_info($prop_id); } if (!is_null($bind_flag)) { $arrPropConfig['bind_flag'] = $bind_flag; } else { $arrPropConfig['bind_flag'] = $arrPropConfig['bind_type']; } $now_time = time(); if (!empty($arrPropConfig['generate_start_time']) && !empty($arrPropConfig['generate_end_time']) && ($now_time < strtotime($arrPropConfig['generate_start_time']) || $now_time > strtotime($arrPropConfig['generate_end_time']))) { return true; #没在掉落时间的去掉 } if (!Com_Array::is_good_arr($arrPropConfig)) { # 对于偶发性的奖励发送报道具配置出错问题添加调试日志 // Com_Log::write('xgame.debug', "Error occured in " . __CLASS__ . ":\t$player_id\t$prop_id\t$prop_num\t".json_encode($arrPropConfig)); $this->throw_error('80003', '101800247'); //道具配置出错,请联系客服! } if ($arrPropConfig['max_lap_num'] > 0) { $objPlayerPropData = $this->get_data("PlayerProp"); $arrPlayerPropList = $objPlayerPropData->get_player_prop_by_prop_id($player_id, $prop_id, 1); if (!$arrPlayerPropList) { return $this->send_prop_to_player($player_id, $prop_id, $prop_num, $arrLogs, $cmd_id, $arrPropConfig, $channel, $player_info); } else { $rest_prop_num = $prop_num; foreach ($arrPlayerPropList as $key => $value) { $can_overlay_num = $arrPropConfig['max_lap_num'] - $value['item_num']; //可叠加数量 if ($arrPropConfig['level'] == $value['level'] && $arrPropConfig['bind_flag'] == $value['bind_flag'] && $arrPropConfig['quality'] == $value['quality'] && $can_overlay_num > 0 && $value['player_id'] == $player_id && $value['prop_id'] == $prop_id && $value['item_position'] == 1) { $overlay_num = min($rest_prop_num, $can_overlay_num); //叠加的数量 if (!$objPlayerPropData->update_prop_num($player_id, $value, $overlay_num, '+', array(), false)) { $this->throw_error('80005'); //更新道具数量失败 } $value['player_prop_id'] = $value['player_prop_id']; $value['prop_id'] = $arrPropConfig['prop_id']; $value['prop_name'] = $arrPropConfig['prop_name']; $value['overlay_num'] = $overlay_num; $value['item_num'] += $overlay_num; $value['grid'] = $value['grid']; $value['item_position'] = $value['item_position']; $arrTempLogs = array_merge($arrPropConfig, $value); $arrLogs[] = $arrTempLogs; unset($arrTempLogs); $rest_prop_num = $rest_prop_num - $overlay_num; if ($rest_prop_num <= 0) { break; } } } if ($rest_prop_num > 0) { return $this->send_prop_to_player($player_id, $prop_id, $rest_prop_num, $arrLogs, $cmd_id, $arrPropConfig, $channel, $player_info); } return true; } } else { return $this->send_prop_to_player($player_id, $prop_id, $prop_num, $arrLogs, $cmd_id, $arrPropConfig, $channel, $player_info); } }
public function param_check_numeric($param_array, $scope = 1, $out_code = 0) { if (!empty($param_array)) { if (!is_array($param_array)) { $param_array = array($param_array); } foreach ($param_array as $param) { if (!Com_System::is_int_numeric($param, $scope)) { $this->throw_error('10107', $out_code); # 参数错误 } } } else { $this->throw_error('10107', $out_code); # 参数错误 } }