qggoodall.inc.php
2.12 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu();
$where=" WHERE a.uniacid=:uniacid";
$data[':uniacid']=$_W['uniacid'];
if($_GPC['keywords']){
$where .=" and (a.name LIKE :name || c.name LIKE :name)";
$op=$_GPC['keywords'];
$data[':name']="%$op%";
}
if($_GPC['type_id']){
$where .=" and a.type_id=:type_id";
$data[':type_id']=$_GPC['type_id'];
}
if($_GPC['is_shelves2']){
$where .=" and a.state=:cid";
$data[':cid']=$_GPC['is_shelves2'];
}
$pageindex = max(1, intval($_GPC['page']));
$pagesize=10;
$sql="select a.* ,b.name as type_name,c.name as store_name from " . tablename("cjdc_qggoods") . " a" . " left join " . tablename("cjdc_qgtype") . " b on b.id=a.type_id left join " . tablename("cjdc_store") . " c on c.id=a.store_id ".$where." order by num asc";
$select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
$list = pdo_fetchall($select_sql,$data);
$total=pdo_fetchcolumn("select count(*) from " . tablename("cjdc_qggoods") . " a" . " left join " . tablename("cjdc_qgtype") . " b on b.id=a.type_id left join " . tablename("cjdc_store") . " c on c.id=a.store_id ".$where,$data);
$pager = pagination($total, $pageindex, $pagesize);
$type=pdo_getall('cjdc_qgtype',array('uniacid'=>$_W['uniacid']));
if($_GPC['op']=='del'){
$res=pdo_delete('cjdc_qggoods',array('id'=>$_GPC['id']));
if($res){
message('删除成功',$this->createWebUrl('qggoodall',array()),'success');
}else{
message('删除失败','','error');
}
}
if($_GPC['state']){
$res=pdo_update('cjdc_qggoods',array('state'=>$_GPC['state']),array('id'=>$_GPC['id']));
if($res){
message('编辑成功',$this->createWebUrl('qggoodall',array()),'success');
}else{
message('编辑失败','','error');
}
}
if($_GPC['state2']){
$res=pdo_update('cjdc_qggoods',array('state2'=>$_GPC['state2']),array('id'=>$_GPC['id']));
if($res){
message('编辑成功',$this->createWebUrl('qggoodall',array()),'success');
}else{
message('编辑失败','','error');
}
}
include $this->template('web/qggoodall');