sjgoods.inc.php 2.0 KB

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