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


PHP order_query_sql函数代码示例

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


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

示例1: get_user_orderinfo

function get_user_orderinfo($is_pagination = true)
{
    global $db, $ecs, $start_date, $end_date;
    $filter['start_date'] = empty($_REQUEST['start_date']) ? $start_date : local_strtotime($_REQUEST['start_date']);
    $filter['end_date'] = empty($_REQUEST['end_date']) ? $end_date : local_strtotime($_REQUEST['end_date']);
    $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'order_num' : trim($_REQUEST['sort_by']);
    $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
    $where = "WHERE u.user_id = o.user_id " . "AND u.user_id > 0 " . order_query_sql('finished', 'o.');
    if ($filter['start_date']) {
        $where .= " AND o.add_time >= '" . $filter['start_date'] . "'";
    }
    if ($filter['end_date']) {
        $where .= " AND o.add_time <= '" . $filter['end_date'] . "'";
    }
    $sql = "SELECT count(distinct(u.user_id)) FROM " . $ecs->table('users') . " AS u, " . $ecs->table('order_info') . " AS o " . $where;
    $filter['record_count'] = $GLOBALS['db']->getOne($sql);
    /* 分页大小 */
    $filter = page_and_size($filter);
    /* 计算订单各种费用之和的语句 */
    $total_fee = " SUM(" . order_amount_field() . ") AS turnover ";
    $sql = "SELECT u.user_id, u.user_name, COUNT(*) AS order_num, " . $total_fee . "FROM " . $ecs->table('users') . " AS u, " . $ecs->table('order_info') . " AS o " . $where . " GROUP BY u.user_id" . " ORDER BY " . $filter['sort_by'] . " " . $filter['sort_order'];
    if ($is_pagination) {
        $sql .= " LIMIT " . $filter['start'] . ', ' . $filter['page_size'];
    }
    $user_orderinfo = array();
    $res = $db->query($sql);
    while ($items = $db->fetchRow($res)) {
        $items['turnover'] = price_format($items['turnover']);
        $user_orderinfo[] = $items;
    }
    $arr = array('user_orderinfo' => $user_orderinfo, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
开发者ID:duynhan07,项目名称:ecshop-vietnam,代码行数:33,代码来源:users_order.php

示例2: click_sold_info

/**
 * 取得访问和购买次数统计数据
 *
 * @param   int             $cat_id          分类编号
 * @param   int             $brand_id        品牌编号
 * @param   int             $show_num        显示个数
 * @return  array           $click_sold_info  访问购买比例数据
 */
function click_sold_info($cat_id, $brand_id, $show_num)
{
    global $db, $ecs;
    $where = " WHERE o.order_id = og.order_id AND g.goods_id = og.goods_id " . order_query_sql('finished', 'o.');
    $limit = " LIMIT " . $show_num;
    if ($cat_id > 0) {
        $where .= " AND " . get_children($cat_id);
    }
    if ($brand_id > 0) {
        $where .= " AND g.brand_id = '{$brand_id}' ";
    }
    $click_sold_info = array();
    $sql = "SELECT og.goods_id, g.goods_sn, g.goods_name, g.click_count,  COUNT(og.goods_id) AS sold_times " . " FROM " . $ecs->table('goods') . " AS g, " . $ecs->table('order_goods') . " AS og, " . $ecs->table('order_info') . " AS o " . $where . " GROUP BY og.goods_id ORDER BY g.click_count DESC " . $limit;
    $res = $db->query($sql);
    while ($item = $db->fetchRow($res)) {
        if ($item['click_count'] <= 0) {
            $item['scale'] = 0;
        } else {
            /* 每一百个点击的订单比率 */
            $item['scale'] = sprintf("%0.2f", $item['sold_times'] / $item['click_count'] * 100) . '%';
        }
        $click_sold_info[] = $item;
    }
    return $click_sold_info;
}
开发者ID:xiaoxiaowu007,项目名称:jicai,代码行数:33,代码来源:visit_sold.php

示例3: get_sales_order

/**
 * 取得销售排行数据信息
 * @param   bool  $is_pagination  是否分页
 * @return  array   销售排行数据
 */
function get_sales_order($is_pagination = true)
{
    $filter['start_date'] = empty($_REQUEST['start_date']) ? '' : local_strtotime($_REQUEST['start_date']);
    $filter['end_date'] = empty($_REQUEST['end_date']) ? '' : local_strtotime($_REQUEST['end_date']);
    $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'goods_num' : trim($_REQUEST['sort_by']);
    $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
    $where = " WHERE og.order_id = oi.order_id " . order_query_sql('finished', 'oi.');
    if ($filter['start_date']) {
        $where .= " AND oi.add_time >= '" . $filter['start_date'] . "'";
    }
    if ($filter['end_date']) {
        $where .= " AND oi.add_time <= '" . $filter['end_date'] . "'";
    }
    $sql = "SELECT COUNT(distinct(og.goods_id)) FROM " . $GLOBALS['ecs']->table('order_info') . ' AS oi,' . $GLOBALS['ecs']->table('order_goods') . ' AS og ' . $where;
    $filter['record_count'] = $GLOBALS['db']->getOne($sql);
    /* 分页大小 */
    $filter = page_and_size($filter);
    $sql = "SELECT og.goods_id, og.goods_sn, og.goods_name, oi.order_status, " . "SUM(og.goods_number) AS goods_num, SUM(og.goods_number * og.goods_price) AS turnover " . "FROM " . $GLOBALS['ecs']->table('order_goods') . " AS og, " . $GLOBALS['ecs']->table('order_info') . " AS oi  " . $where . " GROUP BY og.goods_id " . ' ORDER BY ' . $filter['sort_by'] . ' ' . $filter['sort_order'];
    if ($is_pagination) {
        $sql .= " LIMIT " . $filter['start'] . ', ' . $filter['page_size'];
    }
    $sales_order_data = $GLOBALS['db']->getAll($sql);
    foreach ($sales_order_data as $key => $item) {
        $sales_order_data[$key]['wvera_price'] = price_format($item['goods_num'] ? $item['turnover'] / $item['goods_num'] : 0);
        $sales_order_data[$key]['short_name'] = sub_str($item['goods_name'], 30, true);
        $sales_order_data[$key]['turnover'] = price_format($item['turnover']);
        $sales_order_data[$key]['taxis'] = $key + 1;
    }
    $arr = array('sales_order_data' => $sales_order_data, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
开发者ID:duynhan07,项目名称:ecshop-vietnam,代码行数:36,代码来源:sale_order.php

示例4: assign_sale_history

/**
 * 查询历史记录 
 *
 * @access  public
 * @params  integer     $id
 * @params  integer     $page
 * @return  array
 */
function assign_sale_history($id, $page = 1)
{
    $where_saled = order_query_sql($type = 'finished');
    $sql = 'select COUNT(goods_id) FROM ' . $GLOBALS['ecs']->table('order_goods') . ' as g,' . $GLOBALS['ecs']->table('users') . ' as u, ' . $GLOBALS['ecs']->table('order_info') . ' as f where u.user_id = f.user_id and g.order_id = f.order_id ' . $where_saled . 'and g.goods_id=' . $id . ' order by f.pay_time desc';
    $count = $GLOBALS['db']->getOne($sql);
    $size = !empty($GLOBALS['_CFG']['comments_number']) ? $GLOBALS['_CFG']['comments_number'] : 10;
    $page_count = $count > 0 ? intval(ceil($count / $size)) : 1;
    $sql = 'select u.user_name, g.goods_price, g.goods_number,
 f.pay_time,g.goods_attr FROM ' . $GLOBALS['ecs']->table('order_goods') . ' as g,' . $GLOBALS['ecs']->table('users') . ' as u, ' . $GLOBALS['ecs']->table('order_info') . ' as f where u.user_id = f.user_id and g.order_id = f.order_id ' . $where_saled . 'and g.goods_id=' . $id . ' order by f.pay_time desc';
    $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size);
    $sale_historys = array();
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        $tmp_consignee = utf8Substr($row['user_name'], 0, 1);
        $tmp_consignee .= "<span style='color:#999'>**</span>";
        $tmp_consignee .= utf8Substr($row['user_name'], mb_strlen($row['user_name'], 'utf8') - 1, 1);
        $row['consignee'] = $tmp_consignee;
        $sale_history = array();
        $sale_history['consignee'] = $row['consignee'];
        $sale_history['pay_fee'] = $row['goods_price'];
        $sale_history['goods_number'] = $row['goods_number'];
        $sale_history['pay_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['pay_time']);
        $sale_history['goods_attr'] = $row['goods_attr'];
        $sale_historys[] = $sale_history;
    }
    /* 分页样式 */
    $pager = getBoughtPage(array('currPage' => $page, 'size' => $size, 'count' => $count, 'page_count' => $page_count, 'id' => $id));
    $cmt = array('sale_historys' => $sale_historys, 'pager' => $pager);
    return $cmt;
}
开发者ID:norain2050,项目名称:benhu,代码行数:37,代码来源:lib_main.php

示例5: getsales_history

function getsales_history($goods_id)
{
    $where_saled = order_query_sql($type = 'finished');
    $sql = 'select u.user_name, g.goods_price, g.goods_number,
 f.pay_time,g.goods_attr FROM ' . $GLOBALS['ecs']->table('order_goods') . ' as g,' . $GLOBALS['ecs']->table('users') . ' as u, ' . $GLOBALS['ecs']->table('order_info') . ' as f where u.user_id = f.user_id and g.order_id = f.order_id ' . $where_saled . 'and g.goods_id=' . $goods_id . ' order by f.pay_time desc';
    $res = $GLOBALS['db']->getAll($sql);
    $sales_history = array();
    foreach ($res as $idx => $row) {
        $tmp_consignee = utf8Substr($row['user_name'], 0, 1);
        $tmp_consignee .= "<span style='color:#999'>**</span>";
        $tmp_consignee .= utf8Substr($row['user_name'], mb_strlen($row['user_name'], 'utf8') - 1, 1);
        $row['consignee'] = $tmp_consignee;
        $sales_history[$idx]['consignee'] = $row['consignee'];
        $sales_history[$idx]['pay_fee'] = $row['goods_price'];
        $sales_history[$idx]['goods_number'] = $row['goods_number'];
        $sales_history[$idx]['pay_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['pay_time']);
        $sales_history[$idx]['goods_attr'] = $row['goods_attr'];
    }
    global $smarty;
    $smarty->assign('count_sale_history', count($sales_history));
    return $sales_history;
}
开发者ID:norain2050,项目名称:benhu,代码行数:22,代码来源:lib_order.php

示例6: order_list


//.........这里部分代码省略.........
        if ($filter['district']) {
            $where .= " AND o.district = '{$filter['district']}'";
        }
        if ($filter['shipping_id']) {
            $where .= " AND o.shipping_id  = '{$filter['shipping_id']}'";
        }
        if ($filter['pay_id']) {
            $where .= " AND o.pay_id  = '{$filter['pay_id']}'";
        }
        if ($filter['order_status'] != -1) {
            $where .= " AND o.order_status  = '{$filter['order_status']}'";
        }
        if ($filter['shipping_status'] != -1) {
            $where .= " AND o.shipping_status = '{$filter['shipping_status']}'";
        }
        if ($filter['pay_status'] != -1) {
            $where .= " AND o.pay_status = '{$filter['pay_status']}'";
        }
        if ($filter['user_id']) {
            $where .= " AND o.user_id = '{$filter['user_id']}'";
        }
        if ($filter['user_name']) {
            $where .= " AND u.user_name LIKE '%" . mysql_like_quote($filter['user_name']) . "%'";
        }
        if ($filter['start_time']) {
            $where .= " AND o.add_time >= '{$filter['start_time']}'";
        }
        if ($filter['end_time']) {
            $where .= " AND o.add_time <= '{$filter['end_time']}'";
        }
        //综合状态
        switch ($filter['composite_status']) {
            case CS_AWAIT_PAY:
                $where .= order_query_sql('await_pay');
                break;
            case CS_AWAIT_SHIP:
                $where .= order_query_sql('await_ship');
                break;
            case CS_FINISHED:
                $where .= order_query_sql('finished');
                break;
            case PS_PAYING:
                if ($filter['composite_status'] != -1) {
                    $where .= " AND o.pay_status = '{$filter['composite_status']}' ";
                }
                break;
            case OS_SHIPPED_PART:
                if ($filter['composite_status'] != -1) {
                    $where .= " AND o.shipping_status  = '{$filter['composite_status']}'-2 ";
                }
                break;
            default:
                if ($filter['composite_status'] != -1) {
                    $where .= " AND o.order_status = '{$filter['composite_status']}' ";
                }
        }
        /* 团购订单 */
        if ($filter['group_buy_id']) {
            $where .= " AND o.extension_code = 'group_buy' AND o.extension_id = '{$filter['group_buy_id']}' ";
        }
        /* 如果管理员属于某个办事处,只列出这个办事处管辖的订单 */
        $sql = "SELECT agency_id FROM " . $GLOBALS['ecs']->table('admin_user') . " WHERE user_id = '{$_SESSION['admin_id']}'";
        $agency_id = $GLOBALS['db']->getOne($sql);
        if ($agency_id > 0) {
            $where .= " AND o.agency_id = '{$agency_id}' ";
        }
开发者ID:norain2050,项目名称:benhu,代码行数:67,代码来源:order.php

示例7: action_order_list

function action_order_list()
{
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $_SESSION['user_id'];
    $action = $GLOBALS['action'];
    include_once ROOT_PATH . 'includes/lib_transaction.php';
    include_once ROOT_PATH . 'includes/lib_transaction_1.php';
    include_once ROOT_PATH . 'includes/lib_payment.php';
    include_once ROOT_PATH . 'includes/lib_order.php';
    include_once ROOT_PATH . 'includes/lib_clips.php';
    $ex_where = " and user_id={$user_id}";
    /* 已完成的订单 */
    $order_count['finished'] = $db->GetOne('SELECT COUNT(*) FROM ' . $ecs->table('order_info') . " WHERE 1 {$ex_where} " . order_query_sql('finished'));
    $status['finished'] = CS_FINISHED;
    /* 待发货的订单: */
    $order_count['await_ship'] = $db->GetOne('SELECT COUNT(*)' . ' FROM ' . $ecs->table('order_info') . " WHERE 1 {$ex_where} " . order_query_sql('await_ship'));
    $status['await_ship'] = CS_AWAIT_SHIP;
    /* 待付款的订单: */
    $order_count['await_pay'] = $db->GetOne('SELECT COUNT(*)' . ' FROM ' . $ecs->table('order_info') . " WHERE 1 {$ex_where} " . order_query_sql('await_pay'));
    $status['await_pay'] = CS_AWAIT_PAY;
    /* “未确认”的订单 */
    $order_count['unconfirmed'] = $db->GetOne('SELECT COUNT(*) FROM ' . $ecs->table('order_info') . " WHERE 1 {$ex_where} " . order_query_sql('unconfirmed'));
    $status['unconfirmed'] = OS_UNCONFIRMED;
    // $today_start = mktime(0,0,0,date('m'),date('d'),date('Y'));
    $order_count['stats'] = $db->getRow('SELECT COUNT(*) AS oCount, IFNULL(SUM(order_amount), 0) AS oAmount' . ' FROM ' . $ecs->table('order_info'));
    $smarty->assign('order_count', $order_count);
    $smarty->assign('status', $status);
    $composite_status = isset($_REQUEST['composite_status']) ? intval($_REQUEST['composite_status']) : -1;
    $where = '';
    switch ($composite_status) {
        case CS_AWAIT_PAY:
            $where .= order_query_sql('await_pay');
            break;
        case CS_AWAIT_SHIP:
            $where .= order_query_sql('await_ship');
            break;
        case CS_FINISHED:
            $where .= order_query_sql('finished');
            break;
        default:
            if ($composite_status != -1) {
                $where .= " AND o.order_status = '{$composite_status}' ";
            }
    }
    $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, 'composite_status' => $composite_status), $record_count, $page, 5);
    $orders = get_user_orders_1($user_id, $pager['size'], $pager['start'], $where);
    foreach ($orders as $k_kuaidi => $v_kuaidi) {
        // 同城快递
        if ($v_kuaidi['shipping_name_2'] == "同城快递") {
            $kos_order_id = $db->getOne("select order_id from " . $ecs->table('kuaidi_order') . " where order_sn='" . $v_kuaidi['invoice_no'] . "'");
            $sql = "select * from " . $ecs->table('kuaidi_order_status') . " where order_id='" . $kos_order_id . "'  order by status_id desc";
            $res_status = $db->query($sql);
            $have_shipping_info = 0;
            $shipping_info = "";
            while ($row_status = $db->fetchRow($res_status)) {
                if ($row_status['status_display'] == 1) {
                    switch ($row_status['status_id']) {
                        case 1:
                            $shipping_info .= "您提交了订单,请等待确认。 (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")";
                            break;
                        case 2:
                            $shipping_info .= "您的快件已经确认,等待快递员揽收。 (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")";
                            break;
                        case 3:
                            $postman_id = $db->getOne("select postman_id from " . $ecs->table('kuaidi_order') . " where order_sn='" . $orders[$k_kuaidi]['invoice_no'] . "'");
                            $postman_info = $db->getRow("select postman_name, mobile from " . $ecs->table('postman') . " where postman_id=" . $postman_id);
                            $shipping_info .= "您的快件正在派送,快递员:" . $postman_info['postman_name'] . ",电话:" . $postman_info['mobile'] . " (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")";
                            break;
                        case 4:
                            $shipping_info .= "您的快件已经签收。 (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")";
                            break;
                        case 5:
                            $shipping_info .= "您的快件已被拒收。 (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")";
                            break;
                        case 6:
                            $shipping_info .= "您拒收的快件已被退回。 (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")";
                            break;
                        case 7:
                            $shipping_info .= "您的快件已经取消。 (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")";
                            break;
                    }
                    $shipping_info .= "<br>";
                    if ($row_status['status_id'] >= 1) {
                        $have_shipping_info++;
                    }
                }
            }
            if ($have_shipping_info) {
                $orders[$k_kuaidi]['result_content'] = $shipping_info;
            } else {
                $orders[$k_kuaidi]['result_content'] = '抱歉,暂时还没有该运单的物流信息哦!';
            }
        }
