商城后台二次开发问题

技术问题 · Andrew · 于 6年前 发布 · 1977 次阅读

首先先贴报错信息 An Error occurred while handling another error: exception 'ReflectionException' with message 'Method common\local\local_services\Discount::getStorageService() does not exist' in /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php:195

从报错结果看是找不到getStorageService这个方法,我是参考 http://www.fecshop.com/doc/fecshop-guide/develop/cn-1.0/guide-fecshop-appadmin-developer.html 这个链接上边的实例开发的,全局搜了下确实没有这个方法,想请教下该方法在哪里编写?以及如何编写?

共收到 5 条回复
Andrew#16年前 0 个赞

common\local\local_services\Discount.php文件报错, public function init()

{
    parent::init();
    $currentService = $this->getStorageService($this);
    $this->_discount = new $currentService();
}
这段报的错,给到的实例里边也没有找到这个方法
Andrew#26年前 1 个赞

问题解决了,这个其实就是获取DiscountMongodb,实例化一下就好

Fecmall#36年前 0 个赞

@Andrew [#2楼](#comment2) OK!

给予的文档中,是有这个方法的,文档地址:http://www.fecshop.com/doc/fecshop-guide/develop/cn-1.0/guide-fecshop-appadmin-developer.html 可以看到代码:

public function init()
    {
        parent::init();
        $currentService = $this->getStorageService($this);
        $this->_person = new $currentService();
    }

对于方法getStorageService() 是在继承的父类里面:https://github.com/fecshop/yii2_fecshop/blob/master/services/Service.php

Andrew#46年前 1 个赞

@Fecshop #3楼 好的,我这个是老版本的,Service.php里没有这个方法,升级一下应该就好了,谢啦!

Fecmall#56年前 0 个赞

@Andrew #4楼 嗯,Fecshop现在开发完成了,除了修复bug,不会做太多改动了

后面的新功能会以扩展插件的方式开发,

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics