sjaddqggoodall.inc.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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_qggoods',array('uniacid' => $_W['uniacid'],'id'=>$_GPC['id']),array(),'',array('id DESC'));
  7. $sys=pdo_get('zhtc_system',array('uniacid'=>$_W['uniacid']),'xgsh');
  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['details_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_qgtype',array('uniacid' => $_W['uniacid']));
  28. if(checksubmit('submit')){
  29. $data['name']=$_GPC['name'];
  30. if($info['logo']!=$_GPC['logo']){
  31. $data['logo']=$_GPC['logo'];
  32. } else{
  33. $data['logo']=$_GPC['logo'];
  34. }
  35. if($_GPC['img']){
  36. $data['img']=implode(",",$_GPC['img']);
  37. } else{
  38. $data['img']='';
  39. }
  40. if($_GPC['details_img']){
  41. $data['details_img']=implode(",",$_GPC['details_img']);
  42. } else{
  43. $data['details_img']='';
  44. }
  45. $data['money']=$_GPC['money'];
  46. $data['price']=$_GPC['price'];
  47. $data['type_id']=$_GPC['type_id'];
  48. $data['num']=$_GPC['num'];
  49. $data['number']=$_GPC['number'];
  50. $data['start_time']=$_GPC['start_time'];
  51. $data['end_time']=$_GPC['end_time'];
  52. $data['content']=$_GPC['content'];
  53. $data['consumption_time']=$_GPC['consumption_time'];
  54. $data['details']=html_entity_decode($_GPC['details']);
  55. $data['uniacid']=$_W['uniacid'];
  56. $data['store_id']=$storeid;
  57. $data['cityname']=$store['cityname'];
  58. if($_GPC['id']==''){
  59. $data['surplus']=$_GPC['number'];
  60. if($sys['xgsh']==1){
  61. $data['is_tg']=1;
  62. }
  63. if($sys['xgsh']==2){
  64. $data['is_tg']=2;
  65. }
  66. $res=pdo_insert('zhtc_qggoods',$data);
  67. if($res){
  68. message('添加成功',$this->createWebUrl2('sjqggoodall',array()),'success');
  69. } else{
  70. message('添加失败','','error');
  71. }
  72. } else{
  73. $res = pdo_update('zhtc_qggoods', $data, array('id' => $_GPC['id']));
  74. if($res){
  75. message('编辑成功',$this->createWebUrl2('sjqggoodall',array()),'success');
  76. } else{
  77. message('编辑失败','','error');
  78. }
  79. }
  80. }
  81. include $this->template('web/sjaddqggoodall');