当前位置: 首页>>代码示例>>PHP>>正文


PHP order_bonus函数代码示例

本文整理汇总了PHP中order_bonus函数的典型用法代码示例。如果您正苦于以下问题:PHP order_bonus函数的具体用法?PHP order_bonus怎么用?PHP order_bonus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了order_bonus函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: send_order_bonus

/**
 * 发红包:发货时发红包
 * @param   int     $order_id   订单号
 * @return  bool
 */
function send_order_bonus($order_id)
{
    /* 取得订单应该发放的红包 */
    $bonus_list = order_bonus($order_id);
    /* 如果有红包,统计并发送 */
    if ($bonus_list) {
        /* 用户信息 */
        $sql = "SELECT u.user_id, u.user_name, u.mobile_phone " . "FROM " . $GLOBALS['ecs']->table('order_info') . " AS o, " . $GLOBALS['ecs']->table('users') . " AS u " . "WHERE o.order_id = '{$order_id}' " . "AND o.user_id = u.user_id ";
        $user = $GLOBALS['db']->getRow($sql);
        /* 统计 */
        $count = 0;
        $money = '';
        foreach ($bonus_list as $bonus) {
            $count += $bonus['number'];
            $money .= price_format($bonus['type_money']) . ' [' . $bonus['number'] . '], ';
            $add_time = time();
            $expire_time = min($bonus['use_end_date'], $add_time + $bonus['use_time_limit']);
            /* 修改用户红包 */
            $sql = "INSERT INTO " . $GLOBALS['ecs']->table('user_bonus') . " (bonus_type_id, user_id,amount,add_time,expire_time,from_order_id) " . "VALUES('{$bonus['type_id']}','{$user['user_id']}','{$bonus['type_money']}','{$add_time}','{$expire_time}','{$order_id}')";
            for ($i = 0; $i < $bonus['number']; $i++) {
                $GLOBALS['db']->query($sql);
            }
        }
        /* 如果有红包,发送邮件 */
        /*
                if ($count > 0)
                {
                    $tpl = get_mail_template('send_bonus');
                    $GLOBALS['smarty']->assign('user_name', $user['user_name']);
                    $GLOBALS['smarty']->assign('count', $count);
                    $GLOBALS['smarty']->assign('money', $money);
                    $GLOBALS['smarty']->assign('shop_name', $GLOBALS['_CFG']['shop_name']);
                    $GLOBALS['smarty']->assign('send_date', local_date($GLOBALS['_CFG']['date_format']));
                    $GLOBALS['smarty']->assign('sent_date', local_date($GLOBALS['_CFG']['date_format']));
                    $content = $GLOBALS['smarty']->fetch('str:' . $tpl['template_content']);
                    send_mail($user['user_name'], $user['email'], $tpl['template_subject'], $content, $tpl['is_html']);
                }*/
    }
    return true;
}
开发者ID:GYWang1983,项目名称:fruit,代码行数:45,代码来源:lib_order.php

示例2: return_order_bonus

/**
 * 返回订单发放的红包
 * @param   int     $order_id   订单id
 */
function return_order_bonus($order_id)
{
    /* 取得订单应该发放的红包 */
    $bonus_list = order_bonus($order_id);
    /* 删除 */
    if ($bonus_list) {
        /* 取得订单信息 */
        $order = order_info($order_id);
        $user_id = $order['user_id'];
        foreach ($bonus_list as $bonus) {
            $sql = "DELETE FROM " . $GLOBALS['ecs']->table('user_bonus') . " WHERE bonus_type_id = '{$bonus['type_id']}' " . "AND user_id = '{$user_id}' " . "AND order_id = '0' LIMIT " . $bonus['number'];
            $GLOBALS['db']->query($sql);
        }
    }
}
开发者ID:dlpc,项目名称:ecshop,代码行数:19,代码来源:lib_order.php

示例3: local_date

             $smarty->assign('bonus_money', $row['type_money']);
             $smarty->assign('use_start_date', local_date("Y-m-d", $row['use_start_date']));
             $smarty->assign('use_end_date', local_date("Y-m-d", $row['use_end_date']));
             $smarty->assign('status', 3);
             $smarty->display('share_bonus.dwt');
             exit;
         }
     }
 }
 $order_id = isset($_REQUEST['order_id']) ? trim($_REQUEST['order_id']) : 0;
 if (empty($order_id)) {
     echo 'order_id参数错误';
     exit;
 }
 $arr = array();
 $bonus_list = order_bonus($order_id);
 $bonus_list1 = array();
 $bonus_list2 = array();
 foreach ($bonus_list as $bonus) {
     if ($bonus['is_share'] == 0) {
         $bonus['use_start_date'] = local_date("Y-m-d", $bonus['use_start_date']);
         $bonus['use_end_date'] = local_date("Y-m-d", $bonus['use_end_date']);
         $bonus_list1[] = $bonus;
     } elseif ($bonus['is_share'] == 1) {
         //好友券
         //$bonus_list2[]=$bonus;
     }
 }
 $sql = "select * from " . $hhs->table('send_bonus_type') . " where send_order_id=" . $order_id;
 $send_bonus = $db->getRow($sql);
 $smarty->assign('bonus_list1', $bonus_list1);
开发者ID:shiruolin,项目名称:hzzshop,代码行数:31,代码来源:share_bonus.php


注:本文中的order_bonus函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。