upgrade.inc.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. global $_GPC, $_W;
  3. $GLOBALS['frames'] = $this->getMainMenu();
  4. $where=" WHERE a.uniacid=:uniacid";
  5. $data[':uniacid']=$_W['uniacid'];
  6. $state=$_GPC['state'];
  7. $type=isset($_GPC['type'])?$_GPC['type']:'wait';
  8. if($type=='wait'){
  9. $state=1;
  10. }
  11. if($state){
  12. $where.=" and a.state=:state";
  13. $data[':state']=$state;
  14. }
  15. if(!empty($_GPC['keywords'])){
  16. $where.=" and (a.name LIKE concat('%', :name,'%') or a.tel LIKE concat('%', :name,'%'))";
  17. $data[':name']=$_GPC['keywords'];
  18. }
  19. if(!empty($_GPC['time'])){
  20. $start=strtotime($_GPC['time']['start']);
  21. $end=strtotime($_GPC['time']['end']);
  22. $where.=" and a.time >={$start} and a.time<={$end} ";
  23. }
  24. $pageindex = max(1, intval($_GPC['page']));
  25. $pagesize=10;
  26. $sql="select a.*,b.store_name from " . tablename("zhtc_upgrade") . " a" . " left join " . tablename("zhtc_store") . " b on a.store_id=b.id".$where." order by a.time desc ";
  27. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  28. $list = pdo_fetchall($select_sql,$data);
  29. $total=pdo_fetchcolumn("select count(*) from " . tablename("zhtc_upgrade") . " a" . " left join " . tablename("zhtc_store") . " b on a.store_id=b.id".$where,$data);
  30. $pager = pagination($total, $pageindex, $pagesize);
  31. if($_GPC['op']=='delete'){
  32. $res=pdo_delete('zhtc_upgrade',array('id'=>$_GPC['id']));
  33. if($res){
  34. message('删除成功!', $this->createWebUrl('upgrade'), 'success');
  35. }else{
  36. message('删除失败!','','error');
  37. }
  38. }
  39. if($_GPC['op']=='tg'){
  40. $res=pdo_update('zhtc_upgrade',array('state'=>2),array('id'=>$_GPC['id']));
  41. if($res){
  42. $rst=pdo_get('zhtc_upgrade',array('id'=>$_GPC['id']),'store_id');
  43. pdo_update('zhtc_store',array('cityname'=>''),array('id'=>$rst['store_id']));
  44. message('通过成功!', $this->createWebUrl('upgrade',array('type'=>$_GPC['type'],'page'=>$_GPC['page'])), 'success');
  45. }else{
  46. message('通过失败!','','error');
  47. }
  48. }
  49. if($_GPC['op']=='jj'){
  50. $res=pdo_update('zhtc_upgrade',array('state'=>3,'sh_time'=>time()),array('id'=>$_GPC['id']));
  51. if($res){
  52. message('拒绝成功!', $this->createWebUrl('upgrade',array('type'=>$_GPC['type'],'page'=>$_GPC['page'])), 'success');
  53. }else{
  54. message('拒绝失败!','','error');
  55. }
  56. }
  57. include $this->template('web/upgrade');