Example #1
0
 /**
  * 一键生成代理商广告
  * add by hg for 2014-09-16
  **/
 public function create_agency_ad()
 {
     $sql = "SELECT id,keyword,particulars,url,img,width,height,admin_agency_id,file,ad_name,start,position_id" . " FROM " . $this->ecs->table('ad_new') . " WHERE admin_agency_id = 0";
     $res = $this->db->getAll($sql);
     //检查代理商广告
     foreach ($res as $key => $value) {
         if ($value['position_id']) {
             foreach (agency_list() as $agency_k => $agency_v) {
                 $sql = "SELECT position_id FROM " . $this->ecs->table('ad_new') . "  WHERE position_id = {$value['position_id']} AND admin_agency_id ={$agency_k}";
                 $res = $this->db->getOne($sql);
                 //代理商没有这个广告
                 if (!$res) {
                     $arr['keyword'] = $value['keyword'];
                     $arr['particulars'] = $value['particulars'];
                     $arr['url'] = '#';
                     $arr['img'] = $value['img'];
                     $arr['width'] = $value['width'];
                     $arr['height'] = $value['height'];
                     $arr['admin_agency_id'] = $agency_k;
                     $arr['file'] = $value['file'];
                     $arr['ad_name'] = $value['ad_name'];
                     $arr['start'] = $value['start'];
                     $arr['position_id'] = $value['position_id'];
                     $this->db->autoExecute($this->ecs->table('ad_new'), $arr, 'INSERT');
                 }
             }
         }
     }
 }
Example #2
0
 public function operation()
 {
     if ($this->check_data('1')) {
         return false;
         exit;
     }
     $res = agency_list('1');
     $res = implode(',', $res);
     $this->insert_financial($this->user_money($res, '2'), '2');
     $this->insert_financial($this->user_money($res, '1'), '1');
 }
Example #3
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']);
    /*add by hg for date 2014-04-23 获取代理商信息 begin*/
    $admin_agency_id = !empty($_REQUEST['admin_agency_id']) ? $_REQUEST['admin_agency_id'] : '0';
    $res = agency_list();
    $agency_list = array('-' => '全站销售排行');
    foreach ($res as $re_k => $res_v) {
        $agency_list[$re_k] = $res_v;
    }
    $GLOBALS['smarty']->assign('agency_list', $agency_list);
    $GLOBALS['smarty']->assign('admin_agency_id', $admin_agency_id);
    $action_list = if_agency() ? 'all' : '';
    $GLOBALS['smarty']->assign('all', $action_list);
    /*end*/
    /*add by hg for date 2014-04-22		加入代理商条件*/
    $agency_where = agency_where();
    if (!empty($agency_where)) {
        $whereArr = explode(' ', $agency_where);
        $sale_where = $whereArr[0] . $whereArr[1] . ' oi.' . $whereArr[2] . $whereArr[3] . $whereArr[4];
    }
    /*end*/
    $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'] . "'";
    }
    /*add by hg for date 2014-04-23 根据代理商筛选  begin*/
    if (!empty($admin_agency_id) && if_agency()) {
        if ($admin_agency_id != '-') {
            $where .= " AND oi.admin_agency_id = '{$admin_agency_id}' ";
        }
    } elseif (if_agency()) {
        $where .= " AND oi.admin_agency_id = '0' ";
    }
    /*end*/
    $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 . $sale_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;
}
Example #4
0
function get_exchange_goodslist()
{
    /*add by hg for date 2014-03-26 只显示代理商本身的产品*/
    if (!if_agency()) {
        $admin_goods_row = $GLOBALS['db']->getRow("select agency_user_id from " . $GLOBALS['ecs']->table('admin_user') . "where user_id = {$_SESSION['admin_id']}");
        $agency_where = " admin_agency_id = {$admin_goods_row['agency_user_id']}  AND ";
    }
    /*end*/
    /*add by hg for date 2014-05-08 获取代理商信息 begin*/
    $admin_agency_id = !empty($_REQUEST['admin_agency_id']) ? $_REQUEST['admin_agency_id'] : '0';
    $res = agency_list();
    $agency_list = array('-' => '所有积分商品');
    foreach ($res as $re_k => $res_v) {
        $agency_list[$re_k] = $res_v;
    }
    $GLOBALS['smarty']->assign('agency_list', $agency_list);
    $GLOBALS['smarty']->assign('admin_agency_id', $admin_agency_id);
    $action_list = if_agency() ? 'all' : '';
    $GLOBALS['smarty']->assign('all', $action_list);
    /*end*/
    /*     $result = get_filter();
        if ($result === false)
        { */
    $filter = array();
    $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
    if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
        $filter['keyword'] = json_str_iconv($filter['keyword']);
    }
    $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'eg.goods_id' : trim($_REQUEST['sort_by']);
    $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
    $where = '';
    if (!empty($filter['keyword'])) {
        $where = " AND g.goods_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%'";
    }
    /*add by hg for date 2014-04-23 根据代理商筛选  begin*/
    if (!empty($admin_agency_id) && if_agency()) {
        if ($admin_agency_id != '-') {
            $a_where = " AND admin_agency_id = '{$admin_agency_id}' ";
        }
    } elseif (if_agency()) {
        $a_where = " AND admin_agency_id = '0' ";
    }
    /*end*/
    /* 文章总数 */
    $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('exchange_goods') . ' AS eg ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = eg.goods_id ' . 'WHERE ' . $agency_where . ' 1 ' . $where . $a_where;
    $filter['record_count'] = $GLOBALS['db']->getOne($sql);
    $filter = page_and_size($filter);
    /* 获取文章数据 */
    $sql = 'SELECT eg.* , g.goods_name ' . 'FROM ' . $GLOBALS['ecs']->table('exchange_goods') . ' AS eg ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = eg.goods_id ' . 'WHERE ' . $agency_where . ' 1 ' . $where . $a_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();
    //print_r($sql);die;
    $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
    while ($rows = $GLOBALS['db']->fetchRow($res)) {
        $arr[] = $rows;
    }
    return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
