后台管理,有无限可能

不一定,非要是传统的分页,查询。
也可以很灵活。

/**
 * 二维码列表
 */
public function qr_index(){
        $base_url = 'http://xxx/wx.php/Article/women';
        // 获取活动配置
        $women_config = M('women_config');
        $women_config_list = $women_config->where(['status'=>1])->field('id as config_id,theme_name as config_name')->select();

        $default_config_name = $this->queryOneKey('women_theme_name');
        // 加上默认配置
        array_unshift($women_config_list,['config_id'=>'0','config_name'=>$default_config_name.'【默认配置】']);

        // 获取来源配置
        $women_source = M('women_source');
        $women_source_list = $women_source->where(['status'=>1])->field('id as source_id,name as source_name')->select();
        // 加上默认配置
        array_unshift($women_source_list,['source_id'=>'0','source_name'=>'退休俱乐部']);

        $out_data = [];
        foreach ($women_config_list as $ck=>$cv) {
            foreach ($women_source_list as $sk=>$sv) {
                $url = '';
                if ($cv['config_id']&&$sv['source_id']) {
                    $url = $base_url.'?config_id='.$cv['config_id'].'&source_id='.$sv['source_id'];
                }

                if ($cv['config_id']&&!$sv['source_id']) {
                    $url = $base_url.'?config_id='.$cv['config_id'];
                }

                if (!$cv['config_id']&&$sv['source_id']) {
                    $url = $base_url.'?source_id='.$sv['source_id'];
                }

                if (!$cv['config_id']&&!$sv['source_id']) {
                    $url = $base_url;
                }

                $out_data[] = [
                    'config_id'=>$cv['config_id'],
                    'config_name'=>$cv['config_name'],
                    'source_id'=>$sv['source_id'],
                    'source_name'=>$sv['source_name'],
                    'url' => $url
                ];
            }
        }

        $this->assign('result',$out_data);
        $this->display();
}
posted @ 2019-03-14 11:21  TBHacker  阅读(169)  评论(0编辑  收藏  举报