dlingoods.inc.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. global $_GPC, $_W;
  3. $action = 'start';
  4. $GLOBALS['frames'] = $this->getNaveMenu($_COOKIE['cityname'], $action);
  5. $where=" WHERE a.uniacid=:uniacid and b.cityname=:cityname";
  6. $type=isset($_GPC['type'])?$_GPC['type']:'wait';
  7. if(isset($_GPC['keywords'])){
  8. $op=$_GPC['keywords'];
  9. $where.=" and a.goods_name LIKE concat('%', :name,'%') ";
  10. $data[':name']=$op;
  11. $type='all';
  12. }
  13. if(!empty($_GPC['time'])){
  14. $start=strtotime($_GPC['time']['start']);
  15. $end=strtotime($_GPC['time']['end']);
  16. $where.=" and a.time >={$start} and a.time<={$end}";
  17. }
  18. $state=$_GPC['state'];
  19. $pageindex = max(1, intval($_GPC['page']));
  20. $pagesize=10;
  21. if($type=='wait'){
  22. $_GPC['state']=1;
  23. }
  24. if($_GPC['state']){
  25. $where.=" and a.state={$_GPC['state']} ";
  26. }
  27. $data[':uniacid']=$_W['uniacid'];
  28. $data[':cityname']= $_COOKIE['cityname'];
  29. $sql="select a.*,b.store_name from " . tablename("zhtc_goods") . " a" . " left join " . tablename("zhtc_store") . " b on a.store_id=b.id" .$where." order by a.time desc ";
  30. $total=pdo_fetchcolumn("select count(*) as wname from " . tablename("zhtc_goods") . " a" . " left join " . tablename("zhtc_store") . " b on a.store_id=b.id".$where." order by a.time desc ",$data);
  31. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  32. $list=pdo_fetchall($select_sql,$data);
  33. $pager = pagination($total, $pageindex, $pagesize);
  34. if($_GPC['op']=='delete'){
  35. $res=pdo_delete('zhtc_goods',array('id'=>$_GPC['id']));
  36. if($res){
  37. message('删除成功!', $this->createWebUrl2('dlingoods'), 'success');
  38. }else{
  39. message('删除失败!','','error');
  40. }
  41. }
  42. if($_GPC['op']=='tg'){
  43. $res=pdo_update('zhtc_goods',array('state'=>2),array('id'=>$_GPC['id']));
  44. if($res){
  45. message('通过成功!', $this->createWebUrl2('dlingoods'), 'success');
  46. }else{
  47. message('通过失败!','','error');
  48. }
  49. }
  50. if($_GPC['op']=='jj'){
  51. $res=pdo_update('zhtc_goods',array('state'=>3),array('id'=>$_GPC['id']));
  52. if($res){
  53. message('拒绝成功!', $this->createWebUrl2('dlingoods'), 'success');
  54. }else{
  55. message('拒绝失败!','','error');
  56. }
  57. }
  58. include $this->template('web/dlingoods');