sjaddcoupon.inc.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. global $_GPC, $_W;
  3. $storeid=$_COOKIE["storeid"];
  4. $cur_store = $this->getStoreById($storeid);
  5. $GLOBALS['frames'] = $this->getNaveMenu2($storeid);
  6. $list = pdo_get('zhtc_coupons',array('id'=>$_GPC['id']));
  7. $type = pdo_getall('zhtc_coupontype',array('uniacid'=>$_W['uniacid']));
  8. $system=pdo_get('zhtc_system',array('uniacid'=>$_W['uniacid']),'is_yhqsh');
  9. if($list['img']){
  10. if(strpos($list['img'],',')){
  11. $img= explode(',',$list['img']);
  12. }else{
  13. $img=array(
  14. 0=>$list['img']
  15. );
  16. }
  17. }
  18. if(checksubmit('submit')){
  19. $data['name']=$_GPC['name'];
  20. $data['number']=$_GPC['number'];
  21. $data['surplus']=$_GPC['number'];
  22. $data['full']=$_GPC['full'];
  23. $data['reduce']=$_GPC['reduce'];
  24. $data['money']=$_GPC['money'];
  25. $data['end_time']=$_GPC['end_time'];
  26. $data['details']=$_GPC['details'];
  27. $data['store_id']=$storeid;
  28. $data['img']=implode(",",$_GPC['img']);
  29. $data['type_id']=$_GPC['type_id'];
  30. $data['time']=date("Y-m-d H:i:s");
  31. if($_GPC['id']==''){
  32. if($system['is_yhqsh']==1){
  33. $data['state']=1;
  34. }else{
  35. $data['state']=2;
  36. }
  37. $res=pdo_insert('zhtc_coupons',$data);
  38. }else{
  39. $res = pdo_update('zhtc_coupons', $data, array('id' => $_GPC['id']));
  40. }
  41. if($res){
  42. message('编辑成功',$this->createWebUrl2('sjcoupon',array()),'success');
  43. }else{
  44. message('编辑失败','','error');
  45. }
  46. }
  47. include $this->template('web/sjaddcoupon');