number.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
<?php
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu2();
$storeid=$_COOKIE["storeid"];
$cur_store = $this->getStoreById($storeid);
$pageindex = max(1, intval($_GPC['page']));
$pagesize=20;
$time=strtotime(date("Y-m-d"));
$del="delete from ".tablename('cjdc_number')." where uniacid={$_W['uniacid']} and unix_timestamp(time)< {$time}";
pdo_query($del);
$where=" WHERE uniacid={$_W['uniacid']} and store_id={$storeid} and state!=4";
$sql=" select id,num,state,count(id) as count from" . tablename("cjdc_number") .$where." group by num ";
$select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
$list = pdo_fetchall($select_sql);
$total=pdo_fetchcolumn("select count(*) from " . tablename("cjdc_number").$where." group by num ");
foreach($list as $key => $value){
$num=$value['num'];
$newsql=" select id,num,code from ".tablename('cjdc_number')." where uniacid={$_W['uniacid']} and store_id={$storeid} and num='{$num}' and state=1 order by id asc";
$res=pdo_fetch($newsql);
if($res){
$list[$key]['dq']=$res['code'];
$list[$key]['pid']=$res['id'];
}else{
$list[$key]['dq']='暂无排队信息';
$list[$key]['pid']='null';
}
}
$pager = pagination($total, $pageindex, $pagesize);
if($_GPC['op']=="delete"){
$result = pdo_delete('cjdc_number', array('id'=>$_GPC['id']));
if($result){
message('删除成功',$this->createWebUrl('number',array()),'success');
}else{
message('删除失败','','error');
}
}
include $this->template('web/number');