dlininformation.inc.php 3.5 KB

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