本文整理汇总了PHP中add_bonus函数的典型用法代码示例。如果您正苦于以下问题:PHP add_bonus函数的具体用法?PHP add_bonus怎么用?PHP add_bonus使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_bonus函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_act_add_bonus
function action_act_add_bonus()
{
// 获取全局变量
$user = $GLOBALS['user'];
$_CFG = $GLOBALS['_CFG'];
$_LANG = $GLOBALS['_LANG'];
$smarty = $GLOBALS['smarty'];
$db = $GLOBALS['db'];
$ecs = $GLOBALS['ecs'];
$user_id = $_SESSION['user_id'];
include_once ROOT_PATH . 'includes/lib_transaction.php';
$bouns_sn = isset($_POST['bonus_sn']) ? intval($_POST['bonus_sn']) : '';
if (add_bonus($user_id, $bouns_sn)) {
show_message($_LANG['add_bonus_sucess'], $_LANG['back_up_page'], 'user.php?act=bonus', 'info');
} else {
$err->show($_LANG['back_up_page'], 'user.php?act=bonus');
}
}
示例2: show_message
$user_info = $user->get_profile_by_id($user_id);
//论坛记录
if ($user_info && (!empty($code) && md5($user_info['user_id'] . $_CFG['hash_code'] . $user_info['reg_time']) == $code) || $_SESSION['user_id'] > 0 && $_SESSION['user_id'] == $user_id && $user->check_user($_SESSION['user_name'], $old_password)) {
if ($user->edit_user(array('username' => empty($code) ? $_SESSION['user_name'] : $user_info['user_name'], 'old_password' => $old_password, 'password' => $new_password), empty($code) ? 0 : 1)) {
$user->logout();
show_message($_LANG['edit_password_success'], $_LANG['relogin_lnk'], 'user.php?act=login', 'info');
} else {
show_message($_LANG['edit_password_failure'], $_LANG['back_page_up'], '', 'info');
}
} else {
show_message($_LANG['edit_password_failure'], $_LANG['back_page_up'], '', 'info');
}
} elseif ($action == 'act_add_bonus') {
include_once ROOT_PATH . 'includes/lib_transaction.php';
$bouns_sn = isset($_POST['bonus_sn']) ? intval($_POST['bonus_sn']) : '';
if (add_bonus($user_id, $bouns_sn)) {
show_message($_LANG['add_bonus_sucess'], $_LANG['back_up_page'], 'user.php?act=bonus', 'info');
} else {
$err->show($_LANG['back_up_page'], 'user.php?act=bonus');
}
} elseif ($action == 'order_list') {
include_once ROOT_PATH . 'includes/lib_transaction.php';
$page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1;
$record_count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('order_info') . " WHERE user_id = '{$user_id}'");
$pager = get_pager('user.php', array('act' => $action), $record_count, $page);
$orders = get_user_orders($user_id, $pager['size'], $pager['start']);
$merge = get_user_merge($user_id);
$smarty->assign('merge', $merge);
$smarty->assign('pager', $pager);
$smarty->assign('orders', $orders);
$smarty->display('user_transaction.dwt');
示例3: bonus_info
$order['surplus'] = 0;
$order['integral'] = 0;
}
/* 检查红包是否存在 */
if ($order['bonus_id'] > 0) {
$bonus = bonus_info($order['bonus_id']);
if (!is_bonus_available($bonus) || $bonus['user_id'] != $user_id || $bonus['min_goods_amount'] > cart_amount(false, $flow_type)) {
$order['bonus_id'] = 0;
}
} elseif (isset($_POST['bonus_sn'])) {
$bonus_sn = trim($_POST['bonus_sn']);
$bonus = bonus_info(0, $bonus_sn);
$now = gmtime();
if (is_bonus_available($bonus) && $bonus['user_id'] == 0 && $bonus['min_goods_amount'] <= cart_amount(false, $flow_type)) {
include_once ROOT_PATH . 'includes/lib_transaction.php';
add_bonus($user_id, $bonus_sn);
$order['bonus_id'] = $bonus['bonus_id'];
$order['bonus_sn'] = $bonus_sn;
}
}
/* 订单中的商品 */
$cart_goods = cart_goods($flow_type);
if (empty($cart_goods)) {
show_message($_LANG['no_goods_in_cart'], $_LANG['back_home'], './', 'warning');
}
/* 检查商品总额是否达到最低限购金额 */
if ($flow_type == CART_GENERAL_GOODS && cart_amount(true, CART_GENERAL_GOODS) < $_CFG['min_goods_amount']) {
show_message(sprintf($_LANG['goods_amount_not_enough'], price_format($_CFG['min_goods_amount'], false)));
}
/* 收货人信息 */
/*foreach ($consignee as $key => $value)