Beispiel #1
0
        message('添加会员成功,将进入编辑页面', url('mc/member/post', array('uid' => $uid)), 'success');
    }
}
if ($do == 'group') {
    if ($_W['isajax']) {
        $id = intval($_GPC['id']);
        $group = $_W['account']['groups'][$id];
        if (empty($group)) {
            exit('会员组信息不存在');
        }
        $uid = intval($_GPC['uid']);
        $member = mc_fetch($uid);
        if (empty($member)) {
            exit('会员信息不存在');
        }
        $credit = intval($group['credit']);
        $credit6 = $credit - $member['credit1'];
        $status = pdo_update('mc_members', array('credit6' => $credit6, 'groupid' => $id), array('uid' => $uid, 'uniacid' => $_W['uniacid']));
        if ($status !== false) {
            $openid = pdo_fetchcolumn('SELECT openid FROM ' . tablename('mc_mapping_fans') . ' WHERE acid = :acid AND uid = :uid', array(':acid' => $_W['acid'], ':uid' => $uid));
            if (!empty($openid)) {
                mc_notice_group($openid, $_W['account']['groups'][$member['groupid']]['title'], $_W['account']['groups'][$id]['title']);
            }
            exit('success');
        } else {
            exit('更新会员信息出错');
        }
    }
    exit('error');
}
template('mc/member');
Beispiel #2
0
function mc_group_update($uid = 0)
{
    global $_W;
    $uid = intval($uid);
    if ($uid <= 0) {
        $uid = $_W['member']['uid'];
        $user = $_W['member'];
        $user['openid'] = $_W['openid'];
    } else {
        $user = pdo_fetch('SELECT uid, realname, credit1, credit6, groupid FROM ' . tablename('mc_members') . ' WHERE uniacid = :uniacid AND uid = :uid', array(':uniacid' => $_W['uniacid'], ':uid' => $uid));
        $user['openid'] = pdo_fetchcolumn('SELECT openid FROM ' . tablename('mc_mapping_fans') . ' WHERE acid = :acid AND uid = :uid', array(':acid' => $_W['acid'], ':uid' => $uid));
    }
    if (empty($user)) {
        return false;
    }
    $groupid = $user['groupid'];
    $credit = $user['credit1'] + $user['credit6'];
    $groups = $_W['uniaccount']['groups'];
    if (empty($groups)) {
        return false;
    }
    $data = array();
    foreach ($groups as $group) {
        $data[$group['groupid']] = $group['credit'];
    }
    asort($data);
    if ($_W['uniaccount']['grouplevel'] == 1) {
        foreach ($data as $k => $da) {
            if ($credit >= $da) {
                $groupid = $k;
            }
        }
    } else {
        $now_group_credit = $data[$user['groupid']];
        if ($now_group_credit < $credit) {
            foreach ($data as $k => $da) {
                if ($credit >= $da) {
                    $groupid = $k;
                }
            }
        }
    }
    if ($groupid > 0 && $groupid != $user['groupid']) {
        pdo_update('mc_members', array('groupid' => $groupid), array('uniacid' => $_W['uniacid'], 'uid' => $uid));
        mc_notice_group($user['openid'], $_W['uniaccount']['groups'][$user['groupid']]['title'], $_W['uniaccount']['groups'][$groupid]['title']);
    }
    $user['groupid'] = $groupid;
    $_W['member']['groupid'] = $groupid;
    $_W['member']['groupname'] = $_W['uniaccount']['groups'][$groupid]['title'];
    return $user['groupid'];
}
Beispiel #3
0
function mc_group_update()
{
    global $_W;
    if (empty($_W['member']['uid'])) {
        return false;
    }
    $credit = intval($_W['member']['credit1']);
    if (!$credit) {
        $credit = pdo_fetchcolumn('SELECT credit1 FROM ' . tablename('mc_members') . ' WHERE uniacid = :uniacid AND uid = :uid', array(':uniacid' => $_W['uniacid'], ':uid' => $_W['member']['uid']));
    }
    $groups = $_W['uniaccount']['groups'];
    if (empty($groups)) {
        return false;
    }
    $data = array();
    foreach ($groups as $group) {
        $data[$group['groupid']] = $group['credit'];
    }
    asort($data);
    if ($_W['uniaccount']['grouplevel'] == 1) {
        foreach ($data as $k => $da) {
            if ($credit >= $da) {
                $groupid = $k;
            }
        }
    } else {
        $now_group_credit = $data[$_W['member']['groupid']];
        if ($now_group_credit < $credit) {
            foreach ($data as $k => $da) {
                if ($credit >= $da) {
                    $groupid = $k;
                }
            }
        }
    }
    if ($groupid > 0 && $groupid != $_W['member']['groupid']) {
        pdo_update('mc_members', array('groupid' => $groupid), array('uniacid' => $_W['uniacid'], 'uid' => $_W['member']['uid']));
        mc_notice_group($_W['fans']['from_user'], $_W['member']['uid'], $_W['uniaccount']['groups'][$_W['member']['groupid']]['title'], $_W['uniaccount']['groups'][$groupid]['title']);
    }
    $_W['member']['groupid'] = $groupid;
    $_W['member']['groupname'] = $_W['uniaccount']['groups'][$groupid]['title'];
    return true;
}