//.........这里部分代码省略.........
开发者ID:seanguo166,项目名称:yinoos,代码行数:101,代码来源:user.php

示例8: COUNT

    /* 待发货的订单: */
    $order['await_ship']   = $db->GetOne('SELECT COUNT(*)'.
    ' FROM ' .$ecs->table('order_info') .
    " WHERE 1 " . order_query_sql('await_ship'));
    $status['await_ship']  = CS_AWAIT_SHIP;
    
    /* 待付款的订单: */
    $order['await_pay']    = $db->GetOne('SELECT COUNT(*)'.
    ' FROM ' .$ecs->table('order_info') .
    " WHERE 1 " . order_query_sql('await_pay'));
    $status['await_pay']   = CS_AWAIT_PAY;

    /* "未确认"的订单 */
    $order['unconfirmed']  = $db->GetOne('SELECT COUNT(*) FROM ' .$ecs->table('order_info').
    " WHERE 1 " . order_query_sql('unconfirmed'));
    $status['unconfirmed'] = OS_UNCONFIRMED;

    /* "部分发货"的订单 */
    $order['shipped_part']  = $db->GetOne('SELECT COUNT(*) FROM ' .$ecs->table('order_info').
    " WHERE  shipping_status=" .SS_SHIPPED_PART);
    $status['shipped_part'] = OS_SHIPPED_PART;