Example #5
0
/**
 *
 *
 * @access  public
 * @param
 *
 * @return void
 */
function account_list()
{
    $result = get_filter();
    if ($result === false) {
        /*add by hg for date 2014-04-23 获取代理商信息 begin*/
        $filter['admin_agency_id'] = !empty($_REQUEST['admin_agency_id']) ? intval($_REQUEST['admin_agency_id']) : 0;
        $GLOBALS['smarty']->assign('agency_list', agency_list());
        $GLOBALS['smarty']->assign('admin_agency_id', $filter['admin_agency_id']);
        $action_list = if_agency() ? 'all' : '';
        $GLOBALS['smarty']->assign('all', $action_list);
        /*end*/
        /*时间*/
        //dump($filter);
        /* 过滤列表 */
        $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('-7 days') : $_REQUEST['start_date'];
        $filter['end_date'] = empty($_REQUEST['end_date']) ? local_strtotime('today') : $_REQUEST['end_date'];
        if (strpos($filter['start_date'], '-')) {
            $filter['start_date'] = local_strtotime($filter['start_date']);
            $filter['end_date'] = local_strtotime($filter['end_date']);
        }
        $where = " WHERE 1 ";
        /*add by hg for date 2014-04-22 只显示代理商本身所属信息 begin*/
        $where .= agency_where();
        /*end*/
        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 add_time >= " . $filter['start_date'] . " AND add_time < '" . $filter['end_date'] . "'";
        }
        /*add by hg for date 2014-04-23 根据代理商筛选 begin*/
        if ($filter['admin_agency_id'] > 0 && if_agency()) {
            $where .= " AND ua.admin_agency_id  = '{$filter['admin_agency_id']}' ";
        }
        /*end*/
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('user_account') . " AS ua LEFT JOIN " . $GLOBALS['ecs']->table('users') . " AS u on ua.user_id = u.user_id" . $where;
        //dump($sql);
        $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);
    tongji($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']];
    }
    $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']);
    $arr = array('list' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
Example #6
0
/**
 * 获取评论列表
 * @access  public
 * @return  array
 */
function get_comment_list()
{
    /*add by hg for date 2014-04-30 代理商筛选 begin*/
    $admin_agency_id = !empty($_REQUEST['admin_agency_id']) ? $_REQUEST['admin_agency_id'] : 0;
    $res = agency_list();
    $agency_list = array('-' => '全站留言');
    foreach ($res as $re_k => $res_v) {
        $agency_list[$re_k] = $res_v;
    }
    $GLOBALS['smarty']->assign('agency_list', $agency_list);
    $GLOBALS['smarty']->assign('admin_agency_id', $admin_agency_id);
    $action_list = if_agency() ? 'all' : '';
    $GLOBALS['smarty']->assign('all', $action_list);
    if ($admin_agency_id) {
        $agency_user_id = $admin_agency_id;
    } else {
        $agency_user_id = $GLOBALS['db']->getOne("select agency_user_id from " . $GLOBALS['ecs']->table('admin_user') . " where user_id = {$_SESSION['admin_id']}");
    }
    if (!empty($agency_user_id)) {
        if ($agency_user_id != '-') {
            $join = "left join " . $GLOBALS['ecs']->table('goods') . " as g on g.goods_id = c.id_value";
            $join_where = "AND g.admin_agency_id = {$agency_user_id}";
        }
    } elseif (empty($agency_user_id) && if_agency()) {
        $join = "left join " . $GLOBALS['ecs']->table('goods') . " as g on g.goods_id = c.id_value";
        $join_where = "AND g.admin_agency_id = 0";
    }
    /*end*/
    /* 查询条件 */
    $filter['keywords'] = empty($_REQUEST['keywords']) ? 0 : trim($_REQUEST['keywords']);
    //print_r($filter['keywords']);die;
    if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
        $filter['keywords'] = json_str_iconv($filter['keywords']);
    }
    $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']);
    $where = !empty($filter['keywords']) ? " AND content LIKE '%" . mysql_like_quote($filter['keywords']) . "%' " : '';
    $sql = "SELECT count(*) FROM " . $GLOBALS['ecs']->table('comment') . " WHERE parent_id = 0 {$where}";
    $filter['record_count'] = $GLOBALS['db']->getOne($sql);
    /* 分页大小 */
    $filter = page_and_size($filter);
    //print_r($filter);die;
    /* 获取评论数据 */
    $arr = array();
    $sql = "SELECT c.* FROM " . $GLOBALS['ecs']->table('comment') . " as c {$join} WHERE parent_id = 0 {$join_where} {$where} " . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . $filter['start'] . ", {$filter['page_size']}";
    $res = $GLOBALS['db']->query($sql);
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        $sql = $row['comment_type'] == 0 ? "SELECT goods_name FROM " . $GLOBALS['ecs']->table('goods') . " WHERE goods_id='{$row['id_value']}'" : "SELECT title FROM " . $GLOBALS['ecs']->table('article') . " WHERE article_id='{$row['id_value']}'";
        $row['title'] = $GLOBALS['db']->getOne($sql);
        /* 标记是否回复过 */
        //        $sql = "SELECT COUNT(*) FROM " .$GLOBALS['ecs']->table('comment'). " WHERE parent_id = '$row[comment_id]'";
        //        $row['is_reply'] =  ($GLOBALS['db']->getOne($sql) > 0) ?
        //            $GLOBALS['_LANG']['yes_reply'] : $GLOBALS['_LANG']['no_reply'];
        $row['add_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']);
        $arr[] = $row;
    }
    $filter['keywords'] = stripslashes($filter['keywords']);
    $arr = array('item' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
Example #7
0
/**
 * 获得设置信息
 *
 * @param   array   $groups     需要获得的设置组
 * @param   array   $excludes   不需要获得的设置组
 *
 * @return  array
 */
function get_settings($groups = null, $excludes = null)
{
    global $db, $ecs, $_LANG;
    $config_groups = '';
    $excludes_groups = '';
    if (!empty($groups)) {
        foreach ($groups as $key => $val) {
            $config_groups .= " AND (id='{$val}' OR parent_id='{$val}')";
        }
    }
    if (!empty($excludes)) {
        foreach ($excludes as $key => $val) {
            $excludes_groups .= " AND (parent_id<>'{$val}' AND id<>'{$val}')";
        }
    }
    /*add by hg for date 2014-05-04筛选代理商 begin*/
    $admin_agency_id = !empty($_REQUEST['admin_agency_id']) ? $_REQUEST['admin_agency_id'] : '';
    $GLOBALS['smarty']->assign('agency_list', agency_list());
    $GLOBALS['smarty']->assign('admin_agency_id', $admin_agency_id);
    /*end*/
    /* 隐藏skype msn ym licence */
    $hide = " code not in('ym','msn','skype','licensed') AND ";
    /* 取出全部数据:分组和变量 */
    if (if_agency() && empty($admin_agency_id)) {
        $sql = "SELECT * FROM " . $ecs->table('shop_config') . " WHERE {$hide} type<>'hidden' {$config_groups} {$excludes_groups} ORDER BY parent_id, sort_order, id";
    } else {
        // add by hg for date 2014-05-04 代理商
        $sql = "SELECT * FROM " . $ecs->table('shop_config') . " WHERE {$hide} type<>'hidden' AND parent_id <> 1 {$config_groups} {$excludes_groups} ORDER BY parent_id, sort_order, id";
    }
    $item_list = $db->getAll($sql);
    /*add by hg for date 2014-05-04 代理商商店设置信息*/
    if (!if_agency() || !empty($admin_agency_id)) {
        $agency_where = agency_where($admin_agency_id);
        $agency_list = $db->getAll("SELECT * FROM " . $ecs->table('agency_shop_config') . " WHERE {$hide} type<>'hidden' {$agency_where} {$config_groups} {$excludes_groups} ORDER BY parent_id, sort_order, id");
        $item_list = array_merge($item_list, $agency_list);
    }
    /* 整理数据 */
    $group_list = array();
    foreach ($item_list as $key => $item) {
        $pid = $item['parent_id'];
        $item['name'] = isset($_LANG['cfg_name'][$item['code']]) ? $_LANG['cfg_name'][$item['code']] : $item['code'];
        $item['desc'] = isset($_LANG['cfg_desc'][$item['code']]) ? $_LANG['cfg_desc'][$item['code']] : '';
        if ($item['code'] == 'sms_shop_mobile') {
            $item['url'] = 1;
        }
        if ($pid == 0) {
            /* 分组 */
            if ($item['type'] == 'group') {
                $group_list[$item['id']] = $item;
            }
        } else {
            //dump($group_list[$pid]);
            /* 变量 */
            if (isset($group_list[$pid])) {
                if ($item['store_range']) {
                    $item['store_options'] = explode(',', $item['store_range']);
                    foreach ($item['store_options'] as $k => $v) {
                        $item['display_options'][$k] = isset($_LANG['cfg_range'][$item['code']][$v]) ? $_LANG['cfg_range'][$item['code']][$v] : $v;
                    }
                }
                $group_list[$pid]['vars'][] = $item;
            }
        }
    }
    return $group_list;
}
Example #8
0
    if (isset($_POST['query_by_year'])) {
        /* 年走势 */
        $query_type = 'year';
        $start_time = local_mktime(0, 0, 0, 1, 1, intval($_POST['year_beginYear']));
        $end_time = local_mktime(23, 59, 59, 12, 31, intval($_POST['year_endYear']));
    } else {
        /* 月走势 */
        $query_type = 'month';
        $start_time = local_mktime(0, 0, 0, intval($_POST['month_beginMonth']), 1, intval($_POST['month_beginYear']));
        $end_time = local_mktime(23, 59, 59, intval($_POST['month_endMonth']), 1, intval($_POST['month_endYear']));
        $end_time = local_mktime(23, 59, 59, intval($_POST['month_endMonth']), date('t', $end_time), intval($_POST['month_endYear']));
    }
}
/*add by hg for date 2014-04-23 获取代理商信息与根据代理商筛选 begin*/
$admin_agency_id = !empty($_REQUEST['admin_agency_id']) ? $_REQUEST['admin_agency_id'] : '0';
$res = agency_list();
$agency_list = array('-' => '全站销售概况');
foreach ($res as $re_k => $res_v) {
    $agency_list[$re_k] = $res_v;
}
$GLOBALS['smarty']->assign('agency_list', $agency_list);
$GLOBALS['smarty']->assign('admin_agency_id', $admin_agency_id);
$action_list = if_agency() ? 'all' : '';
$GLOBALS['smarty']->assign('all', $action_list);
if (!empty($admin_agency_id) && if_agency()) {
    if ($admin_agency_id != '-') {
        $agency_where .= " AND admin_agency_id = '{$admin_agency_id}' ";
    }
} elseif (if_agency()) {
    $agency_where = " AND admin_agency_id = '0' ";
}
Example #9
0
File: vote.php Project: dlpc/ecshop
function get_votelist()
{
    $filter = array();
    /* 加入代理商搜索条件 by hg*/
    $filter['admin_agency_id'] = isset($_REQUEST['admin_agency_id']) ? trim($_REQUEST['admin_agency_id']) : '';
    if (!$filter['admin_agency_id']) {
        $agency_where = agency_where();
        if (!$agency_where) {
            $agency_where = "AND admin_agency_id = 0";
        }
    } else {
        $agency_where = " AND admin_agency_id = {$filter['admin_agency_id']}";
    }
    /* 代理商列表 */
    $arr_res = agency_list();
    $GLOBALS['smarty']->assign('agency_list', $arr_res);
    /*判断代理商或管理员*/
    if (if_agency()) {
        $GLOBALS['smarty']->assign('if_agency', if_agency());
    }
    /* 记录总数以及页数 */
    $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('vote') . " WHERE 1 {$agency_where}";
    $filter['record_count'] = $GLOBALS['db']->getOne($sql);
    $filter = page_and_size($filter);
    /* 查询数据 */
    $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('vote') . " WHERE 1 {$agency_where} ORDER BY vote_id DESC";
    $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
    $list = array();
    while ($rows = $GLOBALS['db']->fetchRow($res)) {
        $rows['begin_date'] = local_date('Y-m-d', $rows['start_time']);
        $rows['end_date'] = local_date('Y-m-d', $rows['end_time']);
        $list[] = $rows;
    }
    return array('list' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
Example #10
0
/**
 * 取得订单概况数据(包括订单的几种状态)
 * @param       $start_date    开始查询的日期
 * @param       $end_date      查询的结束日期
 * @return      $order_info    订单概况数据
 */
function get_orderinfo($start_date, $end_date)
{
    /*add by hg for date 2014-04-23 获取代理商信息与根据代理商筛选 begin*/
    $admin_agency_id = !empty($_REQUEST['admin_agency_id']) ? $_REQUEST['admin_agency_id'] : '0';
    $res = agency_list();
    $agency_list = array('-' => '全站订单统计');
    foreach ($res as $re_k => $res_v) {
        $agency_list[$re_k] = $res_v;
    }
    $GLOBALS['smarty']->assign('agency_list', $agency_list);
    $GLOBALS['smarty']->assign('admin_agency_id', $admin_agency_id);
    $action_list = if_agency() ? 'all' : '';
    $GLOBALS['smarty']->assign('all', $action_list);
    if (!empty($admin_agency_id) && if_agency()) {
        if ($admin_agency_id != '-') {
            $agency_where = " AND admin_agency_id = '{$admin_agency_id}' ";
        }
    } elseif (if_agency()) {
        $agency_where = " AND admin_agency_id = '0' ";
    }
    /*end*
    	
        $order_info = array();
    	/*add by hg for date 2014-04-22		获取客户统计信息加入条件判定为当前代理商下的客户信息*/
    $where = agency_where();
    /*end*/
    /* 未确认订单数 */
    $sql = 'SELECT COUNT(*) AS unconfirmed_num FROM ' . $GLOBALS['ecs']->table('order_info') . " WHERE order_status = '" . OS_UNCONFIRMED . "' AND add_time >= '{$start_date}'" . " AND add_time < '" . ($end_date + 86400) . "' {$where} {$agency_where}";
    $order_info['unconfirmed_num'] = $GLOBALS['db']->getOne($sql);
    /* 已确认订单数 */
    $sql = 'SELECT COUNT(*) AS confirmed_num FROM ' . $GLOBALS['ecs']->table('order_info') . " WHERE order_status IN (1,5) AND shipping_status IN (0,5) AND pay_status IN (2,0) AND add_time >= '{$start_date}'" . " AND add_time < '" . ($end_date + 86400) . "' {$where} {$agency_where}";
    // dump($sql);
    $order_info['confirmed_num'] = $GLOBALS['db']->getOne($sql);
    /* 已成交订单数 */
    $sql = 'SELECT COUNT(*) AS succeed_num FROM ' . $GLOBALS['ecs']->table('order_info') . " WHERE 1 " . order_query_sql('finished') . " AND add_time >= '{$start_date}' AND add_time < '" . ($end_date + 86400) . "' {$where} {$agency_where}";
    $order_info['succeed_num'] = $GLOBALS['db']->getOne($sql);
    /* 无效或已取消订单数 */
    $sql = "SELECT COUNT(*) AS invalid_num FROM " . $GLOBALS['ecs']->table('order_info') . " WHERE order_status IN ('2','4','3') {$where} {$agency_where}" . " AND add_time >= '{$start_date}' AND add_time < '" . ($end_date + 86400) . "'";
    $order_info['invalid_num'] = $GLOBALS['db']->getOne($sql);
    return $order_info;
}
Example #11
0
/**
 * 获取活动列表
 *
 * @access  public
 *
 * @return void
 */
function get_snatchlist()
{
    $result = get_filter();
    if ($result === false) {
        /* 查询条件 */
        $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['sort_by'] = empty($_REQUEST['sort_by']) ? 'act_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        /*add by hg for date 2014-05-08 获取代理商信息 begin*/
        $admin_agency_id = !empty($_REQUEST['admin_agency_id']) ? $_REQUEST['admin_agency_id'] : '0';
        //dump($admin_agency_id);
        $agency_list = agency_list();
        $GLOBALS['smarty']->assign('agency_list', $agency_list);
        $GLOBALS['smarty']->assign('admin_agency_id', $admin_agency_id);
        $action_list = if_agency() ? 'all' : '';
        $GLOBALS['smarty']->assign('all', $action_list);
        /*end*/
        //根据代理商过滤信息
        $where = agency_where();
        $where .= !empty($filter['keywords']) ? " AND act_name like '%" . mysql_like_quote($filter['keywords']) . "%'" : '';
        /*add by hg for date 2014-05-08 根据代理商筛选  begin*/
        if (if_agency() && !empty($admin_agency_id)) {
            $where .= " AND admin_agency_id = '{$admin_agency_id}' ";
        } elseif (if_agency()) {
            $where .= " AND admin_agency_id = '0' ";
        }
        /*end*/
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('goods_activity') . " WHERE act_type =" . GAT_SNATCH . $where;
        //dump($sql);
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter = page_and_size($filter);
        /* 获活动数据 */
        $sql = "SELECT act_id, act_name AS snatch_name, goods_name, start_time, end_time, is_finished, ext_info, product_id " . " FROM " . $GLOBALS['ecs']->table('goods_activity') . " WHERE act_type = " . GAT_SNATCH . $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'];
    }
    $row = $GLOBALS['db']->getAll($sql);
    foreach ($row as $key => $val) {
        $row[$key]['start_time'] = local_date($GLOBALS['_CFG']['time_format'], $val['start_time']);
        $row[$key]['end_time'] = local_date($GLOBALS['_CFG']['time_format'], $val['end_time']);
        $info = unserialize($row[$key]['ext_info']);
        unset($row[$key]['ext_info']);
        if ($info) {
            foreach ($info as $info_key => $info_val) {
                $row[$key][$info_key] = $info_val;
            }
        }
    }
    $arr = array('snatchs' => $row, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
Example #12
0
/**
 * 取得销售明细数据信息
 * @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']);
    /*add by hg for date 2014-04-23 获取代理商信息 begin*/
    $filter['admin_agency_id'] = !empty($_REQUEST['admin_agency_id']) ? $_REQUEST['admin_agency_id'] : '0';
    /*add by ccx for date 2014-11-12 获取支付类型payment_method*/
    $filter['payment_method'] = empty($_REQUEST['payment_method']) ? '' : trim($_REQUEST['payment_method']);
    /*end*/
    $res = agency_list();
    $agency_list = array('-' => '全站');
    foreach ($res as $re_k => $res_v) {
        $agency_list[$re_k] = $res_v;
    }
    $GLOBALS['smarty']->assign('agency_list', $agency_list);
    $GLOBALS['smarty']->assign('admin_agency_id', $filter['admin_agency_id']);
    $action_list = if_agency() ? 'all' : '';
    $GLOBALS['smarty']->assign('all', $action_list);
    /*end*/
    /*add by hg for date 2014-04-22		加入代理商条件*/
    $agency_where = agency_where();
    if (!empty($agency_where)) {
        $whereArr = explode(' ', $agency_where);
        $sale_where = $whereArr[0] . $whereArr[1] . ' oi.' . $whereArr[2] . $whereArr[3] . $whereArr[4];
    }
    /*end*/
    /* 查询数据的条件 */
    $where = " WHERE og.order_id = oi.order_id" . order_query_sql('finished', 'oi.') . " AND oi.add_time >= '" . $filter['start_date'] . "' \r\n               AND oi.add_time < '" . ($filter['end_date'] + 86400) . "'{$sale_where}";
    /*add by hg for date 2014-04-23 根据代理商筛选  begin*/
    if (!empty($filter['admin_agency_id']) && if_agency()) {
        if ($filter['admin_agency_id'] != '-') {
            $where .= " AND oi.admin_agency_id = " . $filter['admin_agency_id'];
        }
    } elseif (if_agency()) {
        $where .= " AND admin_agency_id = '0' ";
    }
    /*en
    	/*end*/
    /*add by ccx for date 2014-11-12  根据选择支付类型(余额支付,货到付款,在线支付三种)筛选  begin*/
    if ($filter['payment_method']) {
        //$where .= " AND o.pay_id  = '$filter[payment_method]'";
        if ($filter['payment_method'] == 3) {
            $where .= " AND ( oi.pay_id !=1 AND oi.pay_id !=2 AND oi.pay_id !=0)";
        } elseif ($filter['payment_method'] == 1) {
            $where .= " AND oi.pay_id  = 1";
        } elseif ($filter['payment_method'] == 2) {
            $where .= " AND oi.pay_id  = 2";
        }
    }
    /*end*/
    $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);
    /* modify by SouthBear 2014-12-04 16:13:04
     * 增加 oi.order_amount, oi.goods_amount order_amount 字段用途不明,TABLE中无数据
     */
    $sql = 'SELECT og.goods_id, og.costing_price,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,oi.order_amount,
    		oi.goods_amount , og.stock_costing_price ' . "FROM " . $GLOBALS['ecs']->table('order_goods') . " AS og, " . $GLOBALS['ecs']->table('order_info') . " AS oi " . $where . " ORDER BY sales_time DESC, goods_num DESC";
    $statistics_sql = $sql;
    if ($is_pagination) {
        $sql .= " LIMIT " . $filter['start'] . ', ' . $filter['page_size'];
    }
    $sale_list_data = $GLOBALS['db']->getAll($sql);
    /* modify by SouthBear 2014-12-04 16:13:04
     * 将订单成本和订单金额重新计算
     */
    //if (count($sale_list_data) > 0) {
    foreach ($sale_list_data as $key => $item) {
        //$sale_list_data[$key]['profit_total'] = price_format(($sale_list_data[$key]['sales_price'] - $sale_list_data[$key]['costing_price'])*$sale_list_data[$key]['goods_num']); //利润
        /*ccx 2014-12-10 订单商品的利润*/
        $sale_list_data[$key]['profit_total'] = price_format($sale_list_data[$key]['sales_price'] * $sale_list_data[$key]['goods_num'] - $sale_list_data[$key]['stock_costing_price']);
        //利润
        $sale_list_data[$key]['unit_sales_price'] = price_format($sale_list_data[$key]['sales_price']);
        //订单单价
        //成本
        $sale_list_data[$key]['unit_costing_price'] = price_format($sale_list_data[$key]['costing_price']);
        //成本单价
        //$sale_list_data[$key]['order_costing_price'] = price_format($sale_list_data[$key]['costing_price'] * $sale_list_data[$key]['goods_num']); //订单成本
        /*ccx 2014-12-10 ccx 读取订单商品表新建的库存商品成本总价*/
        $sale_list_data[$key]['order_costing_price'] = $sale_list_data[$key]['stock_costing_price'];
        //订单成本总价
        //订单总金额
        $sale_list_data[$key]['goods_amount'] = price_format($sale_list_data[$key]['sales_price'] * $sale_list_data[$key]['goods_num']);
        $sale_list_data[$key]['sales_time'] = local_date($GLOBALS['_CFG']['time_format'], $sale_list_data[$key]['sales_time']);
    }
    $statistics = statistics($statistics_sql);
    $arr = array('sale_list_data' => $sale_list_data, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count'], 'statistics' => $statistics);
    //} else {
    //	$arr = false;
    //}
    return $arr;
}
Example #13
0
/**
 *  返回用户列表数据
 *
 * @access  public
 * @param
 *
 * @return void
 */
function user_list()
{
    $result = get_filter();
    if ($result === false) {
        /*add by hg for date 2014-03-25 bagein*/
        $admin_id = isset($_SESSION['admin_id']) ? $_SESSION['admin_id'] : 0;
        $admin_user_id = $GLOBALS['db']->getRow("select agency_user_id from " . $GLOBALS['ecs']->table('admin_user') . "where user_id = {$admin_id}");
        /*end*/
        /*add by hg for date 2014-04-23 获取代理商信息 begin*/
        $filter['admin_agency_id'] = !empty($_REQUEST['admin_agency_id']) ? trim($_REQUEST['admin_agency_id']) : 0;
        $GLOBALS['smarty']->assign('agency_list', agency_list());
        $GLOBALS['smarty']->assign('admin_agency_id', $filter['admin_agency_id']);
        $action_list = if_agency() ? 'all' : '';
        $GLOBALS['smarty']->assign('all', $action_list);
        /*end*/
        /* 过滤条件 */
        $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['rank'] = empty($_REQUEST['rank']) ? 0 : intval($_REQUEST['rank']);
        $filter['pay_points_gt'] = empty($_REQUEST['pay_points_gt']) ? 0 : intval($_REQUEST['pay_points_gt']);
        $filter['pay_points_lt'] = empty($_REQUEST['pay_points_lt']) ? 0 : intval($_REQUEST['pay_points_lt']);
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'user_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        /*add by hg for date 2014-03-25 bagein*/
        if ($admin_user_id['agency_user_id'] != null) {
            $ex_where = ' WHERE top_rank = ' . $admin_user_id['agency_user_id'] . '';
        } else {
            $ex_where = ' WHERE 1 = 1';
        }
        /*end*/
        if ($filter['keywords']) {
            $ex_where .= " AND user_name LIKE '%" . mysql_like_quote($filter['keywords']) . "%'";
        }
        if ($filter['rank']) {
            $sql = "SELECT min_points, max_points, special_rank FROM " . $GLOBALS['ecs']->table('user_rank') . " WHERE rank_id = '{$filter['rank']}'";
            $row = $GLOBALS['db']->getRow($sql);
            if ($row['special_rank'] > 0) {
                /* 特殊等级 */
                $ex_where .= " AND user_rank = '{$filter['rank']}' ";
            } else {
                $ex_where .= " AND rank_points >= " . intval($row['min_points']) . " AND rank_points < " . intval($row['max_points']);
            }
        }
        if ($filter['pay_points_gt']) {
            $ex_where .= " AND pay_points >= '{$filter['pay_points_gt']}' ";
        }
        if ($filter['pay_points_lt']) {
            $ex_where .= " AND pay_points < '{$filter['pay_points_lt']}' ";
        }
        /*add by hg for date 2014-04-23 根据代理商筛选 begin*/
        if (!empty($filter['admin_agency_id']) && if_agency()) {
            if ($filter['admin_agency_id'] == 'top') {
                $ex_where .= ' AND user_id IN (' . implode(',', agency_list('1')) . ')';
            } else {
                $ex_where .= " AND top_rank = '{$filter['admin_agency_id']}'";
            }
        } elseif (if_agency()) {
            $ex_where .= ' AND user_id not in (' . implode(',', agency_list('1')) . ') AND top_rank = 0';
        }
        /*end*/
        //dump($ex_where);
        $filter['record_count'] = $GLOBALS['db']->getOne("SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('users') . $ex_where);
        /* 分页大小 */
        $filter = page_and_size($filter);
        $sql = "SELECT user_id, user_name, email, is_validated, user_money, frozen_money, rank_points, pay_points, reg_time " . " FROM " . $GLOBALS['ecs']->table('users') . $ex_where . " ORDER by " . $filter['sort_by'] . ' ' . $filter['sort_order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
        //print_r($sql);die;
        $filter['keywords'] = stripslashes($filter['keywords']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $user_list = $GLOBALS['db']->getAll($sql);
    //print_r($sql);
    //dump($user_list);
    $count = count($user_list);
    for ($i = 0; $i < $count; $i++) {
        $user_list[$i]['reg_time'] = local_date($GLOBALS['_CFG']['date_format'], $user_list[$i]['reg_time']);
    }
    $arr = array('user_list' => $user_list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
Example #14
0
function auction_list()
{
    $result = get_filter();
    if ($result === false) {
        /*add by hg for date 2014-05-08 获取代理商信息 begin*/
        $admin_agency_id = !empty($_REQUEST['admin_agency_id']) ? $_REQUEST['admin_agency_id'] : '0';
        //dump($admin_agency_id);
        $agency_list = agency_list();
        $GLOBALS['smarty']->assign('agency_list', $agency_list);
        $GLOBALS['smarty']->assign('admin_agency_id', $admin_agency_id);
        $action_list = if_agency() ? 'all' : '';
        $GLOBALS['smarty']->assign('all', $action_list);
        /*end*/
        $where = "";
        //根据代理商过滤信息
        $where .= agency_where();
        /*add by hg for date 2014-05-08 根据代理商筛选  begin*/
        if (if_agency() && !empty($admin_agency_id)) {
            $where .= " AND admin_agency_id = '{$admin_agency_id}' ";
        } elseif (if_agency()) {
            $where .= " AND admin_agency_id = '0' ";
        }
        /*end*
          /* 过滤条件 */
        $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
        if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
            $filter['keyword'] = json_str_iconv($filter['keyword']);
        }
        $filter['is_going'] = empty($_REQUEST['is_going']) ? 0 : 1;
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'act_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        if (!empty($filter['keyword'])) {
            $where .= " AND goods_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%'";
        }
        if ($filter['is_going']) {
            $now = gmtime();
            $where .= " AND is_finished = 0 AND start_time <= '{$now}' AND end_time >= '{$now}' ";
        }
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('goods_activity') . " WHERE act_type = '" . GAT_AUCTION . "' {$where}";
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        /* 分页大小 */
        $filter = page_and_size($filter);
        /* 查询 */
        $sql = "SELECT * " . "FROM " . $GLOBALS['ecs']->table('goods_activity') . " WHERE act_type = '" . GAT_AUCTION . "' {$where} " . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . $filter['start'] . ", {$filter['page_size']}";
        $filter['keyword'] = stripslashes($filter['keyword']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $res = $GLOBALS['db']->query($sql);
    $list = array();
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        $ext_info = unserialize($row['ext_info']);
        $arr = array_merge($row, $ext_info);
        $arr['start_time'] = local_date('Y-m-d H:i', $arr['start_time']);
        $arr['end_time'] = local_date('Y-m-d H:i', $arr['end_time']);
        $list[] = $arr;
    }
    $arr = array('item' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
Example #15
0
    // 取供货商列表
    $goods_list = goods_list(0, 1, ' AND is_special=1 ');
    //dump($goods_list);
    $smarty->assign('goods_list', $goods_list['goods']);
    $smarty->assign('filter', $goods_list['filter']);
    $smarty->assign('record_count', $goods_list['record_count']);
    $smarty->assign('page_count', $goods_list['page_count']);
    $smarty->assign('full_page', 1);
    /* 排序标记 */
    $sort_flag = sort_flag($goods_list['filter']);
    $smarty->assign($sort_flag['tag'], $sort_flag['img']);
    /* 获取商品类型存在规格的类型 */
    $specifications = get_goods_type_specifications();
    $smarty->assign('specifications', $specifications);
    /*add by hg for date 2014-04-23 代理商列表 begin*/
    $smarty->assign('agency_list', agency_list());
    $smarty->assign('admin_agency_id', $admin_agency_id);
    $action_list = if_agency() ? 'all' : '';
    $smarty->assign('all', $action_list);
    /*end*/
    /* 重写预览链接 */
    $goods_url = and_agency_url() ? 'http://' . and_agency_url() : 'http://' . agency_url();
    $smarty->assign('url', $goods_url);
    /* 显示商品列表页面 */
    assign_query_info();
    $smarty->display('goods_special_list.htm');
} elseif ($_REQUEST['act'] == 'add' || $_REQUEST['act'] == 'edit' || $_REQUEST['act'] == 'special_edit' || $_REQUEST['act'] == 'copy') {
    //echo $_REQUEST['act'];
    include_once ROOT_PATH . 'includes/fckeditor/fckeditor.php';
    // 包含 html editor 类文件
    $smarty->assign('act', $_REQUEST['act']);
Example #16
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']);
    /*add by hg for date 2014-04-23 获取代理商信息 begin*/
    $admin_agency_id = !empty($_REQUEST['admin_agency_id']) ? $_REQUEST['admin_agency_id'] : '0';
    $res = agency_list();
    $agency_list = array('-' => '全站会员排行');
    foreach ($res as $re_k => $res_v) {
        $agency_list[$re_k] = $res_v;
    }
    $GLOBALS['smarty']->assign('agency_list', $agency_list);
    $GLOBALS['smarty']->assign('admin_agency_id', $admin_agency_id);
    $action_list = if_agency() ? 'all' : '';
    $GLOBALS['smarty']->assign('all', $action_list);
    /*end*/
    /*add by hg for date 2014-04-22		获取客户统计信息加入条件判定为当前代理商下的客户信息*/
    $user_order_where = agency_where();
    if (!empty($user_order_where)) {
        $whereArr = explode(' ', $user_order_where);
        $user_order_where = $whereArr[0] . $whereArr[1] . ' o.' . $whereArr[2] . $whereArr[3] . $whereArr[4];
    }
    /*end*/
    $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'] . "'";
    }
    /*add by hg for date 2014-04-23 根据代理商筛选  begin*/
    if (!empty($admin_agency_id) && if_agency()) {
        if ($admin_agency_id != '-') {
            $where .= " AND o.admin_agency_id = '{$admin_agency_id}' ";
        }
    } elseif (if_agency()) {
        $where .= " AND admin_agency_id = '0' ";
    }
    /*end*/
    $sql = "SELECT count(distinct(u.user_id)) FROM " . $ecs->table('users') . " AS u, " . $ecs->table('order_info') . " AS o " . $where . $user_order_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 . $user_order_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;
}
Example #17
0
/*初始化数据交换对象 */
$exc = new exchange($ecs->table("stock_out_type"), $db, 'id', '');
/*------------------------------------------------------ */
//-- 出库类型管理列表
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'list') {
    /* 权限判断 */
    //admin_priv('stock_out_type');
    /* 取得过滤条件 */
    $filter = array();
    $smarty->assign('ur_here', "出库类型管理");
    $smarty->assign('action_link', array('text' => "添加出库类型", 'href' => 'stock_out_type.php?act=add'));
    $smarty->assign('full_page', 1);
    $smarty->assign('filter', $filter);
    /* 代理商列表 */
    $arr_res = agency_list();
    $GLOBALS['smarty']->assign('agency_list', $arr_res);
    $type_list = get_typelist();
    /*判断代理商或管理员*/
    if (if_agency()) {
        $smarty->assign('if_agency', if_agency());
    }
    $smarty->assign('type_list', $type_list['arr']);
    $smarty->assign('filter', $type_list['filter']);
    $smarty->assign('record_count', $type_list['record_count']);
    $smarty->assign('page_count', $type_list['page_count']);
    assign_query_info();
    $smarty->display('stock_out_type_list.htm');
} elseif ($_REQUEST['act'] == 'add') {
    /* 权限判断 */
    admin_priv('stock_out_type');
Example #18
0
     $agency_list[$re_k] = $res_v;
 }
 $GLOBALS['smarty']->assign('agency_list', $agency_list);
 $GLOBALS['smarty']->assign('admin_agency_id', $admin_agency_id);
 $action_list = if_agency() ? 'all' : '';
 $GLOBALS['smarty']->assign('all', $action_list);
 if (!empty($admin_agency_id) && if_agency()) {
     if ($admin_agency_id != '-') {
         $admin_agency_where = " AND admin_agency_id = '{$admin_agency_id}' ";
         $admin_agency_arr = explode(' ', $admin_agency_where);
         $admin_agency_user_where = $admin_agency_arr[0] . 'where top_rank ' . $admin_agency_arr[3] . $admin_agency_arr[4];
     }
 } elseif (if_agency()) {
     $admin_agency_where = " AND admin_agency_id = '0' ";
     $admin_agency_arr = explode(' ', $admin_agency_where);
     $admin_agency_user_where = $admin_agency_arr[0] . 'where top_rank ' . $admin_agency_arr[3] . $admin_agency_arr[4] . ' AND user_id not in (' . implode(',', agency_list('1')) . ')';
 }
 /*end*
 	
 	
 	/*add by hg for date 2014-04-22		获取客户统计信息加入条件判定为当前代理商下的客户信息*/
 $where = agency_where();
 if (!empty($where)) {
     $whereArr = explode(' ', $where);
     $user_where = $whereArr[0] . 'where top_rank ' . $whereArr[3] . $whereArr[4];
 }
 /*end*/
 /* 取得会员总数 */
 $users =& init_users();
 $sql = "SELECT COUNT(*) FROM " . $ecs->table("users") . $user_where . $admin_agency_user_where;
 $res = $db->getCol($sql);