group.inc.php
1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
global $_GPC, $_W;
$storeid = $_COOKIE["storeid"];
$cur_store = $this->getStoreById($storeid);
$GLOBALS['frames'] = $this->getMainMenu2();
$pageindex = max(1, intval($_GPC['page']));
$pagesize = 10;
$type = isset($_GPC['type'])? $_GPC['type']: 'all';
$where = " where g.uniacid=:uniacid and g.store_id=:store_id and g.state>0";
$data[':uniacid'] = $_W['uniacid'];
$data[':store_id'] = $_COOKIE["storeid"];
if (isset($_GPC['keywords'])) {
$where .= " and ( u.name LIKE concat('%', :name,'%') || g.id LIKE concat('%', :name,'%'))";
$data[':name'] = $_GPC['keywords'];
$type = 'all';
}
if ($_GPC['time']) {
$start = strtotime($_GPC['time']['start']);
$end = strtotime($_GPC['time']['end']);
$where.=" and g.kt_time >='{$start}' and g.kt_time<='{$end}'";
$type = 'all';
} else {
if ('ing' == $type) {
$where.=" and g.state=1";
}
if ('success' == $type) {
$where.=" and g.state=2";
}
if ('fail' == $type) {
$where.=" and g.state=3";
}
}
$leftJoin = ' left join '.tablename('cjdc_user') .' as u on u.id = g.user_id ';
$sql = "SELECT g.*, u.name as userName, u.img as uImg FROM ".tablename('cjdc_group').' as g '.$leftJoin.$where." ORDER BY g.id DESC";
$total = pdo_fetchcolumn("SELECT count(*) FROM ".tablename('cjdc_group').' as g '.$leftJoin. $where, $data);
$select_sql = $sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
$list = pdo_fetchall($select_sql, $data);
$pager = pagination($total, $pageindex, $pagesize);
//打印
include $this->template('web/group');