//    $today_start = mktime(0,0,0,date('m'),date('d'),date('Y'));
    $order['stats']        = $db->getRow('SELECT COUNT(*) AS oCount, IFNULL(SUM(order_amount), 0) AS oAmount' .
    ' FROM ' .$ecs->table('order_info'));

    $smarty->assign('order', $order);
    $smarty->assign('status', $status);

    /* 商品信息 */
开发者ID:blowfishJ,项目名称:galaxyCode,代码行数:30,代码来源:index.php

示例9: get_user_merge

 /**
  *  获取用户可以和并的订单数组
  *
  * @access  public
  * @param   int         $user_id        用户ID
  *
  * @return  array       $merge          可合并订单数组
  */
 function get_user_merge($user_id)
 {
     $sql = "SELECT order_sn FROM " . $this->pre . "order_info WHERE user_id  = '{$user_id}' " . order_query_sql('unprocessed') . "AND extension_code = '' " . " ORDER BY add_time DESC";
     $list = $this->query($sql);
     $merge = array();
     foreach ($list as $key => $value) {
         $merge[$value['order_sn']] = $value['order_sn'];
     }
     return $merge;
 }
开发者ID:m7720647,项目名称:demo,代码行数:18,代码来源:UsersModel.class.php

示例10: order_list


