instore.inc.php 2.4 KB

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