コード例 #1
0
/**
 * 取得销售排行数据信息
 * @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;
}
コード例 #2
0
ファイル: lib_common.php プロジェクト: norain2050/benhu
function getDawnTime()
{
    $now = gmtime();
    $date = local_date('Y-m-d 0:0:0', $now);
    $now = local_strtotime($date);
    return $now;
}
コード例 #3
0
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;
}
コード例 #4
0
ファイル: stock_control_log.php プロジェクト: dlpc/ecshop
function get_stock_control_log()
{
    $result = get_filter();
    if ($result === false) {
        $filter = array();
        $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
        $filter['admin_agency_id'] = empty($_REQUEST['admin_agency_id']) ? '' : trim($_REQUEST['admin_agency_id']);
        if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
            $filter['keyword'] = json_str_iconv($filter['keyword']);
        }
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'a.id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $filter['start_date'] = empty($_REQUEST['start_date']) ? local_strtotime('-30 days') : $_REQUEST['start_date'];
        $filter['end_date'] = empty($_REQUEST['end_date']) ? local_strtotime('today') : $_REQUEST['end_date'];
        if (strpos($filter['start_date'], '-') !== false) {
            $filter['start_date'] = local_strtotime($filter['start_date']);
            $filter['end_date'] = local_strtotime($filter['end_date']);
        }
        $where = agency_where();
        /*add by hg for date 2014-04-21 可选商品*/
        if (if_agency()) {
            if (!empty($filter['admin_agency_id'])) {
                $where .= " AND (a.admin_agency_id = {$filter['admin_agency_id']} ) ";
            } else {
                $where .= " AND (a.admin_agency_id = 0 ) ";
            }
        }
        if (!empty($filter['keyword'])) {
            $where .= " AND (a.goods_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%'  or a.stock_number LIKE '%" . mysql_like_quote($filter['keyword']) . "%' )";
        }
        if ($filter['start_date']) {
            $where = $where . " AND a.log_time >= '{$filter['start_date']}'";
        }
        if ($filter['end_date']) {
            $where = $where . " AND a.log_time <= '" . ($filter['end_date'] + 86400) . "'";
        }
        $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('stock_control_log') . ' AS a ' . 'WHERE 1 ' . $where;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter = page_and_size($filter);
        /* 获取库存日志管理数据 */
        $sql = 'SELECT a.*  ' . 'FROM ' . $GLOBALS['ecs']->table('stock_control_log') . ' AS a ' . 'WHERE 1 ' . $where . ' ORDER by ' . $filter['sort_by'] . ' ' . $filter['sort_order'];
        $filter['keyword'] = stripslashes($filter['keyword']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $arr = array();
    $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
    while ($rows = $GLOBALS['db']->fetchRow($res)) {
        $rows['date'] = local_date($GLOBALS['_CFG']['time_format'], $rows['log_time']);
        $rows['out_type_remarks'] = $GLOBALS['db']->getOne("SELECT remarks FROM " . $GLOBALS['ecs']->table('stock_out_type') . " WHERE id = '" . $rows['out_type_id'] . "' ");
        $arr[] = $rows;
    }
    $GLOBALS['smarty']->assign('start_date', local_date('Y-m-d', $filter['start_date']));
    $GLOBALS['smarty']->assign('end_date', local_date('Y-m-d', $filter['end_date']));
    $filter['start_date'] = local_date('Y-m-d', $filter['start_date']);
    $filter['end_date'] = local_date('Y-m-d', $filter['end_date']);
    return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
コード例 #5
0
ファイル: sale_list.php プロジェクト: a494008974/bzbshop
/**
 * 取得销售明细数据信息
 * @param   bool  $is_pagination  是否分页
 * @return  array   销售明细数据
 */
function get_sale_list($is_pagination = true)
{
    /* 时间参数 */
    $filter['start_date'] = empty($_REQUEST['start_date']) ? local_strtotime('-7 days') : local_strtotime($_REQUEST['start_date']);
    $filter['end_date'] = empty($_REQUEST['end_date']) ? local_strtotime('today') : local_strtotime($_REQUEST['end_date']);
    /* 查询数据的条件 */
    $where = " WHERE og.order_id = oi.order_id" . order_query_sql('finished', 'oi.') . " AND oi.add_time >= '" . $filter['start_date'] . "' AND oi.add_time < '" . ($filter['end_date'] + 86400) . "'";
    $sql = "SELECT COUNT(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, og.goods_number AS goods_num, og.goods_price ' . 'AS sales_price, oi.add_time AS sales_time, oi.order_id, oi.order_sn ' . "FROM " . $GLOBALS['ecs']->table('order_goods') . " AS og, " . $GLOBALS['ecs']->table('order_info') . " AS oi " . $where . " ORDER BY sales_time DESC, goods_num DESC";
    if ($is_pagination) {
        $sql .= " LIMIT " . $filter['start'] . ', ' . $filter['page_size'];
    }
    $sale_list_data = $GLOBALS['db']->getAll($sql);
    foreach ($sale_list_data as $key => $item) {
        $sale_list_data[$key]['sales_price'] = price_format($sale_list_data[$key]['sales_price']);
        $sale_list_data[$key]['sales_time'] = local_date($GLOBALS['_CFG']['time_format'], $sale_list_data[$key]['sales_time']);
    }
    $arr = array('sale_list_data' => $sale_list_data, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
コード例 #6
0
ファイル: cron.php プロジェクト: a494008974/bzbshop
function get_next_time($cron)
{
    $y = local_date('Y', $GLOBALS['timestamp']);
    $mo = local_date('n', $GLOBALS['timestamp']);
    $d = local_date('j', $GLOBALS['timestamp']);
    $w = local_date('w', $GLOBALS['timestamp']);
    $h = local_date('G', $GLOBALS['timestamp']);
    $sh = $sm = 0;
    $sy = $y;
    if ($cron['day']) {
        $sd = $cron['day'];
        $smo = $mo + 1;
    } else {
        $sd = $d;
        $smo = $mo;
        if ($cron['week'] != '') {
            $sd += $cron['week'] - $w + 7;
        }
    }
    if ($cron['hour']) {
        $sh = $cron['hour'];
        if (empty($cron['day']) && $cron['week'] == '') {
            $sd++;
        }
    }
    //$next = gmmktime($sh,$sm,0,$smo,$sd,$sy);
    $next = local_strtotime("{$sy}-{$smo}-{$sd} {$sh}:{$sm}:0");
    if ($next < $GLOBALS['timestamp']) {
        if ($cron['m']) {
            return $GLOBALS['timestamp'] + 60 - intval(local_date('s', $GLOBALS['timestamp']));
        } else {
            return $GLOBALS['timestamp'];
        }
    } else {
        return $next;
    }
}
コード例 #7
0
 /**
  * 更新商品销量
  */
 private function update_touch_goods($order)
 {
     $sql = 'select pay_status from ' . $this->model->pre . 'order_info where  order_id = "' . $order . '"';
     $pay_status = $this->model->query($sql);
     $pay_status = $pay_status[0];
     if ($pay_status == 2) {
         /* 统计时间段 */
         $period = C('top10_time');
         // 近一个月(30天)
         if ($period == 1) {
             // 一年
             $ext = " AND o.add_time > '" . local_strtotime('-1 years') . "'";
         } elseif ($period == 2) {
             // 半年
             $ext = " AND o.add_time > '" . local_strtotime('-6 months') . "'";
         } elseif ($period == 3) {
             // 三个月
             $ext = " AND o.add_time > '" . local_strtotime('-3 months') . "'";
         } elseif ($period == 4) {
             // 一个月
             $ext = " AND o.add_time > '" . local_strtotime('-1 months') . "'";
         } else {
             $ext = '';
         }
         $sql = 'select goods_id from ' . $this->model->pre . 'order_info where  order_id = "' . $order . '"';
         $arrGoodsid = $this->model->query($sql);
         $sql = 'select extension_code from ' . $this->model->pre . 'order_info where  order_id = "' . $order . '"';
         $extension_code = $this->model->query($sql);
         if ($extension_code == '') {
             foreach ($arrGoodsid as $key => $val) {
                 /* 查询该商品销量 */
                 $sql = 'SELECT IFNULL(SUM(g.goods_number), 0) ' . 'as count FROM ' . $this->pre . 'order_info AS o, ' . $this->pre . 'order_goods AS g ' . "WHERE o.order_id = g.order_id " . "  AND g.goods_id = '" . $val['goods_id'] . "' AND o.pay_status = '2' " . $ext;
                 $res = $this->model->query($sql);
                 $sales_count = $res[0]['count'];
                 $nCount = $this->query('select COUNT(*) from ' . $this->model->pre . 'touch_goods where  goods_id = "' . $val['goods_id'] . '"');
                 if ($nCount[0]['COUNT(*)'] == 0) {
                     $this->model->query("INSERT INTO " . $this->model->pre . "touch_goods (`goods_id` ,`sales_volume` ) VALUES ( '" . $val['goods_id'] . "' , '0')");
                 }
                 $sql = 'update ' . $this->model->pre . 'touch_goods AS a set a.sales_volume = ' . $sales_count . " WHERE goods_id=" . $val['goods_id'];
                 $this->model->query($sql);
             }
         }
     }
 }
コード例 #8
0
ファイル: goods.php プロジェクト: blowfishJ/galaxyCode
/**
 * 获得指定商品的销售排名
 *
 * @access  public
 * @param   integer     $goods_id
 * @return  integer
 */
function get_goods_rank($goods_id)
{
    /* 统计时间段 */
    $period = intval($GLOBALS['_CFG']['top10_time']);
    if ($period == 1) {
        $ext = " AND o.add_time > '" . local_strtotime('-1 years') . "'";
    } elseif ($period == 2) {
        $ext = " AND o.add_time > '" . local_strtotime('-6 months') . "'";
    } elseif ($period == 3) {
        $ext = " AND o.add_time > '" . local_strtotime('-3 months') . "'";
    } elseif ($period == 4) {
        $ext = " AND o.add_time > '" . local_strtotime('-1 months') . "'";
    } else {
        $ext = '';
    }
    /* 查询该商品销量 */
    $sql = 'SELECT IFNULL(SUM(g.goods_number), 0) ' . 'FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS o, ' . $GLOBALS['ecs']->table('order_goods') . ' AS g ' . "WHERE o.order_id = g.order_id " . "AND o.order_status = '" . OS_CONFIRMED . "' " . "AND o.shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) . " AND o.pay_status " . db_create_in(array(PS_PAYED, PS_PAYING)) . " AND g.goods_id = '{$goods_id}'" . $ext;
    $sales_count = $GLOBALS['db']->getOne($sql);
    if ($sales_count > 0) {
        /* 只有在商品销售量大于0时才去计算该商品的排行 */
        $sql = 'SELECT DISTINCT SUM(goods_number) AS num ' . 'FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS o, ' . $GLOBALS['ecs']->table('order_goods') . ' AS g ' . "WHERE o.order_id = g.order_id " . "AND o.order_status = '" . OS_CONFIRMED . "' " . "AND o.shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) . " AND o.pay_status " . db_create_in(array(PS_PAYED, PS_PAYING)) . $ext . " GROUP BY g.goods_id HAVING num > {$sales_count}";
        $res = $GLOBALS['db']->query($sql);
        $rank = $GLOBALS['db']->num_rows($res) + 1;
        if ($rank > 10) {
            $rank = 0;
        }
    } else {
        $rank = 0;
    }
    return $rank;
}
コード例 #9
0
ファイル: order.php プロジェクト: norain2050/benhu
/**
 *  获取订单列表信息
 *
 * @access  public
 * @param
 *
 * @return void
 */
function order_list()
{
    $result = get_filter();
    if ($result === false) {
        /* 过滤信息 */
        $filter['order_sn'] = empty($_REQUEST['order_sn']) ? '' : trim($_REQUEST['order_sn']);
        if (!empty($_GET['is_ajax']) && $_GET['is_ajax'] == 1) {
            $_REQUEST['consignee'] = json_str_iconv($_REQUEST['consignee']);
            //$_REQUEST['address'] = json_str_iconv($_REQUEST['address']);
        }
        $filter['consignee'] = empty($_REQUEST['consignee']) ? '' : trim($_REQUEST['consignee']);
        $filter['email'] = empty($_REQUEST['email']) ? '' : trim($_REQUEST['email']);
        $filter['address'] = empty($_REQUEST['address']) ? '' : trim($_REQUEST['address']);
        $filter['zipcode'] = empty($_REQUEST['zipcode']) ? '' : trim($_REQUEST['zipcode']);
        $filter['tel'] = empty($_REQUEST['tel']) ? '' : trim($_REQUEST['tel']);
        $filter['mobile'] = empty($_REQUEST['mobile']) ? 0 : intval($_REQUEST['mobile']);
        $filter['country'] = empty($_REQUEST['country']) ? 0 : intval($_REQUEST['country']);
        $filter['province'] = empty($_REQUEST['province']) ? 0 : intval($_REQUEST['province']);
        $filter['city'] = empty($_REQUEST['city']) ? 0 : intval($_REQUEST['city']);
        $filter['district'] = empty($_REQUEST['district']) ? 0 : intval($_REQUEST['district']);
        $filter['shipping_id'] = empty($_REQUEST['shipping_id']) ? 0 : intval($_REQUEST['shipping_id']);
        $filter['pay_id'] = empty($_REQUEST['pay_id']) ? 0 : intval($_REQUEST['pay_id']);
        $filter['order_status'] = isset($_REQUEST['order_status']) ? intval($_REQUEST['order_status']) : -1;
        $filter['shipping_status'] = isset($_REQUEST['shipping_status']) ? intval($_REQUEST['shipping_status']) : -1;
        $filter['pay_status'] = isset($_REQUEST['pay_status']) ? intval($_REQUEST['pay_status']) : -1;
        $filter['user_id'] = empty($_REQUEST['user_id']) ? 0 : intval($_REQUEST['user_id']);
        $filter['user_name'] = empty($_REQUEST['user_name']) ? '' : trim($_REQUEST['user_name']);
        $filter['composite_status'] = isset($_REQUEST['composite_status']) ? intval($_REQUEST['composite_status']) : -1;
        $filter['group_buy_id'] = isset($_REQUEST['group_buy_id']) ? intval($_REQUEST['group_buy_id']) : 0;
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'add_time' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $filter['start_time'] = empty($_REQUEST['start_time']) ? '' : (strpos($_REQUEST['start_time'], '-') > 0 ? local_strtotime($_REQUEST['start_time']) : $_REQUEST['start_time']);
        $filter['end_time'] = empty($_REQUEST['end_time']) ? '' : (strpos($_REQUEST['end_time'], '-') > 0 ? local_strtotime($_REQUEST['end_time']) : $_REQUEST['end_time']);
        $where = 'WHERE 1 ';
        if ($filter['order_sn']) {
            $where .= " AND o.order_sn LIKE '%" . mysql_like_quote($filter['order_sn']) . "%'";
        }
        if ($filter['consignee']) {
            $where .= " AND o.consignee LIKE '%" . mysql_like_quote($filter['consignee']) . "%'";
        }
        if ($filter['email']) {
            $where .= " AND o.email LIKE '%" . mysql_like_quote($filter['email']) . "%'";
        }
        if ($filter['address']) {
            $where .= " AND o.address LIKE '%" . mysql_like_quote($filter['address']) . "%'";
        }
        if ($filter['zipcode']) {
            $where .= " AND o.zipcode LIKE '%" . mysql_like_quote($filter['zipcode']) . "%'";
        }
        if ($filter['tel']) {
            $where .= " AND o.tel LIKE '%" . mysql_like_quote($filter['tel']) . "%'";
        }
        if ($filter['mobile']) {
            $where .= " AND o.mobile LIKE '%" . mysql_like_quote($filter['mobile']) . "%'";
        }
        if ($filter['country']) {
            $where .= " AND o.country = '{$filter['country']}'";
        }
        if ($filter['province']) {
            $where .= " AND o.province = '{$filter['province']}'";
        }
        if ($filter['city']) {
            $where .= " AND o.city = '{$filter['city']}'";
        }
        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}' ";
        }
        /* 分页大小 */
        $filter['page'] = empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0 ? 1 : intval($_REQUEST['page']);
        if (isset($_REQUEST['page_size']) && intval($_REQUEST['page_size']) > 0) {
            $filter['page_size'] = intval($_REQUEST['page_size']);
        } elseif (isset($_COOKIE['ECSCP']['page_size']) && intval($_COOKIE['ECSCP']['page_size']) > 0) {
            $filter['page_size'] = intval($_COOKIE['ECSCP']['page_size']);
        } else {
            $filter['page_size'] = 15;
        }
        /* 记录总数 */
        if ($filter['user_name']) {
            $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('order_info') . " AS o ," . $GLOBALS['ecs']->table('users') . " AS u " . $where;
        } else {
            $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " . $where;
        }
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter['page_count'] = $filter['record_count'] > 0 ? ceil($filter['record_count'] / $filter['page_size']) : 1;
        /* 查询 */
        $sql = "SELECT o.order_id, o.order_sn, o.add_time, o.order_status, o.shipping_status, o.order_amount, o.money_paid," . "o.pay_status, o.consignee, o.address, o.email, o.tel, o.extension_code, o.extension_id, " . "(" . order_amount_field('o.') . ") AS total_fee, " . "IFNULL(u.user_name, '" . $GLOBALS['_LANG']['anonymous'] . "') AS buyer " . " FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " . " LEFT JOIN " . $GLOBALS['ecs']->table('users') . " AS u ON u.user_id=o.user_id " . $where . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ",{$filter['page_size']}";
        foreach (array('order_sn', 'consignee', 'email', 'address', 'zipcode', 'tel', 'user_name') as $val) {
            $filter[$val] = stripslashes($filter[$val]);
        }
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $row = $GLOBALS['db']->getAll($sql);
    /* 格式话数据 */
    foreach ($row as $key => $value) {
        $row[$key]['formated_order_amount'] = price_format($value['order_amount']);
        $row[$key]['formated_money_paid'] = price_format($value['money_paid']);
        $row[$key]['formated_total_fee'] = price_format($value['total_fee']);
        $row[$key]['short_order_time'] = local_date('m-d H:i', $value['add_time']);
        if ($value['order_status'] == OS_INVALID || $value['order_status'] == OS_CANCELED) {
            /* 如果该订单为无效或取消则显示删除链接 */
            $row[$key]['can_remove'] = 1;
        } else {
            $row[$key]['can_remove'] = 0;
        }
    }
    $arr = array('orders' => $row, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
コード例 #10
0
function get_inoutlist()
{
    $result = get_filter();
    if ($result === false) {
        $filter = array();
        $filter['sid'] = empty($_REQUEST['sid']) ? '0' : intval($_REQUEST['sid']);
        $filter['ssid'] = empty($_REQUEST['ssid']) ? '0' : intval($_REQUEST['ssid']);
        $filter['inout_status'] = empty($_REQUEST['inout_status']) ? '0' : intval($_REQUEST['inout_status']);
        $filter['inout_type'] = empty($_REQUEST['inout_type']) ? '0' : intval($_REQUEST['inout_type']);
        $filter['add_time1'] = empty($_REQUEST['add_time1']) ? '' : (strpos($_REQUEST['add_time1'], '-') > 0 ? local_strtotime($_REQUEST['add_time1']) : $_REQUEST['add_time1']);
        $filter['add_time2'] = empty($_REQUEST['add_time2']) ? '' : (strpos($_REQUEST['add_time2'], '-') > 0 ? local_strtotime($_REQUEST['add_time2']) : $_REQUEST['add_time2']);
        $filter['inout_sn'] = empty($_REQUEST['inout_sn']) ? '' : trim($_REQUEST['inout_sn']);
        $filter['takegoods_man'] = empty($_REQUEST['takegoods_man']) ? '' : trim($_REQUEST['takegoods_man']);
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'rec_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $where = 'AND store_type_id=0 ';
        if ($filter['ssid']) {
            $where .= " AND store_id = '" . $filter['ssid'] . "' ";
        } else {
            if ($filter['sid']) {
                $where .= " AND store_id in " . get_ssid_list($filter['sid']);
            }
        }
        if ($filter['inout_status']) {
            $where .= " AND inout_status = '" . $filter['inout_status'] . "' ";
        }
        if ($filter['inout_type']) {
            $where .= " AND inout_type = '" . $filter['inout_type'] . "' ";
        }
        if ($filter['add_time1']) {
            $where .= " AND add_time>=  '" . $filter['add_time1'] . "' ";
        }
        if ($filter['add_time2']) {
            $where .= " AND add_time<=  '" . $filter['add_time2'] . "' ";
        }
        if ($filter['inout_sn']) {
            $where .= " AND inout_sn = '" . $filter['inout_sn'] . "' ";
        }
        if ($filter['takegoods_man']) {
            $where .= " AND takegoods_man like '%" . $filter['takegoods_man'] . "%' ";
        }
        //获取当前管理员负责的store_id列表
        $storeid_list = "";
        $sql1 = "select store_id from " . $GLOBALS['ecs']->table('store_adminer') . " where admin_id = '{$_SESSION['admin_id']}' ";
        $res1 = $GLOBALS['db']->query($sql1);
        while ($row1 = $GLOBALS['db']->fetchRow($res1)) {
            $storeid_list .= $storeid_list ? "," : "";
            $storeid_list .= $row1['store_id'];
            $sql2 = "select store_id from " . $GLOBALS['ecs']->table('store_main') . " where parent_id = '{$row1['store_id']}' ";
            $res2 = $GLOBALS['db']->query($sql2);
            while ($row2 = $GLOBALS['db']->fetchRow($res2)) {
                $storeid_list .= $storeid_list ? "," : "";
                $storeid_list .= $row2['store_id'];
            }
        }
        if ($storeid_list) {
            $where .= " AND store_id in ({$storeid_list}) ";
        }
        /* 记录总数 */
        $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('store_inout_list') . 'WHERE inout_mode=2 ' . $where;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter = page_and_size($filter);
        /* 获取入库单数据 */
        $sql = 'SELECT *  ' . 'FROM ' . $GLOBALS['ecs']->table('store_inout_list') . 'WHERE inout_mode=2 ' . $where . ' ORDER by ' . $filter['sort_by'] . ' ' . $filter['sort_order'];
        $filter['keyword'] = stripslashes($filter['keyword']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $arr = array();
    $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
    while ($rows = $GLOBALS['db']->fetchRow($res)) {
        $rows['store_name'] = get_store_fullname($rows['store_id']);
        $rows['add_time'] = local_date($GLOBALS['_CFG']['time_format'], $rows['add_time']);
        $rows['inout_status_name'] = $GLOBALS['_LANG']['inout_status'][$rows['inout_status']];
        $rows['inout_type_name'] = get_inout_type_name($rows['inout_type']);
        $rows['admin_name'] = $GLOBALS['db']->getOne("select admin_name from " . $GLOBALS['ecs']->table('store_adminer') . " where store_id='{$rows['store_id']}' ");
        if ($rows['inout_status'] == 1) {
            //是否有提交申请的权利
            $sql_sh = "select rec_id from " . $GLOBALS['ecs']->table('store_adminer') . " where store_id='{$rows['store_id']}' and admin_id='{$_SESSION['admin_id']}' ";
            $rec_id_sh = $GLOBALS['db']->getOne($sql_sh);
            if (!$rec_id_sh) {
                $rows['tjsq'] = 0;
            } else {
                $rows['tjsq'] = 1;
            }
        }
        $arr[] = $rows;
    }
    return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
コード例 #11
0
ファイル: tm_user.php プロジェクト: dlpc/ecshop
 /**
  * 插入会员信息
  * 
  **/
 public function add_user($username, $password, $email, $agencyNameId, $md = '0')
 {
     if ($md == '0') {
         $GLOBALS['user']->add_user($username, $password, $email);
     } else {
         $GLOBALS['user']->add_user($username, $password, $email, -1, 0, 0, $password);
     }
     $user_id = $GLOBALS['db']->insert_id();
     $update_data['reg_time'] = local_strtotime(local_date('Y-m-d H:i:s'));
     $update_data['top_rank'] = $agencyNameId;
     $update_data['tm_mark'] = '1';
     $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('users'), $update_data, 'UPDATE', 'user_id = ' . $user_id);
     return $user_id;
     //注释发送邮件
     //send_mail($username, $email, '欢迎登陆天下店平台', "<p>尊敬的天下店用户:</p><p>您好!</p><p>你的账号是:<span style='color:red'>$username</span></p><p>初始密码是:<span style='color:red'>$password</span></p><p>温馨提示:为了你的账号安全请尽快修改密码!</p><p>http://o2o.txd168.com/</p>", 1);
 }
コード例 #12
0
}
/* 权限判断 */
admin_priv('user_account_manage');
/*------------------------------------------------------ */
//--数据查询
/*------------------------------------------------------ */
/* 时间参数 */
$start_date = $end_date = '';
if (isset($_POST) && !empty($_POST)) {
    $start_date = local_strtotime($_POST['start_date']);
    $end_date = local_strtotime($_POST['end_date']);
} elseif (isset($_GET['start_date']) && !empty($_GET['end_date'])) {
    $start_date = local_strtotime($_GET['start_date']);
    $end_date = local_strtotime($_GET['end_date']);
} else {
    $today = local_strtotime(local_date('d-m-Y'));
    $start_date = $today - 86400 * 7;
    $end_date = $today;
}
/*------------------------------------------------------ */
//--商品明细列表
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'list') {
    $account = $money_list = array();
    $account['voucher_amount'] = get_total_amount($start_date, $end_date);
    //充值总额
    $account['to_cash_amount'] = get_total_amount($start_date, $end_date, 1);
    //提现总额
    $sql = " SELECT IFNULL(SUM(user_money), 0) AS user_money, IFNULL(SUM(frozen_money), 0) AS frozen_money FROM " . $ecs->table('account_log') . " WHERE `change_time` >= " . $start_date . " AND `change_time` < " . ($end_date + 86400);
    $money_list = $db->getRow($sql);
    $account['user_money'] = price_format($money_list['user_money']);
コード例 #13
0
ファイル: users.php プロジェクト: dw250100785/ECShop-1
            $temp_field_content = strlen($_POST[$extend_field_index]) > 100 ? mb_substr($_POST[$extend_field_index], 0, 99) : $_POST[$extend_field_index];
            $extend_field_str .= " ('" . $user_id_arr['user_id'] . "', '" . $val['id'] . "', '" . $temp_field_content . "'),";
        }
    }
    $extend_field_str = substr($extend_field_str, 0, -1);
    if ($extend_field_str) {
        $sql = 'INSERT INTO ' . $ecs->table('reg_extend_info') . ' (`user_id`, `reg_field_id`, `content`) VALUES' . $extend_field_str;
        $db->query($sql);
    }
    /* 更新会员的其它信息 */
    $other = array();
    $other['credit_line'] = $credit_line;
    $other['user_rank'] = $rank;
    $other['sex'] = $sex;
    $other['birthday'] = $birthday;
    $other['reg_time'] = local_strtotime(local_date('Y-m-d H:i:s'));
    $other['msn'] = isset($_POST['extend_field1']) ? htmlspecialchars(trim($_POST['extend_field1'])) : '';
    $other['qq'] = isset($_POST['extend_field2']) ? htmlspecialchars(trim($_POST['extend_field2'])) : '';
    $other['office_phone'] = isset($_POST['extend_field3']) ? htmlspecialchars(trim($_POST['extend_field3'])) : '';
    $other['home_phone'] = isset($_POST['extend_field4']) ? htmlspecialchars(trim($_POST['extend_field4'])) : '';
    $other['mobile_phone'] = isset($_POST['extend_field5']) ? htmlspecialchars(trim($_POST['extend_field5'])) : '';
    $db->autoExecute($ecs->table('users'), $other, 'UPDATE', "user_name = '{$username}'");
    /* 记录管理员操作 */
    admin_log($_POST['username'], 'add', 'users');
    /* 提示信息 */
    $link[] = array('text' => $_LANG['go_back'], 'href' => 'users.php?act=list');
    sys_msg(sprintf($_LANG['add_success'], htmlspecialchars(stripslashes($_POST['username']))), 0, $link);
} elseif ($_REQUEST['act'] == 'edit') {
    /* 检查权限 */
    admin_priv('users_manage');
    $sql = "SELECT u.user_name, u.sex, u.birthday, u.pay_points, u.rank_points, u.user_rank , u.user_money, u.frozen_money, u.credit_line, u.parent_id, u2.user_name as parent_username, u.qq, u.msn, u.office_phone, u.home_phone, u.mobile_phone" . " FROM " . $ecs->table('users') . " u LEFT JOIN " . $ecs->table('users') . " u2 ON u.parent_id = u2.user_id WHERE u.user_id='{$_GET['id']}'";
コード例 #14
0
ファイル: auction.php プロジェクト: xiaoxiaowu007/jicai
 $cache_id = sprintf('%X', crc32($cache_id));
 /* 如果没有缓存,生成缓存 */
 if (!$smarty->is_cached('auction.dwt', $cache_id)) {
     //取货品信息
     if ($auction['product_id'] > 0) {
         $goods_specifications = get_specifications_list($auction['goods_id']);
         $good_products = get_good_products($auction['goods_id'], 'AND product_id = ' . $auction['product_id']);
         $_good_products = explode('|', $good_products[0]['goods_attr']);
         $products_info = '';
         foreach ($_good_products as $value) {
             $products_info .= ' ' . $goods_specifications[$value]['attr_name'] . ':' . $goods_specifications[$value]['attr_value'];
         }
         $smarty->assign('products_info', $products_info);
         unset($goods_specifications, $good_products, $_good_products, $products_info);
     }
     $auction['gmt_end_time'] = local_strtotime($auction['end_time']);
     $smarty->assign('auction', $auction);
     /* 取得拍卖商品信息 */
     $goods_id = $auction['goods_id'];
     $goods = goods_info($goods_id);
     if (empty($goods)) {
         ecs_header("Location: ./\n");
         exit;
     }
     $goods['url'] = build_uri('goods', array('gid' => $goods_id), $goods['goods_name']);
     $smarty->assign('auction_goods', $goods);
     /* 出价记录 */
     $smarty->assign('auction_log', auction_log($id));
     //模板赋值
     $smarty->assign('cfg', $_CFG);
     assign_template();
コード例 #15
0
function get_goods_sales_count($goods_id)
{
    /* 统计时间段 */
    //$period = intval($GLOBALS['_CFG']['top10_time']);
    $period = 4;
    //近一个月(30天)
    if ($period == 1) {
        // 一年
        $ext = " AND o.add_time > '" . local_strtotime('-1 years') . "'";
    } elseif ($period == 2) {
        // 半年
        $ext = " AND o.add_time > '" . local_strtotime('-6 months') . "'";
    } elseif ($period == 3) {
        // 三个月
        $ext = " AND o.add_time > '" . local_strtotime('-3 months') . "'";
    } elseif ($period == 4) {
        // 一个月
        $ext = " AND o.add_time > '" . local_strtotime('-1 months') . "'";
    } else {
        $ext = '';
    }
    /* 查询该商品销量 */
    $sql = 'SELECT IFNULL(SUM(g.goods_number), 0) ' . 'FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS o, ' . $GLOBALS['ecs']->table('order_goods') . ' AS g ' . "WHERE o.order_id = g.order_id " . "AND o.order_status " . db_create_in(array(OS_CONFIRMED, OS_SPLITED)) . "AND o.shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) . " AND o.pay_status " . db_create_in(array(PS_PAYED, PS_PAYING)) . " AND g.goods_id = '{$goods_id}'" . $ext;
    $sales_count = $GLOBALS['db']->getOne($sql);
    return intval($sales_count);
}
コード例 #16
0
/**
 *  获取供应商列表信息
 *
 * @access  public
 * @param
 *
 * @return void
 */
function rebate_list()
{
    $result = get_filter();
    if ($result === false) {
        $aiax = isset($_GET['is_ajax']) ? $_GET['is_ajax'] : 0;
        /* 过滤信息 */
        $filter['rebate_paytime_start'] = !empty($_REQUEST['rebate_paytime_start']) ? local_strtotime($_REQUEST['rebate_paytime_start']) : 0;
        $filter['rebate_paytime_end'] = !empty($_REQUEST['rebate_paytime_end']) ? local_strtotime($_REQUEST['rebate_paytime_end'] . " 23:59:59") : 0;
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? ' sr.supplier_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? ' ASC' : trim($_REQUEST['sort_order']);
        $filter['is_pay_ok'] = empty($_REQUEST['is_pay_ok']) ? '0' : intval($_REQUEST['is_pay_ok']);
        $where = 'WHERE 1 ';
        $where .= $filter['rebate_paytime_start'] ? " AND sr.rebate_paytime_start >= '" . $filter['rebate_paytime_start'] . "' " : " ";
        $where .= $filter['rebate_paytime_end'] ? " AND sr.rebate_paytime_end <= '" . $filter['rebate_paytime_end'] . "' " : " ";
        $where .= $filter['is_pay_ok'] ? " AND sr.is_pay_ok = '" . $filter['is_pay_ok'] . "' " : " AND sr.is_pay_ok = '0' ";
        /* 分页大小 */
        $filter['page'] = empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0 ? 1 : intval($_REQUEST['page']);
        if (isset($_REQUEST['page_size']) && intval($_REQUEST['page_size']) > 0) {
            $filter['page_size'] = intval($_REQUEST['page_size']);
        } elseif (isset($_COOKIE['ECSCP']['page_size']) && intval($_COOKIE['ECSCP']['page_size']) > 0) {
            $filter['page_size'] = intval($_COOKIE['ECSCP']['page_size']);
        } else {
            $filter['page_size'] = 15;
        }
        /* 记录总数 */
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('supplier_rebate') . " AS sr  " . $where;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter['page_count'] = $filter['record_count'] > 0 ? ceil($filter['record_count'] / $filter['page_size']) : 1;
        /* 查询 */
        $sql = "SELECT sr.* , s.supplier_name, s.supplier_rebate " . "FROM " . $GLOBALS['ecs']->table("supplier_rebate") . " AS  sr left join " . $GLOBALS['ecs']->table("supplier") . " AS s on sr.supplier_id=s.supplier_id \r\n                {$where}\r\n                ORDER BY " . $filter['sort_by'] . " " . $filter['sort_order'] . "\r\n                LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ", " . $filter['page_size'] . " ";
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $list = array();
    $res = $GLOBALS['db']->query($sql);
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        $row['rebate_paytime_start'] = local_date('Y.m.d', $row['rebate_paytime_start']);
        $endtime = $row['rebate_paytime_end'] + $GLOBALS['_CFG']['tuihuan_days_qianshou'] * 3600 * 24;
        $row['rebate_paytime_end'] = local_date('Y.m.d', $endtime);
        $row['all_money'] = $GLOBALS['db']->getOne("select sum(money_paid + surplus) from " . $GLOBALS['ecs']->table('order_info') . " where rebate_id=" . $row['rebate_id'] . " and rebate_ispay=2");
        $row['all_money_formated'] = price_format($row['all_money']);
        $row['rebate_money'] = round($row['all_money'] * $row['supplier_rebate'] / 100, 2);
        $row['rebate_money_formated'] = price_format($row['rebate_money']);
        $row['pay_money'] = $row['all_money'] - $row['rebate_money'];
        $row['pay_money_formated'] = price_format($row['pay_money']);
        $row['pay_status'] = $row['is_pay_ok'] ? "已处理,已返佣" : "未处理";
        $row['pay_time'] = local_date('Y.m.d', $row['pay_time']);
        $list[] = $row;
    }
    $arr = array('result' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
コード例 #17
0
function getBackHuanOrder()
{
    global $ecs, $db, $rebate;
    $result = get_filter();
    if ($result === false) {
        $filter['rid'] = $rid = isset($_REQUEST['rid']) && intval($_REQUEST['rid']) > 0 ? intval($_REQUEST['rid']) : 0;
        $filter['add_time_start'] = !empty($_REQUEST['add_time_start']) ? local_strtotime($_REQUEST['add_time_start']) : 0;
        $filter['add_time_end'] = !empty($_REQUEST['add_time_end']) ? local_strtotime($_REQUEST['add_time_end'] . " 23:59:59") : 0;
        $filter['order_sn'] = isset($_REQUEST['order_sn']) ? trim($_REQUEST['order_sn']) : '';
        //$and = ' rebate_id='.$rid.' and shipping_status in ('.SS_SHIPPED.','.SS_RECEIVED.')';
        $and = ' oi.store_rebate_id=' . $rid . ' and bo.back_type!=3 and bo.status_back<5 and oi.order_id=bo.order_id ';
        $and .= $filter['add_time_start'] ? " AND oi.add_time >= '" . $filter['add_time_start'] . "' " : " ";
        $and .= $filter['add_time_end'] ? " AND oi.add_time <= '" . $filter['add_time_end'] . "' " : " ";
        $and .= $filter['order_sn'] ? " AND oi.order_sn = '" . $filter['order_sn'] . "' " : " ";
        /* 分页大小 */
        $filter['page'] = empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0 ? 1 : intval($_REQUEST['page']);
        if (isset($_REQUEST['page_size']) && intval($_REQUEST['page_size']) > 0) {
            $filter['page_size'] = intval($_REQUEST['page_size']);
        } elseif (isset($_COOKIE['ECSCP']['page_size']) && intval($_COOKIE['ECSCP']['page_size']) > 0) {
            $filter['page_size'] = intval($_COOKIE['ECSCP']['page_size']);
        } else {
            $filter['page_size'] = 15;
        }
        //总数
        $sql = "select count(oi.order_id) " . "from " . $ecs->table('order_info') . " as oi," . $ecs->table('back_order') . " as bo where " . $and;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter['page_count'] = $filter['record_count'] > 0 ? ceil($filter['record_count'] / $filter['page_size']) : 1;
        //记录
        $sql = "select oi.order_id, oi.order_sn, oi.add_time, oi.order_status, oi.shipping_status, oi.order_amount, oi.money_paid," . "oi.pay_status, oi.consignee, oi.address, oi.email, oi.tel, oi.extension_code, oi.extension_id, oi.shipping_time, bo.add_time as back_add_time,bo.status_back,bo.status_refund, " . "(" . order_amount_field('oi.') . ") AS total_fee " . "from " . $ecs->table('order_info') . " as oi," . $ecs->table('back_order') . " as bo where " . $and . " LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ",{$filter['page_size']}";
        //echo $sql;
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $query = $db->query($sql);
    $ret = array();
    while ($row = $db->fetchRow($query)) {
        $is_order = $is_shipping = $is_pay = 0;
        $row['formated_order_amount'] = price_format($row['order_amount']);
        $row['formated_money_paid'] = price_format($row['money_paid']);
        //$row['formated_rebate_fee'] = 0-price_format($row['total_fee']*$rebate['supplier_rebate']/100);
        $row['formated_rebate_fee'] = getGoodsOrderRebatePrice($row['order_id']);
        $row['formated_rebate_fee'] = 0 - price_format($row['formated_rebate_fee'] * $rebate['rebate'] / 100);
        $row['formated_total_fee'] = price_format($row['total_fee']);
        $row['short_order_time'] = local_date('Y-m-d H:i', $row['add_time']);
        $row['short_back_add_time'] = local_date('Y-m-d H:i', $row['back_add_time']);
        $row['is_rebeat'] = $row['datas'] = 0;
        $ret[$row['order_id']] = $row;
    }
    //echo "<pre>";
    //print_r($ret);
    $arr = array('orders' => $ret, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
コード例 #18
0
ファイル: user.php プロジェクト: Ryan007/mybb
/**
 * 手机注册
 */
function m_register($username, $password, $email, $other = array())
{
    /* 检查username */
    if (empty($username)) {
        echo '用户名不能为空';
        $Loaction = 'user.php?act=register';
        ecs_header("Location: {$Loaction}\n");
        return false;
    }
    if (preg_match('/\'\\/^\\s*$|^c:\\\\con\\\\con$|[%,\\*\\"\\s\\t\\<\\>\\&\'\\\\]/', $username)) {
        echo '用户名错误';
        $Loaction = 'user.php?act=register';
        ecs_header("Location: {$Loaction}\n");
        return false;
    }
    /* 检查email */
    if (empty($email)) {
        echo 'email不能为空';
        $Loaction = 'user.php?act=register';
        ecs_header("Location: {$Loaction}\n");
        return false;
    }
    if (!is_email($email)) {
        echo 'email错误';
        $Loaction = 'user.php?act=register';
        ecs_header("Location: {$Loaction}\n");
        return false;
    }
    /* 检查是否和管理员重名 */
    if (admin_registered($username)) {
        echo '此用户已存在!';
        $Loaction = 'user.php?act=register';
        ecs_header("Location: {$Loaction}\n");
        return false;
    }
    if (!$GLOBALS['user']->add_user($username, $password, $email)) {
        echo '注册失败!';
        $Loaction = 'user.php?act=register';
        ecs_header("Location: {$Loaction}\n");
        //注册失败
        return false;
    } else {
        //注册成功
        /* 设置成登录状态 */
        $GLOBALS['user']->set_session($username);
        $GLOBALS['user']->set_cookie($username);
    }
    //定义other合法的变量数组
    $other_key_array = array('msn', 'qq', 'office_phone', 'home_phone', 'mobile_phone');
    $update_data['reg_time'] = local_strtotime(local_date('Y-m-d H:i:s'));
    if ($other) {
        foreach ($other as $key => $val) {
            //删除非法key值
            if (!in_array($key, $other_key_array)) {
                unset($other[$key]);
            } else {
                $other[$key] = htmlspecialchars(trim($val));
                //防止用户输入javascript代码
            }
        }
        $update_data = array_merge($update_data, $other);
    }
    $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('users'), $update_data, 'UPDATE', 'user_id = ' . $_SESSION['user_id']);
    update_user_info();
    // 更新用户信息
    return true;
}
コード例 #19
0
 /**
  * 编辑专题
  */
 public function edit()
 {
     $id = I('id');
     if (!$id) {
         $this->redirect(url('index'));
     }
     if (IS_POST) {
         $data = I('data');
         /* 数据验证 */
         $msg = Check::rule(array(array(Check::must($_POST['topic_name']), L('topic_name_empty')), array(Check::must($_POST['start_time']), L('start_time_empty')), array(Check::must($_POST['end_time']), L('end_time_empty'))));
         /* 提示信息 */
         if ($msg !== true) {
             $this->message($msg, NULL, 'error');
         }
         $topic_type = empty($data['topic_type']) ? 0 : intval($data['topic_type']);
         switch ($topic_type) {
             case '0':
             case '1':
                 // 主图上传
                 if ($_FILES['topic_img']['name'] && $_FILES['topic_img']['size'] > 0) {
                     $result = $this->ectouchUpload('topic_img', 'topic_image');
                     if ($result['error'] > 0) {
                         $this->message($result['message'], NULL, 'error');
                     }
                     /* 生成logo链接 */
                     $topic_img = substr($result['message']['topic_img']['savepath'], 2) . $result['message']['topic_img']['savename'];
                 } else {
                     if (!empty($_POST['url'])) {
                         /* 来自互联网图片 不可以是服务器地址 */
                         if (strstr(I('post.url'), 'http') && !strstr(I('post.url'), $_SERVER['SERVER_NAME'])) {
                             /* 取互联网图片至本地 */
                             $topic_img = get_url_image(I('post.url'));
                         } else {
                             sys_msg(L('web_url_no'));
                         }
                     }
                 }
                 $data['topic_img'] = empty($topic_img) ? I('post.img_url') : $topic_img;
                 $htmls = '';
                 break;
             case '2':
                 $htmls = I('post.content');
                 $data['topic_img'] = '';
                 break;
         }
         // 标题图上传
         if ($_FILES['title_pic']['name'] && $_FILES['title_pic']['size'] > 0) {
             $result = $this->ectouchUpload('title_pic', 'topic_image');
             if ($result['error'] > 0) {
                 $this->message($result['message'], NULL, 'error');
             }
             /* 生成logo链接 */
             $data['title_pic'] = substr($result['message']['title_pic']['savepath'], 2) . $result['message']['title_pic']['savename'];
         } else {
             if (!empty($_REQUEST['title_url'])) {
                 /* 来自互联网图片 不可以是服务器地址 */
                 if (strstr(I('post.title_url'), 'http') && !strstr(I('post.title_url'), $_SERVER['SERVER_NAME'])) {
                     /* 取互联网图片至本地 */
                     $data['title_pic'] = get_url_image(I('post.title_url'));
                 } else {
                     sys_msg(L('web_url_no'));
                 }
             }
         }
         unset($target);
         $data['title'] = I('post.topic_name');
         $title_pic = empty($data['title_pic']) ? I('post.title_img_url') : $data['title_pic'];
         $data['template'] = I('post.topic_template_file') ? I('post.topic_template_file') : '';
         $data['start_time'] = local_strtotime(I('post.start_time'));
         $data['end_time'] = local_strtotime(I('post.end_time'));
         $json = new EcsJson();
         $tmp_data = $json->decode($_POST['topic_data']);
         $data['data'] = serialize($tmp_data);
         $data['intro'] = I('post.topic_intro');
         $this->model->table('touch_topic')->data($data)->where('topic_id =' . $id)->update();
         $this->message(L('succed'), url('index'));
     }
     /* 模板赋值 */
     $topic = $this->model->table('touch_topic')->field('*')->where('topic_id =' . $id)->find();
     $topic['start_time'] = local_date('Y-m-d', $topic['start_time']);
     $topic['end_time'] = local_date('Y-m-d', $topic['end_time']);
     $topic['topic_intro'] = html_out($topic['intro']);
     $topic['intro'] = html_out($topic['intro']);
     $json = new EcsJson();
     if ($topic['data']) {
         $topic['data'] = addcslashes($topic['data'], "'");
         $topic['data'] = $json->encode(@unserialize($topic['data']));
         $topic['data'] = addcslashes($topic['data'], "'");
     }
     if (empty($topic['topic_img']) && empty($topic['htmls'])) {
         $topic['topic_type'] = 0;
     } elseif ($topic['htmls'] != '') {
         $topic['topic_type'] = 2;
     } elseif (preg_match('/.swf$/i', $topic['topic_img'])) {
         $topic['topic_type'] = 1;
     } else {
         $topic['topic_type'] = '';
     }
     $this->assign('topic', $topic);
     $this->assign('cat_list', cat_list(0, 1));
     $this->assign('brand_list', model('BrandBase')->get_brand_list());
     $this->assign('template_list', $this->get_topic_temp_list());
     $this->assign('ur_here', L('09_topic'));
     $this->display();
 }
コード例 #20
0
ファイル: order_stats.php プロジェクト: dw250100785/ECShop-1
 }
 $start_date_arr = array();
 $end_date_arr = array();
 if (!empty($_POST['year_month'])) {
     $tmp = $_POST['year_month'];
     for ($i = 0; $i < count($tmp); $i++) {
         if (!empty($tmp[$i])) {
             $tmp_time = local_strtotime($tmp[$i] . '-1');
             $start_date_arr[] = $tmp_time;
             $end_date_arr[] = local_strtotime($tmp[$i] . '-' . date('t', $tmp_time));
         }
     }
 } else {
     $tmp_time = local_strtotime(local_date('Y-m-d'));
     $start_date_arr[] = local_strtotime(local_date('Y-m') . '-1');
     $end_date_arr[] = local_strtotime(local_date('Y-m') . '-31');
 }
 /* 按月份交叉查询 */
 if ($is_multi) {
     /* 订单概况 */
     $order_general_xml = "<chart caption='{$_LANG['order_circs']}' shownames='1' showvalues='0' decimals='0' outCnvBaseFontSize='12' baseFontSize='12' >";
     $order_general_xml .= "<categories><category label='{$_LANG['confirmed']}' />" . "<category label='{$_LANG['succeed']}' />" . "<category label='{$_LANG['unconfirmed']}' />" . "<category label='{$_LANG['invalid']}' /></categories>";
     foreach ($start_date_arr as $k => $val) {
         $seriesName = local_date('Y-m', $val);
         $order_info = get_orderinfo($start_date_arr[$k], $end_date_arr[$k]);
         $order_general_xml .= "<dataset seriesName='{$seriesName}' color='{$color_array[$k]}' showValues='0'>";
         $order_general_xml .= "<set value='{$order_info['confirmed_num']}' />";
         $order_general_xml .= "<set value='{$order_info['succeed_num']}' />";
         $order_general_xml .= "<set value='{$order_info['unconfirmed_num']}' />";
         $order_general_xml .= "<set value='{$order_info['invalid_num']}' />";
         $order_general_xml .= "</dataset>";
コード例 #21
0
ファイル: UsersModel.class.php プロジェクト: m7720647/demo
 /**
  * 用户注册,登录函数
  *
  * @access  public
  * @param   string       $username          注册用户名
  * @param   string       $password          用户密码
  * @param   string       $email             注册email
  * @param   array        $other             注册的其他信息
  *
  * @return  bool         $bool
  */
 function register($username, $password, $email, $other = array())
 {
     /* 检查注册是否关闭 */
     $shop_reg_closed = C('shop_reg_closed');
     if (!empty($shop_reg_closed)) {
         ECTouch::err()->add(L('shop_register_closed'));
     }
     /* 检查username */
     if (empty($username)) {
         ECTouch::err()->add(L('username_empty'));
     } else {
         if (preg_match('/\'\\/^\\s*$|^c:\\\\con\\\\con$|[%,\\*\\"\\s\\t\\<\\>\\&\'\\\\]/', $username)) {
             ECTouch::err()->add(sprintf(L('username_invalid'), htmlspecialchars($username)));
         }
     }
     /* 检查email */
     if (empty($email)) {
         ECTouch::err()->add(L('email_empty'));
     } else {
         if (!is_email($email)) {
             ECTouch::err()->add(sprintf(L('email_invalid'), htmlspecialchars($email)));
         }
     }
     if (ECTouch::err()->error_no > 0) {
         return false;
     }
     /* 检查是否和管理员重名 */
     if (model('Users')->admin_registered($username)) {
         ECTouch::err()->add(sprintf(L('username_exist'), $username));
         return false;
     }
     if (!ECTouch::user()->add_user($username, $password, $email)) {
         if (ECTouch::user()->error == ERR_INVALID_USERNAME) {
             ECTouch::err()->add(sprintf(L('username_invalid'), $username));
         } elseif (ECTouch::user()->error == ERR_USERNAME_NOT_ALLOW) {
             ECTouch::err()->add(sprintf(L('username_not_allow'), $username));
         } elseif (ECTouch::user()->error == ERR_USERNAME_EXISTS) {
             ECTouch::err()->add(sprintf(L('username_exist'), $username));
         } elseif (ECTouch::user()->error == ERR_INVALID_EMAIL) {
             ECTouch::err()->add(sprintf(L('email_invalid'), $email));
         } elseif (ECTouch::user()->error == ERR_EMAIL_NOT_ALLOW) {
             ECTouch::err()->add(sprintf(L('email_not_allow'), $email));
         } elseif (ECTouch::user()->error == ERR_EMAIL_EXISTS) {
             ECTouch::err()->add(sprintf(L('email_exist'), $email));
         } else {
             ECTouch::err()->add('UNKNOWN ERROR!');
         }
         //注册失败
         return false;
     } else {
         //注册成功
         /* 设置成登录状态 */
         ECTouch::user()->set_session($username);
         ECTouch::user()->set_cookie($username);
         /* 注册送积分 */
         $register_points = C('register_points');
         if (!empty($register_points)) {
             model('ClipsBase')->log_account_change($_SESSION['user_id'], 0, 0, C('register_points'), C('register_points'), L('register_points'));
         }
         //定义other合法的变量数组
         $other_key_array = array('msn', 'qq', 'office_phone', 'home_phone', 'mobile_phone', 'parent_id');
         $update_data['reg_time'] = local_strtotime(local_date('Y-m-d H:i:s'));
         if ($other) {
             foreach ($other as $key => $val) {
                 //删除非法key值
                 if (!in_array($key, $other_key_array)) {
                     unset($other[$key]);
                 } else {
                     $other[$key] = htmlspecialchars(trim($val));
                     //防止用户输入javascript代码
                 }
             }
             $update_data = array_merge($update_data, $other);
         }
         $condition['user_id'] = $_SESSION['user_id'];
         $this->update($condition, $update_data);
         /* 推荐处理 */
         $affiliate = unserialize(C('affiliate'));
         if (isset($affiliate['on']) && $affiliate['on'] == 1) {
             // 推荐开关开启
             $up_uid = model('Users')->get_affiliate();
             empty($affiliate) && ($affiliate = array());
             $affiliate['config']['level_register_all'] = intval($affiliate['config']['level_register_all']);
             $affiliate['config']['level_register_up'] = intval($affiliate['config']['level_register_up']);
             if ($up_uid) {
                 if (!empty($affiliate['config']['level_register_all'])) {
                     if (!empty($affiliate['config']['level_register_up'])) {
                         $res = $this->row("SELECT rank_points FROM " . $this->pre . "users WHERE user_id = '{$up_uid}'");
                         if ($res['rank_points'] + $affiliate['config']['level_register_all'] <= $affiliate['config']['level_register_up']) {
                             model('ClipsBase')->log_account_change($up_uid, 0, 0, $affiliate['config']['level_register_all'], 0, sprintf(L('register_affiliate'), $_SESSION['user_id'], $username));
                         }
                     } else {
                         model('ClipsBase')->log_account_change($up_uid, 0, 0, $affiliate['config']['level_register_all'], 0, L('register_affiliate'));
                     }
                 }
                 //设置推荐人
                 $sql = 'UPDATE ' . $this->pre . 'users SET parent_id = ' . $up_uid . ' WHERE user_id = ' . $_SESSION['user_id'];
                 $this->query($sql);
             }
         }
         model('Users')->update_user_info();
         // 更新用户信息
         model('Users')->recalculate_price();
         // 重新计算购物车中的商品价格
         return true;
     }
 }
コード例 #22
0
ファイル: favourable.php プロジェクト: nirvana-info/old_bak
 }
 /* 检查金额上下限 */
 $min_amount = floatval($_POST['min_amount']) >= 0 ? floatval($_POST['min_amount']) : 0;
 $max_amount = floatval($_POST['max_amount']) >= 0 ? floatval($_POST['max_amount']) : 0;
 if ($max_amount > 0 && $min_amount > $max_amount) {
     sys_msg($_LANG['amount_error']);
 }
 /* 取得赠品 */
 $gift = array();
 if (intval($_POST['act_type']) == FAT_GOODS && isset($_POST['gift_id'])) {
     foreach ($_POST['gift_id'] as $key => $id) {
         $gift[] = array('id' => $id, 'name' => $_POST['gift_name'][$key], 'price' => $_POST['gift_price'][$key]);
     }
 }
 /* 提交值 */
 $favourable = array('act_id' => intval($_POST['id']), 'act_name' => $act_name, 'start_time' => local_strtotime($_POST['start_time']), 'end_time' => local_strtotime($_POST['end_time']), 'user_rank' => isset($_POST['user_rank']) ? join(',', $_POST['user_rank']) : '0', 'act_range' => intval($_POST['act_range']), 'act_range_ext' => intval($_POST['act_range']) == 0 ? '' : join(',', $_POST['act_range_ext']), 'min_amount' => floatval($_POST['min_amount']), 'max_amount' => floatval($_POST['max_amount']), 'act_type' => intval($_POST['act_type']), 'act_type_ext' => floatval($_POST['act_type_ext']), 'gift' => serialize($gift));
 if ($favourable['act_type'] == FAT_GOODS) {
     $favourable['act_type_ext'] = round($favourable['act_type_ext']);
 }
 /* 保存数据 */
 if ($is_add) {
     $db->autoExecute($ecs->table('favourable_activity'), $favourable, 'INSERT');
     $favourable['act_id'] = $db->insert_id();
 } else {
     $db->autoExecute($ecs->table('favourable_activity'), $favourable, 'UPDATE', "act_id = '{$favourable['act_id']}'");
 }
 /* 记日志 */
 if ($is_add) {
     admin_log($favourable['act_name'], 'add', 'favourable');
 } else {
     admin_log($favourable['act_name'], 'edit', 'favourable');
コード例 #23
0
ファイル: lib_clips.php プロジェクト: netroby/ecshop
/**
 * 获取用户中心默认页面所需的数据.
 *
 * @param int $user_id 用户ID
 *
 * @return array $info               默认页面所需资料数组
 */
function get_user_default($user_id)
{
    $user_bonus = get_user_bonus();
    $sql = 'SELECT pay_points, user_money, credit_line, last_login, is_validated FROM ' . $GLOBALS['ecs']->table('users') . " WHERE user_id = '{$user_id}'";
    $row = $GLOBALS['db']->getRow($sql);
    $info = array();
    $info['username'] = stripslashes($_SESSION['user_name']);
    $info['shop_name'] = $GLOBALS['_CFG']['shop_name'];
    $info['integral'] = $row['pay_points'] . $GLOBALS['_CFG']['integral_name'];
    /* 增加是否开启会员邮件验证开关 */
    $info['is_validate'] = $GLOBALS['_CFG']['member_email_validate'] && !$row['is_validated'] ? 0 : 1;
    $info['credit_line'] = $row['credit_line'];
    $info['formated_credit_line'] = price_format($info['credit_line'], false);
    //如果$_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($GLOBALS['_CFG']['time_format'], $last_time);
    $info['surplus'] = price_format($row['user_money'], false);
    $info['bonus'] = sprintf($GLOBALS['_LANG']['user_bonus_info'], $user_bonus['bonus_count'], price_format($user_bonus['bonus_value'], false));
    $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('order_info') . " WHERE user_id = '" . $user_id . "' AND add_time > '" . local_strtotime('-1 months') . "'";
    $info['order_count'] = $GLOBALS['db']->getOne($sql);
    include_once ROOT_PATH . 'includes/lib_order.php';
    $sql = 'SELECT order_id, order_sn ' . ' FROM ' . $GLOBALS['ecs']->table('order_info') . " WHERE user_id = '" . $user_id . "' AND shipping_time > '" . $last_time . "'" . order_query_sql('shipped');
    $info['shipped_order'] = $GLOBALS['db']->getAll($sql);
    return $info;
}
コード例 #24
0
/**
 * 用户注册,登录函数
 *
 * @access  public
 * @param   string       $username          注册用户名
 * @param   string       $password          用户密码
 * @param   string       $email             注册email
 * @param   array        $other             注册的其他信息
 *
 * @return  bool         $bool
 */
function register($username, $password, $other = array())
{
    /* 检查注册是否关闭 */
    if (!empty($GLOBALS['_CFG']['shop_reg_closed'])) {
        $GLOBALS['err']->add($GLOBALS['_LANG']['shop_register_closed']);
    }
    /* 检查username */
    if (empty($username)) {
        $GLOBALS['err']->add($GLOBALS['_LANG']['username_empty']);
    } else {
        if (preg_match('/\'\\/^\\s*$|^c:\\\\con\\\\con$|[%,\\*\\"\\s\\t\\<\\>\\&\'\\\\]/', $username)) {
            $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['username_invalid'], htmlspecialchars($username)));
        }
    }
    /* 检查是否和管理员重名 */
    if (admin_registered($username)) {
        $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['username_exist'], $username));
        return false;
    }
    if (!$GLOBALS['user']->add_user($username, $password, $email)) {
        if ($GLOBALS['user']->error == ERR_INVALID_USERNAME) {
            $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['username_invalid'], $username));
        } elseif ($GLOBALS['user']->error == ERR_USERNAME_NOT_ALLOW) {
            $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['username_not_allow'], $username));
        } elseif ($GLOBALS['user']->error == ERR_USERNAME_EXISTS) {
            $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['username_exist'], $username));
        } else {
            $GLOBALS['err']->add('UNKNOWN ERROR!');
        }
        //注册失败
        return false;
    } else {
        //注册成功
        /* 设置成登录状态 */
        $GLOBALS['user']->set_session($username);
        $GLOBALS['user']->set_cookie($username);
        /* 注册送积分 */
        if (!empty($GLOBALS['_CFG']['register_points'])) {
            log_account_change($_SESSION['user_id'], 0, 0, $GLOBALS['_CFG']['register_points'], $GLOBALS['_CFG']['register_points'], $GLOBALS['_LANG']['register_points']);
        }
        /*推荐处理*/
        $affiliate = unserialize($GLOBALS['_CFG']['affiliate']);
        if (isset($affiliate['on']) && $affiliate['on'] == 1) {
            // 推荐开关开启
            $up_uid = get_affiliate();
            empty($affiliate) && ($affiliate = array());
            $affiliate['config']['level_register_all'] = intval($affiliate['config']['level_register_all']);
            $affiliate['config']['level_register_up'] = intval($affiliate['config']['level_register_up']);
            if ($up_uid) {
                if (!empty($affiliate['config']['level_register_all'])) {
                    if (!empty($affiliate['config']['level_register_up'])) {
                        $rank_points = $GLOBALS['db']->getOne("SELECT rank_points FROM " . $GLOBALS['ecs']->table('users') . " WHERE user_id = '{$up_uid}'");
                        if ($rank_points + $affiliate['config']['level_register_all'] <= $affiliate['config']['level_register_up']) {
                            log_account_change($up_uid, 0, 0, $affiliate['config']['level_register_all'], 0, sprintf($GLOBALS['_LANG']['register_affiliate'], $_SESSION['user_id'], $username));
                        }
                    } else {
                        log_account_change($up_uid, 0, 0, $affiliate['config']['level_register_all'], 0, $GLOBALS['_LANG']['register_affiliate']);
                    }
                }
                //设置推荐人
                $sql = 'UPDATE ' . $GLOBALS['ecs']->table('users') . ' SET parent_id = ' . $up_uid . ' WHERE user_id = ' . $_SESSION['user_id'];
                $GLOBALS['db']->query($sql);
            }
        }
        //定义other合法的变量数组
        $other_key_array = array('msn', 'qq', 'office_phone', 'home_phone', 'mobile_phone', 'sina_weibo_id');
        $update_data['reg_time'] = local_strtotime(local_date('Y-m-d H:i:s'));
        if ($other) {
            foreach ($other as $key => $val) {
                //删除非法key值
                if (!in_array($key, $other_key_array)) {
                    unset($other[$key]);
                } else {
                    $other[$key] = htmlspecialchars(trim($val));
                    //防止用户输入javascript代码
                }
            }
            $update_data = array_merge($update_data, $other);
        }
        $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('users'), $update_data, 'UPDATE', 'user_id = ' . $_SESSION['user_id']);
        update_user_info();
        // 更新用户信息
        recalculate_price();
        // 重新计算购物车中的商品价格
        return true;
    }
}
コード例 #25
0
ファイル: auction.php プロジェクト: xiaoxiaowu007/jicai
 admin_priv('auction');
 /* 是否添加 */
 $is_add = $_REQUEST['act'] == 'insert';
 /* 检查是否选择了商品 */
 $goods_id = intval($_POST['goods_id']);
 if ($goods_id <= 0) {
     sys_msg($_LANG['pls_select_goods']);
 }
 $sql = "SELECT goods_name FROM " . $ecs->table('goods') . " WHERE goods_id = '{$goods_id}'";
 $row = $db->getRow($sql);
 if (empty($row)) {
     sys_msg($_LANG['goods_not_exist']);
 }
 $goods_name = $row['goods_name'];
 /* 提交值 */
 $auction = array('act_id' => intval($_POST['id']), 'act_name' => empty($_POST['act_name']) ? $goods_name : sub_str($_POST['act_name'], 255, false), 'act_desc' => $_POST['act_desc'], 'act_type' => GAT_AUCTION, 'goods_id' => $goods_id, 'product_id' => empty($_POST['product_id']) ? 0 : $_POST['product_id'], 'goods_name' => $goods_name, 'start_time' => local_strtotime($_POST['start_time']), 'end_time' => local_strtotime($_POST['end_time']), 'ext_info' => serialize(array('deposit' => round(floatval($_POST['deposit']), 2), 'start_price' => round(floatval($_POST['start_price']), 2), 'end_price' => empty($_POST['no_top']) ? round(floatval($_POST['end_price']), 2) : 0, 'amplitude' => round(floatval($_POST['amplitude']), 2), 'no_top' => !empty($_POST['no_top']) ? intval($_POST['no_top']) : 0)));
 /* 保存数据 */
 if ($is_add) {
     $auction['is_finished'] = 0;
     $db->autoExecute($ecs->table('goods_activity'), $auction, 'INSERT');
     $auction['act_id'] = $db->insert_id();
 } else {
     $db->autoExecute($ecs->table('goods_activity'), $auction, 'UPDATE', "act_id = '{$auction['act_id']}'");
 }
 /* 记日志 */
 if ($is_add) {
     admin_log($auction['act_name'], 'add', 'auction');
 } else {
     admin_log($auction['act_name'], 'edit', 'auction');
 }
 /* 清除缓存 */