//.........这里部分代码省略.........
            $where .= " AND o.order_status  = '{$filter['order_status']}'";
        }
        if ($filter['shipping_status'] != -1) {
            $where .= " AND o.shipping_status = '{$filter['shipping_status']}'";
        }
        if ($filter['pay_status'] != -1) {
            $where .= " AND o.pay_status = '{$filter['pay_status']}'";
        }
        if ($filter['user_id']) {
            $where .= " AND o.user_id = '{$filter['user_id']}'";
        }
        if ($filter['user_name']) {
            $where .= " AND u.user_name LIKE '%" . mysql_like_quote($filter['user_name']) . "%'";
        }
        if ($filter['start_time']) {
            $where .= " AND o.add_time >= '{$filter['start_time']}'";
        }
        if ($filter['end_time']) {
            $where .= " AND o.add_time <= '{$filter['end_time']}'";
        }
        /* 代码增加_start   By www.ecshop68.com */
        switch ($filter['order_type']) {
            case 1:
                $where .= " AND o.is_pickup = 0";
                break;
            case 2:
                $where .= " AND o.is_pickup > 0";
                break;
        }
        /* 代码增加_end   By www.ecshop68.com */
        //综合状态
        switch ($filter['composite_status']) {
            case CS_AWAIT_PAY:
                $where .= order_query_sql('await_pay');
                break;
            case CS_AWAIT_SHIP:
                $where .= order_query_sql('await_ship');
                break;
            case CS_FINISHED:
                $where .= order_query_sql('finished');
                break;
            case PS_PAYING:
                if ($filter['composite_status'] != -1) {
                    $where .= " AND o.pay_status = '{$filter['composite_status']}' ";
                }
                break;
            case OS_SHIPPED_PART:
                if ($filter['composite_status'] != -1) {
                    $where .= " AND o.shipping_status  = '{$filter['composite_status']}'-2 ";
                }
                break;
            default:
                if ($filter['composite_status'] != -1) {
                    $where .= " AND o.order_status = '{$filter['composite_status']}' ";
                }
        }
        /* 团购订单 */
        if ($filter['group_buy_id']) {
            $where .= " AND o.extension_code = 'group_buy' AND o.extension_id = '{$filter['group_buy_id']}' ";
        }
        /* 如果管理员属于某个办事处,只列出这个办事处管辖的订单 */
        $sql = "SELECT agency_id FROM " . $GLOBALS['ecs']->table('admin_user') . " WHERE user_id = '{$_SESSION['admin_id']}'";
        $agency_id = $GLOBALS['db']->getOne($sql);
        if ($agency_id > 0) {
            $where .= " AND o.agency_id = '{$agency_id}' ";
        }
