业务经理

微信扫描以上二维码

028-61286886

技术咨询

文件无法验证管理员身份

迅睿框架 更新 2020-08-31 21:26:06 咸鱼项目经


你好,我遇到一个问题,搞了一个下午,查不到原因所在。

这个问题是在线自动升级后造成的。

也就是说程序原本可以用,升级后不让用了。

admin.php?s=yitihua&c=home&m=edit&id=4这个连接是有效的,


admin.php?s=yitihua&c=category&m=index&appid=2这个链接报错了,要求登录后台,卡在登录后台页面。准确的说,这个连接下的文件无法验证管理员身份了。


home控制器和Category的写法是一样的啊。


先贴home的

<?php namespace Phpcmf\Controllers\Admin;

class Home extends \Phpcmf\Table
{

    public function __construct(...$params)
    {
        parent::__construct(...$params);
        \Phpcmf\Service::V()->assign([
            'menu' => \Phpcmf\Service::M('auth')->_admin_menu(
                [
                    '应用概览' => [APP_DIR.'/'.\Phpcmf\Service::L('Router')->class.'/index', 'fa fa-list'],
                    '新增应用' => [APP_DIR.'/'.\Phpcmf\Service::L('Router')->class.'/add', 'fa fa-clone'],
                    '更新缓存' => ['ajax:yitihua/home/cache_update', 'fa fa-refresh'],
                    'help' => [350],
                ]
            ),
        ]);

        // 支持附表存储
        $this->is_data = 0;

        $this->my_field = array(

        );
        // 初始化数据表
        $this->_init([
            'table' => 'yth_app',
            'field' => $this->my_field,
            'order_by' => 'id asc',
        ]);

        // 表单显示名称
        $this->name = dr_lang('应用概览');
        \Phpcmf\Service::V()->assign([
            'field' => $this->my_field,
        ]);
    }


 public function index() {
  list($tpl) = $this->_List();

  // print_r($this->_List());exit;
        // 输出模板 后台位于 ./Views/home_list.html
        \Phpcmf\Service::V()->display($tpl);
    }


    //修改
    public function edit() {
        list($tpl,$data) = $this->_Post(intval(\Phpcmf\Service::L('Input')->get('id')));

        $data['seo']=dr_string2array($data['seo']);
        $data['unified_user_groups']=dr_string2array($data['unified_user_groups']);
        $data['unified_data_source']=dr_string2array($data['unified_data_source']);
        $data['unified_template']=dr_string2array($data['unified_template']);

        \Phpcmf\Service::V()->assign('data',$data);
        \Phpcmf\Service::V()->display('yth_admin_edit_app.html');
    }

这是Category的

<?php namespace Phpcmf\Controllers\Admin;

class Category extends \Phpcmf\Table
{
    public $module; // 模块信息
    public $is_scategory; // 选择栏目类型
    protected $_is_extend_var = 0; // 继承属性变量

    // 上级公共类
    public function __construct(...$params) {
        parent::__construct(...$params);

        // 定义页首的按钮,
        \Phpcmf\Service::V()->assign([
            'menu' => \Phpcmf\Service::M('auth')->_admin_menu(
                [
                    '应用管理' => [APP_DIR.'/home/index', 'fa fa-list'],
                    '新增应用' => [APP_DIR.'/home/add', 'fa fa-clone'],
                    '更新缓存' => ['ajax:yitihua/home/cache_update', 'fa fa-refresh'],
                    'help' => [350],
                ]
            ),
        ]);

        $this->_Extend_Init();
    }


    // 继承类初始化
    protected function _Extend_Init() {

        // 初始化模块
        $dir = APP_DIR ? APP_DIR : 'share';

        // 支持附表存储
        $this->is_data = 0;

        // 模块显示名称
        $this->name = dr_lang('数据一体化[%s]', $dir);

  // print_r($this->is_scategory);exit;

        // 初始化数据表
        $this->_init([
            'table' => 'yth_category',
            'field' => '',
            'show_field' => 'name',
            'order_by' => 'displayorder ASC,id ASC',
        ]);

        //栏目涉及到所属应用id
        $appid = intval(\Phpcmf\Service::L('Input')->get('appid'));
        
        // 写入模板 快捷按钮
        \Phpcmf\Service::V()->assign([
            'appid' => $appid,
            'uriprefix' => APP_DIR."/category",
            'module' => $this->module,
            'index_url' => \Phpcmf\Service::L('Router')->url(APP_DIR.'/category/index',['appid' => $appid]),
            'add_url' => \Phpcmf\Service::L('Router')->url(APP_DIR.'/category/add',['appid' => $appid]),
            'edit_url' => \Phpcmf\Service::L('Router')->url(APP_DIR.'/category/edit',['appid' => $appid]),
            'backIndex_url' => \Phpcmf\Service::L('Router')->url(APP_DIR.'/category/index',['appid' => $appid]),
            'reply_url' => \Phpcmf\Service::L('Router')->url(APP_DIR.'/category/index',['appid' => $appid]),
            'copy_url' => \Phpcmf\Service::L('Router')->url(APP_DIR.'/category/copy',['appid' => $appid]),
            'all_add_url' => \Phpcmf\Service::L('Router')->url(APP_DIR.'/category/all_add',['appid' => $appid]),
        ]);
    }



