sjaddgroupgoods.inc.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. global $_GPC, $_W;
  3. $storeid=$_COOKIE["storeid"];
  4. $cur_store = $this->getStoreById($storeid);
  5. $GLOBALS['frames'] = $this->getNaveMenu2($storeid);
  6. $info=pdo_get('zhtc_groupgoods',array('id'=>$_GPC['id']));
  7. $sys=pdo_get('zhtc_system',array('uniacid'=>$_W['uniacid']),'ggoods_set');
  8. $store=pdo_get('zhtc_store',array('id'=>$storeid,'uniacid'=>$_W['uniacid']),'cityname');
  9. if($info['img']){
  10. if(strpos($info['img'],',')){
  11. $img= explode(',',$info['img']);
  12. }else{
  13. $img=array(
  14. 0=>$info['img']
  15. );
  16. }
  17. }
  18. if($info['details_img']){
  19. if(strpos($info['img'],',')){
  20. $details_img= explode(',',$info['details_img']);
  21. } else{
  22. $details_img=array(
  23. 0=>$info['details_img']
  24. );
  25. }
  26. }
  27. $type=pdo_getall('zhtc_grouptype',array('uniacid'=>$_W['uniacid']),array(),'','num asc');
  28. if(!$type){
  29. message('请先添加分类','error');
  30. }
  31. if(checksubmit('submit')){
  32. if($_GPC['img']){
  33. $data['img']=implode(",",$_GPC['img']);
  34. }else{
  35. $data['img']='';
  36. }
  37. if($_GPC['details_img']){
  38. $data['details_img']=implode(",",$_GPC['details_img']);
  39. } else{
  40. $data['details_img']='';
  41. }
  42. $data['name']=$_GPC['name'];
  43. $data['type_id']=$_GPC['type_id'];
  44. $data['logo']=$_GPC['logo'];
  45. $data['inventory']=$_GPC['inventory'];
  46. $data['start_time']=strtotime($_GPC['start_time']);
  47. $data['end_time']=strtotime($_GPC['end_time']);
  48. $data['xf_time']=strtotime($_GPC['xf_time']);
  49. $data['pt_price']=$_GPC['pt_price'];
  50. $data['y_price']=$_GPC['y_price'];
  51. $data['dd_price']=$_GPC['dd_price'];
  52. $data['ycd_num']=$_GPC['ycd_num'];
  53. $data['ysc_num']=$_GPC['ysc_num'];
  54. $data['people']=$_GPC['people'];
  55. $data['is_shelves']=$_GPC['is_shelves'];
  56. $data['details']=html_entity_decode($_GPC['details']);
  57. $data['num']=$_GPC['num'];
  58. $data['introduction']=$_GPC['introduction'];
  59. $data['store_id']=$storeid;
  60. $data['cityname']=$store['cityname'];
  61. $data['uniacid']=$_W['uniacid'];
  62. if($_GPC['id']==''){
  63. if($sys['ggoods_set']==1){
  64. $data['state']=1;
  65. }
  66. if($sys['ggoods_set']==2){
  67. $data['state']=2;
  68. }
  69. $res=pdo_insert('zhtc_groupgoods',$data);
  70. if($res){
  71. message('添加成功',$this->createWebUrl2('sjgroupgoods',array()),'success');
  72. }else{
  73. message('添加失败','','error');
  74. }
  75. }else{
  76. $res = pdo_update('zhtc_groupgoods', $data, array('id' => $_GPC['id']));
  77. if($res){
  78. message('编辑成功',$this->createWebUrl2('sjgroupgoods',array()),'success');
  79. }else{
  80. message('编辑失败','','error');
  81. }
  82. }
  83. }
  84. include $this->template('web/sjaddgroupgoods');