开发者ID:moonlight-wang,项目名称:feilun,代码行数:67,代码来源:order.php

示例11: COUNT

     $rows['order_num'] = $db->getOne($sql2);
     /* 当前广告所产生的已完成的有效订单 */
     $sql3 = "SELECT COUNT(order_id) FROM " . $ecs->table('order_info') . " WHERE from_ad    = '{$rows['ad_id']}'" . " AND referer = '{$rows['referer']}' " . order_query_sql('finished');
     $rows['order_confirm'] = $db->getOne($sql3);
     $ads_stats[] = $rows;
 }
 $smarty->assign('ads_stats', $ads_stats);
 /* 站外JS投放商品的统计数据 */
 $goods_stats = array();
 $goods_sql = "SELECT from_ad, referer, clicks FROM " . $ecs->table('adsense') . " WHERE from_ad = '-1' ORDER by referer DESC";
 $goods_res = $db->query($goods_sql);
 while ($rows2 = $db->fetchRow($goods_res)) {
     /* 获取当前广告所产生的订单总数 */
     $rows2['order_num'] = $db->getOne("SELECT COUNT(order_id) FROM " . $ecs->table('order_info') . " WHERE referer='{$rows2['referer']}'");
     /* 当前广告所产生的已完成的有效订单 */
     $sql = "SELECT COUNT(order_id) FROM " . $ecs->table('order_info') . " WHERE referer='{$rows2['referer']}'" . order_query_sql('finished');
     $rows2['order_confirm'] = $db->getOne($sql);
     $rows2['ad_name'] = $_LANG['adsense_js_goods'];
     $goods_stats[] = $rows2;
 }
 if ($_REQUEST['act'] == 'download') {
     header("Content-type: application/vnd.ms-excel; charset=utf-8");
     header("Content-Disposition: attachment; filename=ad_statistics.xls");
     $data = "{$_LANG['adsense_name']}\t{$_LANG['cleck_referer']}\t{$_LANG['click_count']}\t{$_LANG['confirm_order']}\t{$_LANG['gen_order_amount']}\n";
     $res = array_merge($goods_stats, $ads_stats);
     foreach ($res as $row) {
         $data .= "{$row['ad_name']}\t{$row['referer']}\t{$row['clicks']}\t{$row['order_confirm']}\t{$row['order_num']}\n";
     }
     echo ecs_iconv(EC_CHARSET, 'GB2312', $data);
     exit;
 }
