ininformation.inc.php 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. global $_GPC, $_W;
  3. /*if($_GPC['cityname']){
  4. setcookie('cityname',$_GPC['cityname']);
  5. //$cityname=$_COOKIE['cityname'];
  6. $_COOKIE['cityname']=$_GPC['cityname'];
  7. }*/
  8. $type=isset($_GPC['type'])?$_GPC['type']:'wait';
  9. $GLOBALS['frames'] = $this->getMainMenu2();
  10. $where=" where a.uniacid=:uniacid and a.cityname=:cityname";
  11. $data[':uniacid']=$_W['uniacid'];
  12. $data[':cityname']= $_COOKIE['cityname'];
  13. if(isset($_GPC['keywords'])){
  14. $where.=" and (a.user_name LIKE concat('%', :name,'%') || a.user_tel LIKE concat('%', :name,'%') || a.details LIKE concat('%', :name,'%') || a.cityname LIKE concat('%', :name,'%') || a.user_name LIKE concat('%', :name,'%')) ";
  15. $data[':name']=$_GPC['keywords'];
  16. $type='all';
  17. }else{
  18. if($type=='wait'||$type=='ok'||$type=='no'){
  19. $where.=" and a.state=:state";
  20. $data[':state']=$_GPC['state'];
  21. }
  22. }
  23. if(!empty($_GPC['time'])){
  24. $start=strtotime($_GPC['time']['start']);
  25. $end=strtotime($_GPC['time']['end']);
  26. $where.=" and a.time >={$start} and a.time<={$end}";
  27. }
  28. if($_GPC['top']){
  29. $where.=" and a.top=:top";
  30. $data[':top']=$_GPC['top'];
  31. }
  32. $pageindex = max(1, intval($_GPC['page']));
  33. $pagesize=10;
  34. $sql="select a.*,b.type from".tablename('zhtc_information'). " a" . " left join " . tablename("zhtc_top") . " b on b.id=a.top_type".$where." ORDER BY a.id DESC";
  35. $total=pdo_fetchcolumn("select count(*) from".tablename('zhtc_information'). " a" . " left join " . tablename("zhtc_top") . " b on b.id=a.top_type".$where,$data);
  36. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  37. $list=pdo_fetchall($select_sql,$data);
  38. $pager = pagination($total, $pageindex, $pagesize);
  39. if($_GPC['op']=='delete'){
  40. $res=pdo_delete('zhtc_information',array('id'=>$_GPC['id']));
  41. if($res){
  42. message('删除成功!', $this->createWebUrl('ininformation',array('type'=>$_GPC['type'],'page'=>$_GPC['page'])), 'success');
  43. }else{
  44. message('删除失败!','','error');
  45. }
  46. }
  47. if($_GPC['op']=='tg'){
  48. $tz=pdo_get('zhtc_information',array('id'=>$_GPC['id']));
  49. if(!$tz['sh_time']){
  50. if($tz['top_type']==1){
  51. $time=time()+24*60*60;
  52. }elseif($tz['top_type']==2){
  53. $time=time()+24*60*60*7;
  54. }elseif($tz['top_type']==3){
  55. $time=time()+24*60*60*30;
  56. }
  57. $res=pdo_update('zhtc_information',array('state'=>2,'sh_time'=>time(),'dq_time'=>$time),array('id'=>$_GPC['id']));
  58. }else{
  59. $res=pdo_update('zhtc_information',array('state'=>2),array('id'=>$_GPC['id']));
  60. }
  61. if($res){
  62. $this->increaseScore($tz['user_id']);
  63. file_get_contents("".$_W['siteroot']."app/index.php?i=".$_W['uniacid']."&c=entry&a=wxapp&do=tgMessage&m=zh_tcwq&information_id=".$_GPC['id']);//模板消息
  64. message('通过成功!', $this->createWebUrl('ininformation',array('type'=>$_GPC['type'],'page'=>$_GPC['page'])), 'success');
  65. }else{
  66. message('通过失败!','','error');
  67. }
  68. }
  69. if($_GPC['op']=='jj'){
  70. $res=pdo_update('zhtc_information',array('state'=>3,'sh_time'=>time()),array('id'=>$_GPC['id']));
  71. if($res){
  72. message('拒绝成功!', $this->createWebUrl('ininformation',array('type'=>$_GPC['type'],'page'=>$_GPC['page'])), 'success');
  73. }else{
  74. message('拒绝失败!','','error');
  75. }
  76. }
  77. include $this->template('web/ininformation');