请问有没有插件开发手册,我想自己开发插件了

问题咨询 · tgy3300 · 于 11天前 发布 · 54 次阅读

如题

共收到 2 条回复
Fecmall#111天前 0 个赞

1.目前没有详细的开发fecmall应用市场插件的文档,但也有一些

http://www.fecmall.com/doc/fecshop-guide/addons/cn-2.0/guide-fecmall-addons-developer-add.html

fecmall后台油一个gii初始化生成器,可以生成初始化文件

2.应用市场有几个免费的扩展,您可以安装看一下文件结构

3.插件和本地二开的配置语法是一致的,原理就是通过配置覆盖的方式实现重写

贴一个配置你参考一下

<?php
/**
 * Fecmall Addons Config File
 */

// set namespace alisa
Yii::setAlias('@fecbdc', dirname(dirname(dirname(__DIR__))).'/addons/fecmall/fecbdc/');

return [
    // 插件信息
    'info'  => [
        'name' => 'fecbdc',
        'author' => 'Fecmall',
    ],
    // 插件管理部分
    'administer' => [
        'install' => [
            'class' => 'fecbdc\administer\Install',
            // 其他引入的属性,类似yii2组件的方式写入即可
            'test' => 'test_data',
        ],
        'upgrade' => [
            'class' => 'fecbdc\administer\Upgrade',
        ],
        'uninstall' => [
            'class' => 'fecbdc\administer\Uninstall',
        ],
    ], 
    // 各个入口的配置
    'app' => [
        // 公共层部分配置
        'common' => [
            'enable' => true,
            // 公用层的具体配置下载下面
            'config' => [
                'services' => [
                    'customer' => [
                        'class' => 'fecbdc\services\Customer',
                    ],
                    'distribute' => [
                        'class' => 'fecbdc\services\Distribute',
                        'childService' => [
                            'apply' => [
                                'class' => 'fecbdc\services\distribute\Apply',
                            ],
                            'level' => [
                                'class' => 'fecbdc\services\distribute\Level',
                            ],
                            'price' => [
                                'class' => 'fecbdc\services\distribute\Price',
                            ],
                            'order' => [
                                'class' => 'fecbdc\services\distribute\Order',
                            ],
                        ]
                    ]
                ],
            ]
        ],
        // 1.appfront层
        'appfront' => [
            // appfront入口的开关,如果false,则会失效
            'enable' => true,
            'config' => [
                // yii class rewrite map
                'yiiClassMap' => [
                    // 'fecshop\app\appfront\helper\test\My' => '@appfront/helper/My.php',
                ],
                // 重写model和block
                'fecRewriteMap' => [
                    // '\fecshop\app\appfront\modules\Cms\block\home\Index'  => '\fectfurnilife\app\appfront\modules\Cms\block\home\Index',
                    // '\fecshop\app\appfront\modules\Customer\block\address\Edit'  => '\fectfurnilife\app\appfront\modules\Customer\block\address\Edit',
                ],
                'modules' => [
                    'distribute' => [
                        'class' => '\fecbdc\app\appfront\modules\Distribute\Module',
                        //'controllerMap' => [
                        //    'account' => 'fecbdc\app\appfront\modules\Distribute\controllers\AccountController',          
                        //],
                    ],
                ],
                 'components' => [
                    // yii2 语言组件配置,关于Yii2国际化,可以参看:http://www.yiichina.com/doc/guide/2.0/tutorial-i18n
                    'i18n' => [
                        'translations' => [
                            'appfront' => [
                                'basePaths' => [
                                    '@fecbdc/app/appfront/languages',
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ],
        // html5入口
        'apphtml5' =>[],
        // appserver入口(vue 微信小程序等api)
        'appserver' =>[],
        // appapi入口,和第三方交互的api
        'appapi' =>[],
        // 后台部分
        'appadmin' =>[
            'enable' => true,
            // 公用层的具体配置下载下面
            'config' => [
                'components' => [
                    // yii2 语言组件配置,关于Yii2国际化,可以参看:http://www.yiichina.com/doc/guide/2.0/tutorial-i18n
                    'i18n' => [
                        'translations' => [
                            'appadmin' => [
                                'basePaths' => [
                                    '@fecbdc/app/appadmin/languages',
                                ],
                            ],
                        ],
                    ],
                ],
                // 重写model和block
                'fecRewriteMap' => [
                    '\fecbbc\app\appadmin\modules\Catalog\block\productinfo\Managerbatchedit'  => '\fecbdc\app\appadmin\modules\Catalog\block\productinfo\Managerbatchedit',
                    '\fecbbc\models\mongodb\Product'  => '\fecbdc\models\mongodb\Product',
                ],
                
                'modules' => [
                    'distribute' => [
                        'class' => '\fecbdc\app\appadmin\modules\Distribute\Module',
                    ],
                ],
                'services' => [
                    'page' => [
                        'childService' => [
                            'theme' => [
                                'thirdThemeDir' => [
                                    '@fecbdc/app/appadmin/theme/fecbdc',  // 后台模板路径
                                ],
                            ],
                        ],
                    ],
                    'admin' => [
                        'childService' => [
                            'urlKey' => [
                                'urlKeyTags' => [
                                    'distribute-apply' => 'Distribute-Apply',
                                    'distribute-level' => 'Distribute-Level',
                                    'distribute-account' => 'Distribute-Account',
                                    'distribute-platform' => 'Distribute-Platform',
                                ],
                            ],
                            'menu' => [
                                'menuConfig' => [
                                    'Distribute' => [
                                        'label' => 'Manager Distribute',
                                        'child' => [
                                            'apply' => [
                                                'label' => 'Manager Distribute Apply',
                                                'url_key' => '/distribute/apply/manager',
                                            ],
                                            'level' => [
                                                'label' => 'Manager Distribute Level',
                                                'url_key' => '/distribute/level/manager',
                                            ],
                                            'account' => [
                                                'label' => 'Manager Distribute Account',
                                                'url_key' => '/distribute/account/manager',
                                            ],
                                            'platform' => [
                                                'label' => 'Platform Manager',
                                                'url_key' => '/distribute/platform/manager',
                                            ],
                                        ],
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
            ]
        ],
        // console,命令行脚本端
        'console' =>[],
    ],
    
    
];




OneSmile#211天前 0 个赞

配置重写这块太麻烦了,如果不是深入研究,非常熟练的话,这块得绕好久。有一定门槛。直接开发吧,又不能插件化放到应用市场。。

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