コード例 #26
0
ファイル: user_account.php プロジェクト: xiaoxiaowu007/jicai
/**
 *
 *
 * @access  public
 * @param
 *
 * @return void
 */
function account_list()
{
    $result = get_filter();
    if ($result === false) {
        /* 过滤列表 */
        $filter['user_id'] = !empty($_REQUEST['user_id']) ? intval($_REQUEST['user_id']) : 0;
        $filter['keywords'] = empty($_REQUEST['keywords']) ? '' : trim($_REQUEST['keywords']);
        if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
            $filter['keywords'] = json_str_iconv($filter['keywords']);
        }
        $filter['process_type'] = isset($_REQUEST['process_type']) ? intval($_REQUEST['process_type']) : -1;
        $filter['payment'] = empty($_REQUEST['payment']) ? '' : trim($_REQUEST['payment']);
        $filter['is_paid'] = isset($_REQUEST['is_paid']) ? intval($_REQUEST['is_paid']) : -1;
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'add_time' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $filter['start_date'] = empty($_REQUEST['start_date']) ? '' : local_strtotime($_REQUEST['start_date']);
        $filter['end_date'] = empty($_REQUEST['end_date']) ? '' : local_strtotime($_REQUEST['end_date']) + 86400;
        $where = " WHERE 1 ";
        if ($filter['user_id'] > 0) {
            $where .= " AND ua.user_id = '{$filter['user_id']}' ";
        }
        if ($filter['process_type'] != -1) {
            $where .= " AND ua.process_type = '{$filter['process_type']}' ";
        } else {
            $where .= " AND ua.process_type " . db_create_in(array(SURPLUS_SAVE, SURPLUS_RETURN));
        }
        if ($filter['payment']) {
            $where .= " AND ua.payment = '{$filter['payment']}' ";
        }
        if ($filter['is_paid'] != -1) {
            $where .= " AND ua.is_paid = '{$filter['is_paid']}' ";
        }
        if ($filter['keywords']) {
            $where .= " AND u.user_name LIKE '%" . mysql_like_quote($filter['keywords']) . "%'";
            $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('user_account') . " AS ua, " . $GLOBALS['ecs']->table('users') . " AS u " . $where;
        }
        /* 时间过滤 */
        if (!empty($filter['start_date']) && !empty($filter['end_date'])) {
            $where .= "AND paid_time >= " . $filter['start_date'] . " AND paid_time < '" . $filter['end_date'] . "'";
        }
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('user_account') . " AS ua, " . $GLOBALS['ecs']->table('users') . " AS u " . $where;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        /* 分页大小 */
        $filter = page_and_size($filter);
        /* 查询数据 */
        $sql = 'SELECT ua.*, u.user_name FROM ' . $GLOBALS['ecs']->table('user_account') . ' AS ua LEFT JOIN ' . $GLOBALS['ecs']->table('users') . ' AS u ON ua.user_id = u.user_id' . $where . "ORDER by " . $filter['sort_by'] . " " . $filter['sort_order'] . " LIMIT " . $filter['start'] . ", " . $filter['page_size'];
        $filter['keywords'] = stripslashes($filter['keywords']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $list = $GLOBALS['db']->getAll($sql);
    foreach ($list as $key => $value) {
        $list[$key]['surplus_amount'] = price_format(abs($value['amount']), false);
        $list[$key]['add_date'] = local_date($GLOBALS['_CFG']['time_format'], $value['add_time']);
        $list[$key]['process_type_name'] = $GLOBALS['_LANG']['surplus_type_' . $value['process_type']];
    }
    $arr = array('list' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
コード例 #27
0
ファイル: user_account_manage.php プロジェクト: run100/ecshop
}
/* 权限判断 */
admin_priv('user_account_manage');
/*------------------------------------------------------ */
//--数据查询
/*------------------------------------------------------ */
/* 时间参数 */
$start_date = $end_date = '';
if (isset($_POST) && !empty($_POST)) {
    $start_date = local_strtotime($_POST['start_date']);
    $end_date = local_strtotime($_POST['end_date']);
} elseif (isset($_GET['start_date']) && !empty($_GET['end_date'])) {
    $start_date = local_strtotime($_GET['start_date']);
    $end_date = local_strtotime($_GET['end_date']);
} else {
    $today = local_strtotime(local_date('Y-m-d'));
    $start_date = $today - 86400 * 7;
    $end_date = $today;
}
/*------------------------------------------------------ */
//--商品明细列表
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'list') {
    $account = $money_list = array();
    $account['voucher_amount'] = get_total_amount($start_date, $end_date);
    //充值总额
    $account['to_cash_amount'] = get_total_amount($start_date, $end_date, 1);
    //提现总额
    $sql = " SELECT IFNULL(SUM(user_money), 0) AS user_money, IFNULL(SUM(frozen_money), 0) AS frozen_money FROM " . $ecs->table('account_log') . " WHERE `change_time` >= " . $start_date . " AND `change_time` < " . ($end_date + 86400);
    $money_list = $db->getRow($sql);
    $account['user_money'] = price_format($money_list['user_money']);
コード例 #28
0
ファイル: function.php プロジェクト: m7720647/demo
/**
 * 获取商品销量总数
 *
 * @access public
 * @param integer $goods_id
 * @return integer
 */
function get_goods_count($goods_id)
{
    /* 统计时间段 */
    $period = C('top10_time');
    $ext = '';
    if ($period == 1) {
        // 一年
        $ext = "AND o.add_time >'" . local_strtotime('-1 years') . "'";
    } elseif ($period == 2) {
        // 半年
        $ext = "AND o.add_time > '" . local_strtotime('-6 months') . "'";
    } elseif ($period == 3) {
        // 三个月
        $ext = " AND o.add_time > '" . local_strtotime('-3 months') . "'";
    } elseif ($period == 4) {
        // 一个月
        $ext = " AND o . add_time > '" . local_strtotime(' - 1 months') . "'";
    }
    /* 查询该商品销量 */
    $sql = 'SELECT IFNULL(SUM(g.goods_number), 0) as count ' . 'FROM ' . M()->pre . 'order_info AS o, ' . M()->pre . 'order_goods AS g ' . "WHERE o . order_id = g . order_id " . " AND g . goods_id = '{$goods_id}'";
    $result = M()->getRow($sql);
    return $result['count'];
}
コード例 #29
0
ファイル: topic.php プロジェクト: netroby/ecshop
         $title_pic = DATA_DIR . '/afficheimg/' . $name;
     }
 } elseif (!empty($_REQUEST['title_url'])) {
     /* 来自互联网图片 不可以是服务器地址 */
     if (strstr($_REQUEST['title_url'], 'http') && !strstr($_REQUEST['title_url'], $_SERVER['SERVER_NAME'])) {
         /* 取互联网图片至本地 */
         $title_pic = get_url_image($_REQUEST['title_url']);
     } else {
         sys_msg($_LANG['web_url_no']);
     }
 }
 unset($name, $target);
 $title_pic = empty($title_pic) ? $_POST['title_img_url'] : $title_pic;
 require ROOT_PATH . 'includes/cls_json.php';
 $start_time = local_strtotime($_POST['start_time']);
 $end_time = local_strtotime($_POST['end_time']);
 $json = new JSON();
 $tmp_data = $json->decode($_POST['topic_data']);
 $data = serialize($tmp_data);
 $base_style = $_POST['base_style'];
 $keywords = $_POST['keywords'];
 $description = $_POST['description'];
 if ($is_insert) {
     $sql = 'INSERT INTO ' . $ecs->table('topic') . ' (title,start_time,end_time,data,intro,template,css,topic_img,title_pic,base_style, htmls,keywords,description)' . "VALUES ('{$_POST['topic_name']}','{$start_time}','{$end_time}','{$data}','{$_POST['topic_intro']}','{$_POST['topic_template_file']}','{$_POST['topic_css']}', '{$topic_img}', '{$title_pic}', '{$base_style}', '{$htmls}','{$keywords}','{$description}')";
 } else {
     $sql = 'UPDATE ' . $ecs->table('topic') . "SET title='{$_POST['topic_name']}',start_time='{$start_time}',end_time='{$end_time}',data='{$data}',intro='{$_POST['topic_intro']}',template='{$_POST['topic_template_file']}',css='{$_POST['topic_css']}', topic_img='{$topic_img}', title_pic='{$title_pic}', base_style='{$base_style}', htmls='{$htmls}', keywords='{$keywords}', description='{$description}'" . " WHERE topic_id='{$topic_id}' LIMIT 1";
 }
 $db->query($sql);
 clear_cache_files();
 $links[] = array('href' => 'topic.php', 'text' => $_LANG['back_list']);
 sys_msg($_LANG['succed'], 0, $links);
