本文整理汇总了PHP中set_filter函数的典型用法代码示例。如果您正苦于以下问题:PHP set_filter函数的具体用法?PHP set_filter怎么用?PHP set_filter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_filter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sms_list
/**
* 返回短信列表数据
*/
function sms_list($class_code, $phone)
{
$result = get_filter();
if ($result === false) {
/* 过滤条件 */
$filter['keywords'] = empty($_REQUEST['search_keyword']) ? '' : trim($_REQUEST['search_keyword']);
//关键字
$filter['phones'] = empty($_REQUEST['search_phones']) ? '' : trim($_REQUEST['search_phones']);
//学校code
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['keywords'] = json_str_iconv($filter['keywords']);
}
$filter['sort'] = empty($_REQUEST['sort']) ? 'sms_id' : trim($_REQUEST['sort']);
$filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
$filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
$filter['page_size'] = empty($_REQUEST['rows']) ? '20' : trim($_REQUEST['rows']);
$ex_where = " WHERE class_code='" . $class_code . "' and phones like '%{$phone}%'";
if ($filter['keywords']) {
$ex_where .= " AND content LIKE '%" . mysql_like_quote($filter['keywords']) . "%'";
}
$filter['record_count'] = $GLOBALS['db']->getOne("SELECT COUNT(*) FROM " . $GLOBALS["ecs"]->table("sms") . $ex_where);
/* 分页大小 */
$filter = page_and_size($filter);
$sql = "SELECT * " . " FROM " . $GLOBALS["ecs"]->table("sms") . $ex_where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
$filter['keywords'] = stripslashes($filter['keywords']);
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$sms_list = $GLOBALS['db']->getAll($sql);
$arr = array('rows' => $sms_list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
return $arr;
}
示例2: course_list
/**
* 返回班级管理员列表数据
*
* @access public
* @param
*
* @return void
*/
function course_list()
{
$result = get_filter();
if ($result === false) {
/* 过滤条件 */
$filter['semster'] = empty($_REQUEST['search_semster']) ? '' : trim($_REQUEST['search_semster']);
//名称
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['semster'] = json_str_iconv($filter['semster']);
}
$ex_where = " WHERE class_code='" . $_SESSION["class_code"] . "' ";
if ($filter['semster']) {
$ex_where .= " AND semster = '" . mysql_like_quote($filter['semster']) . "'";
}
$sql = "SELECT * FROM " . $GLOBALS['ecs']->table("course") . $ex_where;
// echo $sql; echo '<br>';
$filter['semster'] = stripslashes($filter['semster']);
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$list = $GLOBALS['db']->getRow($sql);
return $list;
}
示例3: exam_prj_list
/**
* 返回班级管理员列表数据
*
* @access public
* @param
*
* @return void
*/
function exam_prj_list()
{
$result = get_filter();
if ($result === false) {
/* 过滤条件 */
$filter['name'] = empty($_REQUEST['search_name']) ? '' : trim($_REQUEST['search_name']);
//名称
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['name'] = json_str_iconv($filter['name']);
}
$filter['sort'] = empty($_REQUEST['sort']) ? 'prj_id' : trim($_REQUEST['sort']);
$filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
$filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
$filter['page_size'] = empty($_REQUEST['rows']) ? '25' : trim($_REQUEST['rows']);
$ex_where = " WHERE class_code='" . $_SESSION["class_code"] . "' ";
if ($filter['name']) {
$ex_where .= " AND name like '" . mysql_like_quote($filter['name']) . "%'";
}
$sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table("exam_prj") . $ex_where;
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
/* 分页大小 */
$filter = page_and_size($filter);
$sql = "SELECT * " . " FROM " . $GLOBALS['ecs']->table("exam_prj") . $ex_where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
// echo $sql; echo '<br>';
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$list = $GLOBALS['db']->getAll($sql);
$arr = array('rows' => $list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
return $arr;
}
示例4: agency_pay_log_list
function agency_pay_log_list()
{
$filter['order_sn'] = empty($_REQUEST['order_sn']) ? '' : trim($_REQUEST['order_sn']);
$filter['status'] = empty($_REQUEST['status']) ? '' : trim($_REQUEST['status']);
$filter['admin_agency_id'] = empty($_REQUEST['admin_agency_id']) ? '' : trim($_REQUEST['admin_agency_id']);
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'id' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
$where = '';
$where .= agency_where();
$where = preg_replace('|admin_agency_id|', 'ag.agency_id', $where);
//dump($where);
/* 订单号 */
if (!empty($filter['order_sn'])) {
$where .= " AND oi.order_sn = {$filter['order_sn']}";
}
/*状态*/
if (!empty($filter['status'])) {
$where .= " AND ag.status = {$filter['status']}";
}
/*代理商*/
if (!empty($filter['admin_agency_id'])) {
$where .= " AND ag.agency_id = {$filter['admin_agency_id']}";
}
$sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('agency_pay_log') . "as ag left join " . $GLOBALS['ecs']->table('users') . " as u on u.user_id = ag.user_id left join " . $GLOBALS['ecs']->table('admin_user') . " as au on au.agency_user_id = ag.agency_id left join " . $GLOBALS['ecs']->table('order_info') . " as oi on oi.order_id = ag.order_id WHERE 1 {$where} order by {$filter['sort_by']} {$filter['sort_order']} ";
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
$filter = page_and_size($filter);
$sql = "SELECT ag.id,oi.order_sn,ag.order_id,au.user_name as admin_name,u.user_name,ag.order_amount,ag.time,ag.status FROM " . $GLOBALS['ecs']->table('agency_pay_log') . "as ag left join " . $GLOBALS['ecs']->table('users') . " as u on u.user_id = ag.user_id left join " . $GLOBALS['ecs']->table('admin_user') . " as au on au.agency_user_id = ag.agency_id left join " . $GLOBALS['ecs']->table('order_info') . " as oi on oi.order_id = ag.order_id WHERE 1 {$where} order by {$filter['sort_by']} {$filter['sort_order']} LIMIT " . $filter['start'] . ", " . $filter['page_size'] . "";
$filter['keywords'] = stripslashes($filter['keywords']);
set_filter($filter, $sql);
$res = $GLOBALS['db']->getAll($sql);
//dump($res);
$arr = array('res' => $res, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
return $arr;
}
示例5: get_temp_list
function get_temp_list()
{
// Obtaion to the temp list
$result = get_filter();
if ($result === false) {
$filter = array();
$where = "WHERE 1";
$filter['bdate'] = empty($_REQUEST['bdate']) ? date('Y-m-d') : trim($_REQUEST['bdate']);
if (!empty($_REQUEST['city'])) {
$where .= " AND ";
} else {
$where .= " AND a.country" . db_create_in(array_keys($_SESSION['city_arr']));
}
$where .= " AND a.order_status=1 AND b.goods_price>100";
if ($filter['bdate']) {
$where .= " AND a.best_time BETWEEN '" . $filter['bdate'] . " 00:00:00' AND '" . $filter['bdate'] . " 23:59:59'";
}
$query = "SELECT DISTINCT COUNT(*) FROM ecs_order_info AS a \r\n\t\t\tLEFT JOIN ecs_order_goods AS b ON a.order_id=b.order_id \r\n\t\t\tLEFT JOIN order_dispatch AS c ON c.order_id=a.order_id \r\n\t\t\tLEFT JOIN ship_route AS d ON d.route_id=c.route_id {$where}";
$filter['record_count'] = $GLOBALS['db_read']->getOne($query);
$filter = page_and_size($filter);
$limit = "LIMIT " . $filter['start'] . "," . $filter['page_size'] . "";
$sql = "SELECT SUM(b.goods_number) AS gnum,c.turn,d.station_id \r\n\t\t\tFROM ecs_order_info AS a \r\n\t\t\tLEFT JOIN ecs_order_goods AS b ON a.order_id=b.order_id \r\n\t\t\tLEFT JOIN order_dispatch AS c ON c.order_id=a.order_id \r\n\t\t\tLEFT JOIN ship_route AS d ON d.route_id=c.route_id {$where} \r\n\t\t\tGROUP BY c.turn,d.station_id {$limit}";
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$list = $GLOBALS['db_read']->getAll($sql);
return array('list' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
示例6: goods_stock
function goods_stock()
{
global $ecs, $db;
$result = get_filter($param_str);
if ($result === false) {
$filter['goods_name'] = empty($_REQUEST['goods_name']) ? '' : trim($_REQUEST['goods_name']);
$filter['goods_sn'] = empty($_REQUEST['goods_sn']) ? '' : trim($_REQUEST['goods_sn']);
$where = ' WHERE supplier_id=' . $_SESSION['supplier_id'];
if (!empty($filter['goods_name'])) {
$where .= ' AND goods_name LIKE "%' . $filter['goods_name'] . '%" ';
}
if (!empty($filter['goods_sn'])) {
$where .= ' AND goods_sn LIKE "%' . $filter['goods_sn'] . '%" ';
}
$sql = 'SELECT COUNT(*) FROM ' . $ecs->table('goods') . $where;
$filter['record_count'] = $db->getOne($sql);
$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;
}
$filter = page_and_size($filter);
$limit = ' LIMIT ' . $filter['start'] . ',' . $filter['page_size'];
$sql = 'SELECT goods_id,goods_sn,goods_name,goods_number FROM ' . $ecs->table('goods') . $where . $limit;
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$goods = $db->getAll($sql);
foreach ($goods as $goods_key => $goods_val) {
$sql = 'SELECT goods_attr AS goods_attr_id,product_number FROM ' . $ecs->table('products') . ' WHERE goods_id=' . $goods_val['goods_id'];
$attr = $db->getAll($sql);
foreach ($attr as $attr_key => $attr_val) {
$goods_attr_arr = explode('|', $attr_val['goods_attr_id']);
$attr_sql = implode(' OR goods_attr_id= ', $goods_attr_arr);
$sql = 'SELECT attr_value FROM ' . $ecs->table('goods_attr') . ' WHERE goods_attr_id=' . $attr_sql;
$attr_name_arr = $db->getAll($sql);
$attr_name = '';
foreach ($attr_name_arr as $name_key => $name_val) {
$attr_name .= implode(' ', $name_val);
}
$attr_val['goods_attr_name'] = $attr_name;
$attr[$attr_key] = $attr_val;
}
$goods_val['goods_attr'] = $attr;
$goods[$goods_key] = $goods_val;
}
$arr = array('goods' => $goods, 'filter' => $filter);
return $arr;
}
示例7: download_list
/**
* 返回班级管理员列表数据
*
* @access public
* @param
*
* @return void
*/
function download_list()
{
$result = get_filter();
if ($result === false) {
/* 过滤条件 */
$filter['download_type'] = empty($_REQUEST['search_download_type']) ? '' : trim($_REQUEST['search_download_type']);
//编号
$filter['name'] = empty($_REQUEST['search_name']) ? '' : trim($_REQUEST['search_name']);
//名称
$filter['sdate'] = empty($_REQUEST['search_sdate']) ? '' : trim($_REQUEST['search_sdate']);
//起始日期
$filter['edate'] = empty($_REQUEST['search_edate']) ? '' : trim($_REQUEST['search_edate']);
//截止日期
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['name'] = json_str_iconv($filter['name']);
}
$filter['sort'] = empty($_REQUEST['sort']) ? 'download_id' : trim($_REQUEST['sort']);
$filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
$filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
$filter['page_size'] = empty($_REQUEST['rows']) ? '25' : trim($_REQUEST['rows']);
$ex_where = " WHERE d.class_code='" . $_SESSION["class_code"] . "' ";
if ($filter['download_type']) {
$ex_where .= " AND d.type = '" . mysql_like_quote($filter['download_type']) . "'";
}
if ($filter['name']) {
$ex_where .= " AND d.name like '" . mysql_like_quote($filter['name']) . "%'";
}
if ($filter['sdate']) {
$ex_where .= " AND d.created >='" . mysql_like_quote($filter['sdate']) . "'";
}
if ($filter['edate']) {
$ex_where .= " AND d.created <='" . mysql_like_quote($filter['edate']) . "'";
}
$sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table("download") . " d " . $ex_where;
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
/* 分页大小 */
$filter = page_and_size($filter);
$sql = "SELECT d.*, s.name as download_type " . " FROM " . $GLOBALS['ecs']->table("download") . " d left join " . $GLOBALS['ecs']->table("download_type") . " s on d.type=s.dtype_id " . $ex_where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
// echo $sql; echo '<br>';
$filter['student_code'] = stripslashes($filter['student_code']);
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$list = $GLOBALS['db']->getAll($sql);
$arr = array('rows' => $list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
return $arr;
}
示例8: person_list
/**
* 返回班级管理员列表数据
*
* @access public
* @param
*
* @return void
*/
function person_list()
{
$result = get_filter();
if ($result === false) {
/* 过滤条件 */
$filter['keywords'] = empty($_REQUEST['keywords']) ? '' : trim($_REQUEST['keywords']);
//名称
$filter['tel'] = empty($_REQUEST['tel']) ? '' : trim($_REQUEST['tel']);
//电话
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['keywords'] = json_str_iconv($filter['keywords']);
}
$filter['sort'] = empty($_REQUEST['sort']) ? 'person_id' : trim($_REQUEST['sort']);
$filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
$filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
$filter['page_size'] = empty($_REQUEST['rows']) ? '25' : trim($_REQUEST['rows']);
$ex_where = " WHERE class_code='" . $_SESSION["class_code"] . "' ";
if ($filter['keywords']) {
$ex_where .= " AND name LIKE '%" . mysql_like_quote($filter['keywords']) . "%'";
}
if ($filter['tel']) {
$ex_where .= " AND tel = '" . mysql_like_quote($filter['tel']) . "'";
}
$sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table("person") . $ex_where;
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
/* 分页大小 */
$filter = page_and_size($filter);
$sql = "SELECT * " . " FROM " . $GLOBALS['ecs']->table("person") . $ex_where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
// echo $sql; echo '<br>';
$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=>$val)
// {
// $list[$key]['created'] = local_date($GLOBALS['_CFG']['time_format'], $val['created']);
// }
$arr = array('rows' => $list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
return $arr;
}
示例9: get_email_list
function get_email_list()
{
$result = get_filter();
if ($result === false) {
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'stat' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'ASC' : trim($_REQUEST['sort_order']);
$sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('email_list');
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
/* 分页大小 */
$filter = page_and_size($filter);
/* 查询 */
$sql = "SELECT * FROM " . $GLOBALS['ecs']->table('email_list') . " ORDER BY " . $filter['sort_by'] . ' ' . $filter['sort_order'] . " LIMIT " . $filter['start'] . ",{$filter['page_size']}";
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$emaildb = $GLOBALS['db']->getAll($sql);
$arr = array('emaildb' => $emaildb, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
return $arr;
}
示例10: forum_list
/**
* 返回班级管理员列表数据
*
* @access public
* @param
*
* @return void
*/
function forum_list()
{
$result = get_filter();
if ($result === false) {
/* 过滤条件 */
$filter['keyword'] = empty($_REQUEST['search_keyword']) ? '' : trim($_REQUEST['search_keyword']);
//主体
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['keyword'] = json_str_iconv($filter['keyword']);
}
$filter['sort'] = empty($_REQUEST['sort']) ? 'forum_id' : trim($_REQUEST['sort']);
$filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
$filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
$filter['page_size'] = empty($_REQUEST['rows']) ? '25' : trim($_REQUEST['rows']);
$ex_where = " WHERE parent_id=0 and class_code='" . $_SESSION["class_code"] . "' ";
if ($filter['keyword']) {
$ex_where .= " AND (title like '%" . mysql_like_quote($filter['keyword']) . "%'";
$ex_where .= " OR content like '%" . mysql_like_quote($filter['keyword']) . "%')";
}
$sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table("forum") . $ex_where;
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
/* 分页大小 */
$filter = page_and_size($filter);
$sql = "SELECT * " . " FROM " . $GLOBALS['ecs']->table("forum") . $ex_where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
// echo $sql; echo '<br>';
$filter['keyword'] = stripslashes($filter['keyword']);
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$list = $GLOBALS['db']->getAll($sql);
foreach ($list as $key => $val) {
$list[$key]['setime'] = $val['stime'] . "-" . $val['etime'];
}
$arr = array('rows' => $list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
return $arr;
}
示例11: exam_subject_list
/**
* 返回班级管理员列表数据
*
* @access public
* @param
*
* @return void
*/
function exam_subject_list($table)
{
$result = get_filter();
if ($result === false) {
$filter['sort'] = empty($_REQUEST['sort']) ? 'subject_id' : trim($_REQUEST['sort']);
$filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
$filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
$filter['page_size'] = empty($_REQUEST['rows']) ? '25' : trim($_REQUEST['rows']);
$where = " WHERE class_code='" . $_SESSION['class_code'] . "' ";
$sql = "SELECT COUNT(*) FROM " . $table . $where;
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
/* 分页大小 */
$filter = page_and_size($filter);
$sql = "SELECT * " . " FROM " . $table . $where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
// echo $sql; echo '<br>';
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$list = $GLOBALS['db']->getAll($sql);
$arr = array('rows' => $list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
return $arr;
}
示例12: group_buy_list
function group_buy_list()
{
$result = get_filter();
if ($result === false) {
/* 过滤条件 */
$filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
if ($_REQUEST['is_ajax'] == 1) {
$filter['keyword'] = json_str_iconv($filter['keyword']);
}
$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']);
$where = !empty($filter['keyword']) ? " AND goods_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%'" : '';
$sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('goods_activity') . " WHERE act_type = '" . GAT_GROUP_BUY . "' {$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_GROUP_BUY . "' {$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']);
$stat = group_buy_stat($row['act_id'], $ext_info['deposit']);
$arr = array_merge($row, $stat, $ext_info);
/* 处理价格阶梯 */
$price_ladder = $arr['price_ladder'];
if (!is_array($price_ladder) || empty($price_ladder)) {
$price_ladder = array(array('amount' => 0, 'price' => 0));
} else {
foreach ($price_ladder as $key => $amount_price) {
$price_ladder[$key]['formated_price'] = price_format($amount_price['price']);
}
}
/* 计算当前价 */
$cur_price = $price_ladder[0]['price'];
// 初始化
$cur_amount = $stat['valid_goods'];
// 当前数量
foreach ($price_ladder as $amount_price) {
if ($cur_amount >= $amount_price['amount']) {
$cur_price = $amount_price['price'];
} else {
break;
}
}
$arr['cur_price'] = $cur_price;
$status = group_buy_status($arr);
$arr['start_time'] = local_date($GLOBALS['_CFG']['date_format'], $arr['start_time']);
$arr['end_time'] = local_date($GLOBALS['_CFG']['date_format'], $arr['end_time']);
$arr['cur_status'] = $GLOBALS['_LANG']['gbs'][$status];
$list[] = $arr;
}
$arr = array('item' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
return $arr;
}
示例13: get_typelist
function get_typelist()
{
$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.add_time' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
$where = '';
if (!empty($filter['keyword'])) {
$where = " AND a.remarks LIKE '%" . mysql_like_quote($filter['keyword']) . "%'";
}
/*加入代理商条件*/
if (!$filter['admin_agency_id']) {
$agency_where = agency_where();
if (!$agency_where) {
$agency_where = "AND a.admin_agency_id = 0";
} else {
$agency_where = "AND a.admin_agency_id = " . admin_agency_id();
}
} else {
$agency_where = " AND a.admin_agency_id = {$filter['admin_agency_id']}";
}
//dump($agency_where);
/* 出库类型总数 */
$sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('stock_out_type') . ' AS a ' . 'WHERE 1 ' . $where . $agency_where;
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
$filter = page_and_size($filter);
/* 获取出库类型数据 */
$sql = 'SELECT a.* , u.user_name ' . 'FROM ' . $GLOBALS['ecs']->table('stock_out_type') . ' AS a ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('admin_user') . ' AS u ON u.user_id = a.user_id ' . 'WHERE 1 ' . $where . $agency_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['add_time']);
$arr[] = $rows;
}
return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
示例14: rebate_list
/**
* 获取供应商列表信息
*
* @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;
}
示例15: get_magazine
function get_magazine()
{
$result = get_filter();
if ($result === false) {
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'template_id' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
$sql = "SELECT count(*) FROM " . $GLOBALS['ecs']->table('mail_templates') . " WHERE type = 'magazine'";
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
/* 分页大小 */
$filter = page_and_size($filter);
/* 查询 */
$sql = "SELECT * " . " FROM " . $GLOBALS['ecs']->table('mail_templates') . " WHERE type = 'magazine'" . " ORDER by " . $filter['sort_by'] . ' ' . $filter['sort_order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$magazinedb = $GLOBALS['db']->getAll($sql);
foreach ($magazinedb as $k => $v) {
$magazinedb[$k]['last_modify'] = local_date('Y-m-d', $v['last_modify']);
$magazinedb[$k]['last_send'] = local_date('Y-m-d', $v['last_send']);
}
$arr = array('magazinedb' => $magazinedb, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
return $arr;
}