本文整理匯總了PHP中coupon::ConsumeCode方法的典型用法代碼示例。如果您正苦於以下問題:PHP coupon::ConsumeCode方法的具體用法?PHP coupon::ConsumeCode怎麽用?PHP coupon::ConsumeCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類coupon
的用法示例。
在下文中一共展示了coupon::ConsumeCode方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: message
message('更改卡券領取狀態成功', referer(), 'success');
}
if ($op == 'consume') {
$id = intval($_GPC['id']);
$record = pdo_fetch('SELECT code,status FROM ' . tablename('coupon_record') . ' WHERE acid = :acid AND id = :id', array(':acid' => $acid, ':id' => $id));
if (empty($record)) {
message('對應code碼不存在', referer(), 'error');
}
$pwd = trim($_GPC['pdw']);
if (empty($pwd)) {
message('請輸入店員密碼', referer(), 'error');
}
$sql = 'SELECT * FROM ' . tablename('activity_coupon_password') . " WHERE `uniacid` = :uniacid AND `password` = :password";
$clerk = pdo_fetch($sql, array(':uniacid' => $_W['uniacid'], ':password' => $pwd));
if (empty($clerk)) {
message('店員密碼錯誤', referer(), 'error');
}
if ($record['status'] == 1) {
load()->classs('coupon');
$acc = new coupon($acid);
$status = $acc->ConsumeCode(array('code' => $record['code']));
if (is_error($status)) {
message($status['message'], '', 'error');
} else {
pdo_update('coupon_record', array('status' => 3, 'clerk_name' => $clerk['name'], 'usetime' => TIMESTAMP), array('acid' => $acid, 'code' => $record['code'], 'id' => $id));
}
}
message('核銷卡券成功', referer(), 'success');
}
template('wechat/consume');
}
示例2: exit
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';
$pars = array();
$pars[':uniacid'] = $_W['uniacid'];
$messages = pdo_fetchall($sql, $pars);
if (!empty($messages)) {