 public function index() {

        $appid = intval(\Phpcmf\Service::L('Input')->get('appid'));

        $data = \Phpcmf\Service::M()->table($this->init['table'])->where('appid',$appid)->order_by('displayorder asc,id asc')->getAll();
        if(!empty($data)){
            \Phpcmf\Service::M('category')->init($this->init); // 初始化内容模型
            $category = \Phpcmf\Service::M('category')->repair($data);
            \Phpcmf\Service::V()->assign([
                'list' => $this->_get_tree_list($category)
            ]);
        }else{
            \Phpcmf\Service::V()->assign([
                'list' => ""
            ]);
        }
  
        \Phpcmf\Service::V()->assign([
                'list_url' =>\Phpcmf\Service::L('Router')->url(APP_DIR.'/category/index'),
                'list_name' => ' <i class="fa fa-reorder"></i>  '.dr_lang('栏目管理'),
                'move_select' => \Phpcmf\Service::L('Tree')->select_category(
                    $category,
                    0,
                    'name="catid"',
                    dr_lang('顶级栏目'),
                    0, 0
                ),
            ]);

  
        // 输出模板 后台位于 ./Views/category_list.html
        \Phpcmf\Service::V()->display("category_list.html");
    }


刚开始开发这个应用时,对于迅睿cms是个新手,一边摸索一边写的。

升级框架前,这样写是可以的。

现在无法使用了,我想知道您能不能看出是什么问题。

方案

  • 官方研发实习技术 #1 · 2020-08-31 18:52:12
    是什么错误呢,主要看你什么错误,好对症下药
  • 咸鱼项目经 #2 · 2020-08-31 18:57:16
    http://47.96.102.93/admin.php?c=login&m=index&go=http%253A%252F%252F47.96.102.93%252Fadmin.php%253Fs%253Dyitihua%2526c%253Dcategory%2526m%253Dindex%2526appid%253D2
    官方研发实习技术 这是我要访问的链接,会提示登录,然后登陆后还是这个页面。因为url里要访问的链接,验证成功后会前往这个链接,就是admin.php?s=yitihua&c=category&m=index&appid=2然后回又要验证,这个控制器category里没验证到管理员身份
  • 官方研发实习技术 #3 · 2020-08-31 19:07:31
    这种情况应该是你没有登录成功导致的,
    http://47.96.102.93/admin.php
    通过这个地址登录是否会登录成功呢?
  • 咸鱼项目经 #4 · 2020-08-31 19:10:24
    官方研发实习技术 我试过了,我确认我是登录成功的。
    QQ截图20200831191158
  • 官方研发实习技术 #5 · 2020-08-31 19:12:38
    http://47.96.102.93/admin.php?c=login&m=index&go=新地址
    那奇怪了,这种格式的地址,理论上登录成功会跳转到新的地址去
  • 咸鱼项目经 #6 · 2020-08-31 21:20:46
    查了一个晚上,一个莫名其妙的bug呵呵,怎么查都没有原因,偶然之间试验出来了URL参数中不能带有&app类的字母,比如我用了参数appid,结果就混乱了。哎,参数中不能有app,不然就报错。官方研发实习技术
  • 官方研发实习技术 #7 · 2020-08-31 21:24:05
    满意答案
    app是系统保留关键字,不要乱加的,c,m,s,app,这几个都是系统保留的参数
  • 咸鱼项目经 #8 · 2020-08-31 21:25:36
    这回知道了,前边的版本,这么写没报错,所以就没发现。这次升级了就不能用了,才去查原因。官方研发实习技术
  • 咸鱼项目经 #9 · 2020-08-31 21:26:06
    @官方研发实习技术:十分感谢您的专业回答。

迅睿系统漏洞

多语言翻译Seolang
多语言翻译Seolang(2026-09-21)
1. 新增译文数据备份恢复页面,支持断点续传 2. 多语言声明中心...
AI文章生成器
AI文章生成器(2026-09-20)
任务拆分独立配置 新增AI生成关键词 新增指令模板 新增品牌信...
GEO系统
GEO系统(2026-09-20)
后台 AEO 与运营端对齐:区域、跑批、CSV、补强、剧本均可在迅睿...
GeoSeo工具箱
GeoSeo工具箱(2026-09-18)
修正菜单规范
后台二次登陆验证
后台二次登陆验证(2026-09-18)
新增邮箱验证 新增短信验证
京东云短信
京东云短信(2026-09-17)
- 验证码有效期改只读展示 - 有效期旁新增系统设置按钮 - 保...
创蓝短信
创蓝短信(2026-09-17)
- 验证码有效期改只读展示 - 有效期旁新增系统设置按钮 - 保...
火山引擎短信
火山引擎短信(2026-09-17)
- 验证码有效期改只读展示 - 有效期旁新增系统设置按钮 - 保...
外贸多语言建站
外贸多语言建站(2026-09-17)
优化独立内容过滤机制