Beispiel #1
0
/**
 * [Weizan System] Copyright (c) 2014 wdlcms.com
 * Weizan isNOT a free software, it under the license terms, visited http://www.wdlcms.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
if (!empty($_W['uniacid'])) {
    $sql = 'SELECT * FROM ' . tablename('core_queue') . ' WHERE `uniacid`=:uniacid AND type = 2 ORDER BY `qid` ASC LIMIT 15';
    $pars = array();
    $pars[':uniacid'] = $_W['uniacid'];
    $cards = pdo_fetchall($sql, $pars);
    if (!empty($cards)) {
        load()->classs('coupon');
        foreach ($cards as $li) {
            if (!empty($li['acid']) && !empty($li['message'])) {
                $acc = new coupon($li['acid']);
                $code = $acc->DecryptCode(array('encrypt_code' => $li['message']));
                if (is_error($code)) {
                    continue;
                } else {
                    $sumecode = $acc->ConsumeCode(array('code' => $code['code']));
                    if (is_error($sumecode)) {
                        continue;
                    } else {
                        pdo_delete('core_queue', array('uniacid' => $_W['uniacid'], 'id' => $li['id']));
                        pdo_update('coupon_record', array('status' => 3), array('acid' => $li['acid'], 'code' => $code['code'], 'card_id' => $li['params']));
                    }
                }
            }
        }
    }
    $sql = 'SELECT * FROM ' . tablename('core_queue') . ' WHERE `uniacid`=:uniacid AND type = 1 ORDER BY `qid` ASC LIMIT 50';