Example #1
0
<?php

/**
 * [WEIZAN System] Copyright (c) 2015 012WZ.COM
 * WeiZan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
$dos = array('use');
$do = in_array($do, $dos) ? $do : 'use';
if ($do == 'use') {
    load()->model('card');
    $card_setting = card_setting();
    if (is_error($card_setting)) {
        message($card_setting['message'], referer(), 'error');
    }
    $card_member = card_member($uid);
    if (is_error($card_member)) {
        message($card_member['message'], referer(), 'error');
    }
    $stores = pdo_fetchall('SELECT id,business_name FROM ' . tablename('activity_stores') . ' WHERE uniacid = :uniacid', array(':uniacid' => $_W['uniacid']), 'id');
    if (checksubmit()) {
        $credit = floatval($_GPC['credit']);
        $discount_credit = $credit;
        $store_id = intval($_GPC['store_id']);
        $store_str = !$store_id || empty($stores[$store_id]) ? '未知' : $stores[$store_id]['business_name'];
        if (!$credit) {
            message('请输入消费金额', referer(), 'error');
        }
        if ($card_setting['discount_type'] > 0 && !empty($card_setting['discount'])) {
            $discount = $card_setting['discount'][$member['groupid']];
            if (!empty($discount['condition']) && !empty($discount['discount']) && $credit >= $discount['condition']) {
Example #2
0
        if ($type == 'credit1') {
            mc_notice_credit1($openid, $uid, $num, '管理员后台操作积分');
        }
        if ($type == 'credit2') {
            if ($num > 0) {
                mc_notice_recharge($openid, $uid, $num, '', "管理员后台操作余额,增加{$value}余额");
            } else {
                mc_notice_credit2($openid, $uid, $num, 0, '', '', "管理员后台操作余额,减少{$value}余额");
            }
        }
    }
    exit('success');
}
if ($do == 'card') {
    load()->model('card');
    $card = card_setting();
    if (empty($card)) {
        exit('公众号未设置会员卡');
    }
    $member = pdo_get('mc_card_members', array('uniacid' => $_W['uniacid'], 'uid' => $user['uid']));
    if (!empty($member)) {
        exit('该会员已领取会员卡');
    }
    $cardsn = $card['format'];
    preg_match_all('/(\\*+)/', $card['format'], $matchs);
    if (!empty($matchs)) {
        foreach ($matchs[1] as $row) {
            $cardsn = str_replace($row, random(strlen($row), 1), $cardsn);
        }
    }
    preg_match('/(\\#+)/', $card['format'], $matchs);