yjtx.inc.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. global $_GPC, $_W;
  3. // $action = 'ad';
  4. // $title = $this->actions_titles[$action];
  5. $GLOBALS['frames'] = $this->getMainMenu();
  6. $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
  7. $type=empty($_GPC['type']) ? 'all' :$_GPC['type'];
  8. $status=$_GPC['status'];
  9. $pageindex = max(1, intval($_GPC['page']));
  10. $pagesize=10;
  11. $where=' WHERE a.uniacid=:uniacid and a.is_del=1';
  12. $data[':uniacid']=$_W['uniacid'];
  13. if($_GPC['keywords']){
  14. $where.=" and c.cityname LIKE concat('%', :name,'%') ";
  15. $data[':name']=$_GPC['keywords'];
  16. }
  17. if($type=='all'){
  18. $sql="SELECT a.*,b.username,c.cityname FROM ".tablename('zhtc_yjtx') . " a" . " left join " . tablename("users") . " b on a.account_id=b.uid left join " . tablename("zhtc_account") . " c on a.account_id=c.uid ". $where." ORDER BY a.cerated_time DESC";
  19. $total=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zhtc_yjtx') . " a" . " left join " . tablename("users") . " b on a.account_id=b.uid left join " . tablename("zhtc_account") . " c on a.account_id=c.uid ". $where." ORDER BY a.cerated_time DESC",$data);
  20. }else{
  21. $where.= " and a.status=$status";
  22. $sql="SELECT a.*,b.username,c.cityname FROM ".tablename('zhtc_yjtx') . " a" . " left join " . tablename("users") . " b on a.account_id=b.uid left join " . tablename("zhtc_account") . " c on a.account_id=c.uid ". $where." ORDER BY a.cerated_time DESC";
  23. $data[':uniacid']=$_W['uniacid'];
  24. $total=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zhtc_yjtx') . " a" . " left join " . tablename("users") . " b on a.account_id=b.uid left join " . tablename("zhtc_account") . " c on a.account_id=c.uid ". $where." ORDER BY a.cerated_time DESC",$data);
  25. }
  26. $list=pdo_fetchall( $sql,$data);
  27. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  28. $list=pdo_fetchall($select_sql,$data);
  29. $pager = pagination($total, $pageindex, $pagesize);
  30. if($operation=='adopt'){//审核通过
  31. $id=$_GPC['id'];
  32. $res=pdo_update('zhtc_yjtx',array('status'=>2,'time'=>date('Y-m-d H:i:s')),array('id'=>$id));
  33. if($res){
  34. message('审核成功',$this->createWebUrl('yjtx',array()),'success');
  35. }else{
  36. message('审核失败','','error');
  37. }
  38. }
  39. if($operation=='reject'){
  40. $id=$_GPC['id'];
  41. $res=pdo_update('zhtc_yjtx',array('status'=>3),array('id'=>$id));
  42. if($res){
  43. message('拒绝成功',$this->createWebUrl('yjtx',array()),'success');
  44. }else{
  45. message('拒绝失败','','error');
  46. }
  47. }
  48. if($operation=='delete'){
  49. $id=$_GPC['id'];
  50. $res=pdo_update('zhtc_yjtx',array('is_del'=>2),array('id'=>$id));
  51. if($res){
  52. message('删除成功',$this->createWebUrl('yjtx',array()),'success');
  53. }else{
  54. message('删除失败','','error');
  55. }
  56. }
  57. include $this->template('web/yjtx');