开发者ID:duynhan07,项目名称:ecshop-vietnam,代码行数:31,代码来源:adsense.php

示例12: json_encode

 $froms_series[0]['data'] = $froms_data;
 $froms_options['tooltip'] = $froms_tooltip;
 $froms_options['legend'] = $froms_legend;
 $froms_options['toolbox'] = $froms_toolbox;
 $froms_options['calculabe'] = $froms_calculable;
 $froms_options['series'] = $froms_series;
 $smarty->assign('froms_option', json_encode($froms_options));
 //当月每日订单数统计
 $orders_tooltip = array('trigger' => 'axis');
 $orders_legend = array('data' => array());
 $orders_toolbox = array('show' => true, 'x' => 'right', 'feature' => array('magicType' => array('show' => true, 'type' => array('line', 'bar')), 'restore' => array('show' => true), 'saveAsImage' => array('show' => true)));
 $orders_calculable = true;
 $orders_xAxis = array('type' => 'category', 'boundryGap' => false, 'data' => array());
 $orders_yAxis = array('type' => 'value', 'axisLabel' => array('formatter' => '{value}个'));
 $orders_series = array(array('name' => '订单个数', 'type' => 'line', 'data' => array(), 'markPoint' => array('data' => array(array('type' => 'max', 'name' => '最大值'), array('type' => 'min', 'name' => '最小值'))), 'markLine' => array('data' => array(array('type' => 'average', 'name' => '平均值')))));
 $result = $db->query('SELECT DATE_FORMAT(FROM_UNIXTIME(`confirm_time`),"%d") AS day,COUNT(*) AS count,SUM(money_paid) AS money FROM ' . $ecs->table('order_info') . ' WHERE `confirm_time` BETWEEN ' . $month_start . ' AND ' . $month_end . ' ' . order_query_sql('finished') . '  AND supplier_id=' . $_SESSION['supplier_id'] . ' GROUP BY day ORDER BY day ASC ');
 while ($row = mysql_fetch_assoc($result)) {
     $orders_series_data[intval($row['day'])] = intval($row['count']);
     $sales_series_data[intval($row['day'])] = floatval($row['money']);
 }
 for ($i = 1; $i <= date('d'); $i++) {
     if (empty($orders_series_data[$i])) {
         $orders_series_data[$i] = 0;
         $sales_series_data[$i] = 0;
     }
     $orders_xAxis_data[] = $i;
     $sales_xAxis_data[] = $i;
 }
 $orders_xAxis['data'] = $orders_xAxis_data;
 ksort($orders_series_data);
 $orders_series[0]['data'] = array_values($orders_series_data);
