业务经理

微信扫描以上二维码

028-61286886

技术咨询

怎么把这个回调函数改成显示“用户组-用户等级”模式

迅睿框架 更新 2025-09-19 16:08:23 木木木木

请教怎么把这个回调函数改成显示“用户组-用户等级”模式


// 显示用户等级
if (!function_exists('my_member_group_level')) {
    function my_member_group_level($value, $param = [], $data = [], $field = []) {
        $user = dr_member_info($data['id']);
            if ($user && $user['group']) {
                $i = 0;
                $rt = '';
                $color = ['blue', 'red', 'green', 'dark', 'yellow'];
                foreach ($user['group'] as $t) {
                    $cs = isset($color[$i]) && $color[$i] ? $color[$i] : 'default';
                    $rt.= '<label class="btn btn-xs '.$cs.'">'.$t['group_name'].'</label>';
                    $i++;
                }
                return $rt;
            }
        
            return dr_lang('无');

    }
}




方案

  • 迅睿官方技术专家 #1 · 2025-09-19 15:43:08
    // 显示用户等级
    if (!function_exists('my_member_group_level')) {
        function my_member_group_level($value, $param = [], $data = [], $field = []) {
            $user = dr_member_info($data['id']);
                if ($user && $user['group']) {
                    $i = 0;
                    $rt = '';
                    $color = ['blue', 'red', 'green', 'dark', 'yellow'];
                    foreach ($user['group'] as $t) {
                        $cs = isset($color[$i]) && $color[$i] ? $color[$i] : 'default';
                        $rt.= '<label class="btn btn-xs '.$cs.'">'.$t['group_name'].'-'.$t['level_name'].'</label>';
                        $i++;
                    }
                    return $rt;
                }
            
                return dr_lang('无');
    
        }
    }
  • 木木木木 #2 · 2025-09-19 15:56:44
    上面的代码结果只出现了"用户组-",用户等级没出来啊。是差什么东西么?迅睿官方技术专家
  • 迅睿官方技术专家 #3 · 2025-09-19 16:07:07
    满意答案
    group_level
  • 木木木木 #4 · 2025-09-19 16:08:23
    @迅睿官方技术专家:完美解决,!

迅睿系统漏洞

问卷调查
问卷调查(2026-09-06)
问卷调查插件:多题型、条件显示、答卷统计,适合调研与反馈收集。
GEO系统
GEO系统(2026-09-05)
修复发布文章缺少最后一图问题
Querylist渐进式采集
Querylist渐进式采集(2026-09-05)
新增元素循环 新增字符串匹配栏目 优化采集流程
GeoSeo收录宝
GeoSeo收录宝(2026-09-04)
修复在 官网在线升级非重新安装 ai发布-指令模版错误
多语言翻译Seolang
多语言翻译Seolang(2026-09-04)
URL 为空时自动用栏目目录反推带目录完整路径写入缓存 把&quo...
GeoSeo工具箱
GeoSeo工具箱(2026-09-04)
新增栏目SEO/文章SEO TDK优化 新增Crawl-delay...
IDC云产品管理
IDC云产品管理(2026-09-04)
产品管理 续费管理 插件设置 使用说明