这个函数看不明,请楼主给注明一下,谢谢!- /**
- * 得到用户组,同步groupid和member['groupid'],当会员积分和当前积分不一致更新members表。
- * @para int $uid 会员的uid
- * @para array $group 会员所属的用户组
- * @para array $member
- *
- * @return string
- */
- function getgroupid($uid, $group, &$member) {
- global $creditsformula, $db, $tablepre;
- if(!empty($creditsformula)) {
- $updatearray = array();
- eval("\$credits = round($creditsformula);");
- if($credits != $member['credits']) {
- $updatearray[] = "credits='$credits'";
- }
- if($group['type'] == 'member' && !($member['credits'] >= $group['creditshigher'] && $member['credits'] < $group['creditslower'])) {
- $query = $db->query("SELECT groupid FROM {$tablepre}usergroups WHERE type='member' AND $member[credits]>=creditshigher AND $member[credits]<creditslower LIMIT 1");
- if($db->num_rows($query)) {
- $member['groupid'] = $db->result($query, 0);
- $updatearray[] = "groupid='$member[groupid]'";
- }
- }
- if($updatearray) {
- $db->query("UPDATE {$tablepre}members SET ".implode(', ', $updatearray)." WHERE uid='$uid'");
- }
- }
- return $member['groupid'];
- }
复制代码 |