예제 #1
0
파일: mc.mod.php 프로젝트: wisemyth/weizan
function _mc_login($member)
{
    global $_W;
    if (!empty($member) && !empty($member['uid'])) {
        $sql = 'SELECT `uid`,`realname`,`mobile`,`email`,`groupid`,`credit1`,`credit2`,`credit6` FROM ' . tablename('mc_members') . ' WHERE `uid`=:uid AND `uniacid`=:uniacid';
        $member = pdo_fetch($sql, array(':uid' => $member['uid'], ':uniacid' => $_W['uniacid']));
        if (!empty($member) && (!empty($member['mobile']) || !empty($member['email']))) {
            $_W['member'] = $member;
            $_SESSION['uid'] = $member['uid'];
            mc_group_update();
            if (empty($_W['openid'])) {
                $fan = mc_fansinfo($member['uid']);
                if (!empty($fan)) {
                    $_SESSION['openid'] = $fan['openid'];
                    $_W['openid'] = $fan['openid'];
                    $_W['fans'] = $fan;
                    $_W['fans']['from_user'] = $_W['openid'];
                } else {
                    $_W['openid'] = $member['uid'];
                    $_W['fans'] = array('from_user' => $member['uid'], 'follow' => 0);
                }
            }
            isetcookie('logout', '', -60000);
            return true;
        }
    }
    return false;
}
예제 #2
0
        }
        if ($card['grant']['coupon'] > 0) {
            if ($card['grant']['coupon'] > 0) {
                $coupon = pdo_fetch('SELECT couponid,title,type FROM ' . tablename('activity_coupon') . ' WHERE uniacid = :uniacid AND couponid = :couponid', array(':uniacid' => $_W['uniacid'], ':couponid' => $card['grant']['coupon']));
            }
            load()->model('activity');
            if ($coupon['type'] == 1) {
                $status = activity_coupon_grant($uid, $coupon['couponid'], 'card', '领取会员卡,赠送优惠券');
            } else {
                $status = activity_token_grant($uid, $coupon['couponid'], 'card', '领取会员卡,赠送优惠券');
            }
        }
        exit('success');
    }
}
if ($do == 'group') {
    $credit6 = floatval($_GPC['credit6']);
    $credit = $credit1 + $credit6;
    if ($credit < 0) {
        exit('积分和贡献相加不能小于0');
    }
    if ($credit6 != $user['credit6']) {
        mc_credit_update($uid, 'credit6', -$user['credit6'] + $credit6, array(0, "通过修改贡献值,来变更会员用户组", 'group', $clerk['id'], $clerk['store_id']));
    }
    $groupid = $user['groupid'];
    $_W['member'] = $user;
    $_W['openid'] = pdo_fetchcolumn('SELECT openid FROM ' . tablename('mc_mapping_fans') . ' WHERE acid = :acid AND uid = :uid', array(':acid' => $_W['acid'], ':uid' => $user['uid']));
    mc_group_update();
    exit('success');
}
template('mc/trade');