コード例 #30
0
ファイル: goods.php プロジェクト: dlpc/ecshop
 if (empty($_POST['goods_sn'])) {
     $max_id = $is_insert ? $db->getOne("SELECT MAX(goods_id) + 1 FROM " . $ecs->table('goods')) : $_REQUEST['goods_id'];
     $goods_sn = generate_goods_sn($max_id);
 } else {
     $goods_sn = $_POST['goods_sn'];
 }
 /* 处理商品数据 */
 $shop_price = !empty($_POST['shop_price']) ? floatval($_POST['shop_price']) : 0;
 $wholesale_price = !empty($_POST['wholesale_price']) ? $_POST['wholesale_price'] : 0;
 $costing_price = !empty($_POST['costing_price']) ? $_POST['costing_price'] : 0;
 $start_num = !empty($_POST['start_num']) ? intval($_POST['start_num']) : 1;
 $market_price = !empty($_POST['market_price']) ? $_POST['market_price'] : 0;
 $promote_price = !empty($_POST['promote_price']) ? floatval($_POST['promote_price']) : 0;
 $is_promote = empty($promote_price) ? 0 : 1;
 $promote_start_date = $is_promote && !empty($_POST['promote_start_date']) ? local_strtotime($_POST['promote_start_date']) : 0;
 $promote_end_date = $is_promote && !empty($_POST['promote_end_date']) ? local_strtotime($_POST['promote_end_date']) : 0;
 $goods_weight = !empty($_POST['goods_weight']) ? $_POST['goods_weight'] * $_POST['weight_unit'] : 0;
 $is_special = isset($_POST['is_special']) ? 1 : 0;
 if ($is_special) {
     $province_id = isset($_POST['province']) ? intval($_POST['province']) : 0;
     $city_id = isset($_POST['city']) ? intval($_POST['city']) : 0;
     $area_id = isset($_POST['area']) ? intval($_POST['area']) : 0;
     if ($province_id) {
         $sql_province = "SELECT region_name FROM " . $ecs->table('region') . " WHERE region_id={$province_id} ";
         $province = $db->getOne($sql_province);
     }
     $province_name = $province ? $province : '';
     if ($city_id) {
         $sql_city = "SELECT region_name FROM " . $ecs->table('region') . " WHERE region_id={$city_id} ";
         $city = $db->getOne($sql_city);
     }