本文整理汇总了PHP中Com_AdCache::set_pipe方法的典型用法代码示例。如果您正苦于以下问题:PHP Com_AdCache::set_pipe方法的具体用法?PHP Com_AdCache::set_pipe怎么用?PHP Com_AdCache::set_pipe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Com_AdCache
的用法示例。
在下文中一共展示了Com_AdCache::set_pipe方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: batch_sell_prop
/**
* 一键出售道具
* @param $player_id
* @return array
* @throws Exception]
*/
public function batch_sell_prop($player_id)
{
$sell_id = array();
$objPlayerPropData = $this->get_data('PlayerProp');
$prop_list = $objPlayerPropData->get_player_prop_by_item_position($player_id);
//冲从包裹取出道具
if ($prop_list) {
$props = array();
foreach ($prop_list as $prop) {
$props[] = $prop['prop_id'];
}
$prop_configs = Cache_Prop::getInstance()->get_prop_info($props);
foreach ($prop_list as $key => $prop) {
if ($prop_configs[$prop['prop_id']]['type'] == 3 && $prop_configs[$prop['prop_id']]['sub_type'] == 21 && $prop_configs[$prop['prop_id']]['quality'] <= 4) {
$sell_id[$prop['player_prop_id']] = $prop;
} elseif ($prop_configs[$prop['prop_id']]['type'] == 1 && $prop_configs[$prop['prop_id']]['sub_type'] <= 12 && $prop_configs[$prop['prop_id']]['quality'] <= 2) {
$sell_id[$prop['player_prop_id']] = $prop;
}
}
}
if ($sell_id) {
$get_silver = 0;
foreach ($sell_id as $prop) {
if ($prop_configs[$prop['prop_id']]['sale_price'] > 0) {
$get_silver += $prop_configs[$prop['prop_id']]['sale_price'] * $prop['item_num'];
}
}
if ($get_silver) {
$player_info = $this->get_data('Player')->get_player_info($player_id, array('level', 'vip', 'silver', 'privilege_level'));
$this->get_data('Player')->check_player_resource($player_id, $player_info, "+", 'silver', $get_silver);
$result = true;
$objPlayerPropData->start_watch($player_id);
$this->start_trans();
$log_param = array('level' => $player_info['level'], 'vip' => $player_info['vip'], 'cmd_id' => 804);
foreach ($sell_id as $player_prop_id => $val) {
$result = $objPlayerPropData->update_prop_num($player_id, $val, $val['item_num'], "-", $log_param);
$sell_id[$player_prop_id] = 0;
if (!$result) {
$this->throw_error(80003, '10180062601');
}
}
if ($result) {
$result = $this->get_data('Player')->update_player_resource($player_id, $player_info, 804);
}
if ($result) {
Com_AdCache::set_pipe(false);
$this->commit();
$out['result'] = 1;
$out['item'] = array('pos' => 1, 'index' => array());
$asyData = array();
foreach ($sell_id as $arr_prop_detail) {
$out['item']['index'][] = $arr_prop_detail['grid'];
}
$out['silver'] = Cache_Currency::getInstance()->get_index('silver') . ":" . $get_silver;
Protocol_Prop::prop_806($player_id, $sell_id);
return $out;
}
}
}
return array('result' => 1, array());
}