inaddcoupon.inc.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. global $_GPC, $_W;
  3. $GLOBALS['frames'] = $this->getMainMenu2();
  4. $seller_id=$_COOKIE["storeid"];
  5. $cur_store = $this->getStoreById($seller_id);
  6. $list = pdo_get('zh_jdgjb_coupons',array('id'=>$_GPC['id']));
  7. if(checksubmit('submit')){
  8. $data['name']=$_GPC['name'];
  9. $data['number']=$_GPC['number'];
  10. $data['cost']=$_GPC['cost'];
  11. $data['seller_id']=$seller_id;
  12. $data['introduce']=$_GPC['introduce'];
  13. $data['start_time']=$_GPC['time']['start'];
  14. $data['conditions']=$_GPC['conditions'];
  15. $data['end_time']=$_GPC['time']['end'];
  16. $data['uniacid']=$_W['uniacid'];
  17. if($_GPC['id']==''){
  18. $data['type']=2;
  19. $data['time']=time();
  20. $res=pdo_insert('zh_jdgjb_coupons',$data);
  21. if($res){
  22. message('添加成功',$this->createWebUrl('incoupon',array()),'success');
  23. }else{
  24. message('添加失败','','error');
  25. }
  26. }else{
  27. $res = pdo_update('zh_jdgjb_coupons', $data, array('id' => $_GPC['id']));
  28. if($res){
  29. message('编辑成功',$this->createWebUrl('incoupon',array()),'success');
  30. }else{
  31. message('编辑失败','','error');
  32. }
  33. }
  34. }
  35. include $this->template('web/inaddcoupon');