sjgroupgoods.inc.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. global $_GPC, $_W;
  3. $storeid=$_COOKIE["storeid"];
  4. $cur_store = $this->getStoreById($storeid);
  5. $GLOBALS['frames'] = $this->getNaveMenu2($storeid);
  6. $types=pdo_getall('zhtc_grouptype',array('uniacid'=>$_W['uniacid']),array('name','id'),'','num asc');
  7. $where=" WHERE a.uniacid=:uniacid and store_id=:store_id ";
  8. $data[':uniacid']=$_W['uniacid'];
  9. $data[':store_id']=$storeid;
  10. if($_GPC['keywords']){
  11. $where.=" and (a.name LIKE concat('%', :name,'%') || c.store_name LIKE concat('%', :name,'%'))";
  12. $op=$_GPC['keywords'];
  13. $data[':name']="%$op%";
  14. }
  15. if($_GPC['type_id']){
  16. $where .=" and a.type_id=:type_id";
  17. $data[':type_id']=$_GPC['type_id'];
  18. }
  19. if($_GPC['is_shelves2']){
  20. $where .=" and a.is_shelves=:cid";
  21. $data[':cid']=$_GPC['is_shelves2'];
  22. }
  23. if($_GPC['state']){
  24. $where.=" and a.state={$_GPC['state']} ";
  25. }
  26. $pageindex = max(1, intval($_GPC['page']));
  27. $pagesize=10;
  28. $type=isset($_GPC['type'])?$_GPC['type']:'all';
  29. $sql="select a.* ,b.name as type_name,c.store_name from " . tablename("zhtc_groupgoods") . " a" . " left join " . tablename("zhtc_grouptype") . " b on b.id=a.type_id left join " . tablename("zhtc_store") . " c on c.id=a.store_id".$where." order by num asc";
  30. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  31. $list = pdo_fetchall($select_sql,$data);
  32. $total=pdo_fetchcolumn("select count(*) from " . tablename("zhtc_groupgoods") . " a" . " left join " . tablename("zhtc_grouptype") . " b on b.id=a.type_id left join " . tablename("zhtc_store") . " c on c.id=a.store_id".$where,$data);
  33. $pager = pagination($total, $pageindex, $pagesize);
  34. if($_GPC['id']){
  35. $data2['is_shelves']=$_GPC['is_shelves'];
  36. $res=pdo_update('zhtc_groupgoods',$data2,array('id'=>$_GPC['id']));
  37. if($res){
  38. message('设置成功',$this->createWebUrl2('sjgroupgoods',array('page'=>$_GPC['page'],'keywords'=>$_GPC['keywords'],'dishes_type'=>$_GPC['dishes_type'],'type_id'=>$_GPC['type_id'],'is_show2'=>$_GPC['is_show2'])),'success');
  39. }else{
  40. message('设置失败','','error');
  41. }
  42. }
  43. if($_GPC['op']=='delete'){
  44. $result = pdo_delete('zhtc_groupgoods', array('id'=>$_GPC['delid']));
  45. if($result){
  46. message('删除成功',$this->createWebUrl2('sjgroupgoods',array()),'success');
  47. }else{
  48. message('删除失败','','error');
  49. }
  50. }
  51. if($_GPC['op']=='play'){
  52. $data2['display']=$_GPC['display'];
  53. $res=pdo_update('zhtc_groupgoods',$data2,array('id'=>$_GPC['did']));
  54. if($res){
  55. message('设置成功',$this->createWebUrl2('sjgroupgoods',array('page'=>$_GPC['page'],'keywords'=>$_GPC['keywords'],'dishes_type'=>$_GPC['dishes_type'],'type_id'=>$_GPC['type_id'])),'success');
  56. }else{
  57. message('设置失败','','error');
  58. }
  59. }
  60. if($_GPC['op']=='tg'){
  61. $res=pdo_update('zhtc_groupgoods',array('state'=>2),array('id'=>$_GPC['cid']));
  62. if($res){
  63. message('通过成功!', $this->createWebUrl2('sjgroupgoods'), 'success');
  64. }else{
  65. message('通过失败!','','error');
  66. }
  67. }
  68. if($_GPC['op']=='jj'){
  69. $res=pdo_update('zhtc_groupgoods',array('state'=>3),array('id'=>$_GPC['cid']));
  70. if($res){
  71. message('拒绝成功!', $this->createWebUrl2('sjgroupgoods'), 'success');
  72. }else{
  73. message('拒绝失败!','','error');
  74. }
  75. }
  76. include $this->template('web/sjgroupgoods');