cardconsume.inc.php 761 B

12345678910111213141516171819202122232425
  1. <?php
  2. defined('IN_IA') or exit('Access Denied');
  3. global $_W, $_GPC;
  4. load()->model('activity');
  5. $op = trim($_GPC['op']) ? trim($_GPC['op']) : 'consume';
  6. $user_permission = permission_account_user('system');
  7. if($op == 'consume') {
  8. $type = intval($_GPC['type']);
  9. $qrcode = trim($_GPC['code']);
  10. if($_W['isajax']) {
  11. $code = trim($_GPC['code']);
  12. $record = pdo_get('coupon_record', array('code' => $code));
  13. if(empty($record)) {
  14. message(error(-1, '卡券记录不存在'), '', 'ajax');
  15. }
  16. $status = activity_coupon_use($record['couponid'], $record['id'], 'paycenter');
  17. if (!is_error($status)) {
  18. message(error('0', ''), '', 'ajax');
  19. } else {
  20. message(error('-1', $status['message']),'' , 'ajax');
  21. }
  22. }
  23. }
  24. include $this->template('cardconsume');