dlinstore.inc.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. global $_GPC, $_W;
  3. $action = 'start';
  4. $GLOBALS['frames'] = $this->getNaveMenu($_COOKIE['cityname'], $action);
  5. $where=" where a.uniacid=:uniacid and a.cityname=:cityname";
  6. $data[':uniacid']=$_W['uniacid'];
  7. $data[':cityname']= $_COOKIE['cityname'];
  8. $type=isset($_GPC['type'])?$_GPC['type']:'wait';
  9. $state=$_GPC['state'];
  10. if($type=='wait'){
  11. $state=1;
  12. }
  13. if(isset($_GPC['keywords'])){
  14. $where.=" and a.store_name LIKE concat('%', :name,'%') ";
  15. $data[':name']=$_GPC['keywords'];
  16. $type='all';
  17. }else{
  18. if($state){
  19. $where.=" and a.state=:state ";
  20. $data[':state']=$state;
  21. }
  22. }
  23. $pageindex = max(1, intval($_GPC['page']));
  24. $pagesize=10;
  25. $sql="SELECT a.*,b.type as typename FROM ".tablename('zhtc_store'). " a" . " left join " . tablename("zhtc_in") . " b on b.id=a.type".$where." ORDER BY a.id DESC";
  26. $total=pdo_fetchcolumn("select count(*) from " .tablename('zhtc_store'). " a" . " left join " . tablename("zhtc_in") . " b on b.id=a.type".$where,$data);
  27. //echo $sql;die;
  28. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  29. $list=pdo_fetchall($select_sql,$data);
  30. $pager = pagination($total, $pageindex, $pagesize);
  31. if($_GPC['op']=='delete'){
  32. $res=pdo_delete('zhtc_store',array('id'=>$_GPC['id']));
  33. if($res){
  34. message('删除成功!', $this->createWebUrl2('dlinstore'), 'success');
  35. }else{
  36. message('删除失败!','','error');
  37. }
  38. }
  39. if($_GPC['op']=='tg'){
  40. $rst=pdo_get('zhtc_store',array('id'=>$_GPC['id']));
  41. if(!$rst['sh_time']){//增加
  42. if($rst['type']==1){
  43. $time=24*60*60*7;
  44. }
  45. if($rst['type']==2){
  46. $time=24*182*60*60;
  47. }
  48. if($rst['type']==3){
  49. $time=24*365*60*60;
  50. }
  51. $time2=time();
  52. $res=pdo_update('zhtc_store',array('state'=>2,'sh_time'=>$time2,'dq_time'=>time()+$time),array('id'=>$_GPC['id']));
  53. }else{//修改
  54. $res=pdo_update('zhtc_store',array('state'=>2),array('id'=>$_GPC['id']));
  55. }
  56. if($res){
  57. message('通过成功!', $this->createWebUrl2('dlinstore'), 'success');
  58. }else{
  59. message('通过失败!','','error');
  60. }
  61. }
  62. if($_GPC['op']=='jj'){
  63. $res=pdo_update('zhtc_store',array('state'=>3,'sh_time'=>time()),array('id'=>$_GPC['id']));
  64. if($res){
  65. message('拒绝成功!', $this->createWebUrl2('dlinstore'), 'success');
  66. }else{
  67. message('拒绝失败!','','error');
  68. }
  69. }
  70. include $this->template('web/dlinstore');