示例#1
0
文件: user.php 项目: norain2050/benhu
    $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1;
    /* 获取用户留言的数量 */
    $sql = "SELECT COUNT(*) FROM " . $ecs->table('comment') . " WHERE parent_id = 0 AND user_id = '{$user_id}'";
    $record_count = $db->getOne($sql);
    $pager = get_pager('user.php', array('act' => $action), $record_count, $page, 15);
    $rank = get_rank_info();
    $smarty->assign('info', get_user_default($user_id));
    //用户信息
    $smarty->assign('vip_name', $rank['rank_name']);
    // 用户名
    $smarty->assign('comment_list', get_comment_list($user_id, $pager['size'], $pager['start']));
    $smarty->assign('pager', $pager);
    $smarty->display('user_clips.dwt');
} elseif ($action == 'coupons') {
    require_once 'includes/cls_coupon.php';
    $couponsConditions = coupon::getCouponsConditions();
    $coupons_list = array();
    foreach ($couponsConditions as $key => $con) {
        $coupons_list[$key] = get_coupons_list($user_id, $key, $con);
    }
    $smarty->assign('coupons_list', $coupons_list);
    $smarty->display('user_clips.dwt');
} elseif ($action == 'return_goods') {
    include_once ROOT_PATH . 'includes/lib_clips.php';
    $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1;
    /* 获取用户退款申请的总记录数 */
    $sql = "SELECT COUNT(*) FROM " . $ecs->table('back_order') . " WHERE is_cancled=0 and user_id=" . $user_id;
    $record_count = $db->getOne($sql);
    $pager = get_pager('user.php', array('act' => $action), $record_count, $page, 5);
    $rank = get_rank_info();
    $smarty->assign('info', get_user_default($user_id));
示例#2
0
            $result['coupon_id'] = $coupon_id;
            $result['info'] = '您已经成功领取。';
            $result['action'] = ' 您还可以<a href="#">查看我的购物券</a>&nbsp;&nbsp;&nbsp;<a href="' . $staticPages['index'] . '">现在去购物</a>';
        } else {
            $result['error'] = 1;
            $result['info'] = '未知错误。';
            $result['action'] = ' 您可以尝试再次领取,或者联系客服!';
        }
    }
    die(json_encode($result));
} elseif ('userCenterGotoPage' == $act) {
    require_once 'includes/cls_coupon.php';
    require_once 'includes/lib_clips.php';
    $type = trim($_REQUEST['type']);
    $page = intval(trim($_REQUEST['page']));
    $couponCon = coupon::getCouponsConditions($type);
    $coupons = get_coupons_list($_SESSION['user_id'], $type, $couponCon, $page);
    $result = array('location' => 'coupons', 'type' => $type, 'coupons' => $coupons);
    die(json_encode($result));
}
function get_coupons_sql()
{
    $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('coupons') . " WHERE is_display = 1 ORDER BY coupon_id DESC LIMIT 9";
    return $sql;
}
function get_coupons()
{
    $sql = get_coupons_sql();
    $coupons = $GLOBALS['db']->getAll($sql);
    foreach ($coupons as $key => $value) {
        $coupons[$key]['validate_time'] = local_date("Y年m月d日", $value['validate_time']);