开发者ID:firsteam,项目名称:falcons,代码行数:31,代码来源:index.php

示例13: COUNT

 $sql = "SELECT COUNT(*) FROM " . $ecs->table("users");
 $res = $db->getCol($sql);
 $user_num = $res[0];
 /* 计算订单各种费用之和的语句 */
 $total_fee = " SUM(" . order_amount_field() . ") AS turnover ";
 /* 有过订单的会员数 */
 $sql = 'SELECT COUNT(DISTINCT user_id) FROM ' . $ecs->table('order_info') . " WHERE user_id > 0 " . order_query_sql('finished');
 $have_order_usernum = $db->getOne($sql);
 /* 会员订单总数和订单总购物额 */
 $user_all_order = array();
 $sql = "SELECT COUNT(*) AS order_num, " . $total_fee . "FROM " . $ecs->table('order_info') . " WHERE user_id > 0 " . order_query_sql('finished');
 $user_all_order = $db->getRow($sql);
 $user_all_order['turnover'] = floatval($user_all_order['turnover']);
 /* 匿名会员订单总数和总购物额 */
 $guest_all_order = array();
 $sql = "SELECT COUNT(*) AS order_num, " . $total_fee . "FROM " . $ecs->table('order_info') . " WHERE user_id = 0 " . order_query_sql('finished');
 $guest_all_order = $db->getRow($sql);
 /* 匿名会员平均订单额: 购物总额/订单数 */
 $guest_order_amount = $guest_all_order['order_num'] > 0 ? floatval($guest_all_order['turnover'] / $guest_all_order['order_num']) : '0.00';
 $_GET['flag'] = isset($_GET['flag']) ? 'download' : '';
 if ($_GET['flag'] == 'download') {
     $filename = ecs_iconv(EC_CHARSET, 'GB2312', $_LANG['guest_statistics']);
     header("Content-type: application/vnd.ms-excel; charset=utf-8");
     header("Content-Disposition: attachment; filename={$filename}.xls");
     /* 生成会员购买率 */
     $data = $_LANG['percent_buy_member'] . "\t\n";
     $data .= $_LANG['member_count'] . "\t" . $_LANG['order_member_count'] . "\t" . $_LANG['member_order_count'] . "\t" . $_LANG['percent_buy_member'] . "\n";
     $data .= $user_num . "\t" . $have_order_usernum . "\t" . $user_all_order['order_num'] . "\t" . sprintf("%0.2f", ($user_num > 0 ? $have_order_usernum / $user_num : 0) * 100) . "\n\n";
     /* 每会员平均订单数及购物额 */
     $data .= $_LANG['order_turnover_peruser'] . "\t\n";
     $data .= $_LANG['member_sum'] . "\t" . $_LANG['average_member_order'] . "\t" . $_LANG['member_order_sum'] . "\n";
开发者ID:dw250100785,项目名称:ECShop-1,代码行数:31,代码来源:guest_stats.php

示例14: get_user_default

 /**
  * 获取用户中心默认页面所需的数据
  * @access  public
  * @param   int         $user_id            用户ID
  * @return  array       $info               默认页面所需资料数组
  */
 public function get_user_default($user_id)
 {
     $sql = "SELECT pay_points, user_money, credit_line, last_login, is_validated,user_rank  FROM " . $this->pre . "users WHERE user_id = '{$user_id}'";
     $row = $this->row($sql);
     $info = array();
     $info['username'] = stripslashes($_SESSION['user_name']);
     $info['shop_name'] = C('shop_name');
     $info['integral'] = $row['pay_points'] . C('integral_name');
     /* 增加是否开启会员邮件验证开关 */
     $info['is_validate'] = C('member_email_validate') && !$row['is_validated'] ? 0 : 1;
     $info['credit_line'] = $row['credit_line'];
     $info['formated_credit_line'] = price_format($info['credit_line'], false);
     //新增获取用户头像,昵称
     $u_row = '';
     if (class_exists('WechatController')) {
         if (method_exists('WechatController', 'get_avatar')) {
             $u_row = call_user_func(array('WechatController', 'get_avatar'), $user_id);
         }
     }
     if ($u_row) {
         $info['nickname'] = $u_row['nickname'];
         $info['headimgurl'] = $u_row['headimgurl'];
     } else {
         $info['nickname'] = $info['username'];
         $info['headimgurl'] = __PUBLIC__ . '/images/get_avatar.png';
     }
     //如果$_SESSION中时间无效说明用户是第一次登录。取当前登录时间。
     $last_time = !isset($_SESSION['last_time']) ? $row['last_login'] : $_SESSION['last_time'];
     if ($last_time == 0) {
         $_SESSION['last_time'] = $last_time = gmtime();
     }
     $info['last_time'] = local_date(C('time_format'), $last_time);
     $info['surplus'] = price_format($row['user_money'], false);
     $this->table = 'order_info';
     $condition = "user_id = '" . $user_id . "' AND add_time > '" . local_strtotime('-1 months') . "'";
     $info['order_count'] = $this->count($condition);
     $condition = "user_id = '" . $user_id . "' AND shipping_time > '" . $last_time . "'" . order_query_sql('shipped');
     $info['shipped_order'] = $this->select($condition, 'order_id, order_sn');
     $info['user_rank'] = $row['user_rank'];
     return $info;
 }
开发者ID:noikiy,项目名称:shop-3,代码行数:47,代码来源:ClipsBaseModel.class.php

示例15: _wap_await_pay_count

function _wap_await_pay_count()
{
    global $db, $ecs;
    $await_pay = $db->GetOne('SELECT COUNT(*) FROM ' . $ecs->table('order_info') . ' WHERE 1 ' . order_query_sql('await_pay') . ' AND supplier_id=' . $_SESSION['supplier_id']);
    return $await_pay;
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:6,代码来源:lib_supplier_common_wap.php


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