clh021 /

基于ionic1的Yii2 wechat,适用于其他应用

安装次数: 7

依赖关系: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 1

公开问题: 0

语言:JavaScript

类型:yii2-extension

0.0.1 2016-03-16 08:16 UTC

This package is auto-updated.

Last update: 2024-08-27 12:18:39 UTC


README

安装

安装此扩展的首选方式是通过composer

运行以下命令:

php composer.phar require --prefer-dist clh021/yii2-wechat_ionic1 "*"

或在您的composer.json文件的require部分添加:

"clh021/yii2-wechat_ionic1": "*"

使用方法

扩展安装后,只需在您的代码中使用即可

迁移

运行迁移

php yii migrate --migrationPath=@clh021/wechat_ionic1/migrations

在/common/config/main.php中配置URL重写

    'timeZone' => 'Asia/Shanghai', //time zone affect the formatter datetime format
    'components' => [
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
                '<controller:\w+>/<id:\d+>' => '<controller>/view',
                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
            ],
        ],
        'formatter' => [ //for the showing of date datetime
            'dateFormat' => 'yyyy-MM-dd',
            'datetimeFormat' => 'yyyy-MM-dd HH:mm:ss',
            'decimalSeparator' => ',',
            'thousandSeparator' => ' ',
            'currencyCode' => 'CNY',
        ],
    ],

在backend/config/main.php中配置后端模块

    'modules' => [
        'cms' => [
            'class' => 'clh021\wechat_ionic1\Module',
            'controllerNamespace' => 'clh021\wechat_ionic1\controllers\backend'
        ],
    ],

在前端/config/main.php中配置前端模块

    'defaultRoute' => 'wechat', //set wechat as default route
    'modules' => [
        'wechat' => [
            'class' => 'clh021\wechat_ionic1\Module',
            'controllerNamespace' => 'clh021\wechat_ionic1\controllers\frontend'
        ],
    ],

在/frontend/config/params.php中添加yii2-cms参数

return [
    'cmsTitle' => 'HikeCms',
    'cmsTitleSeo' => 'Simple Cms based on Yii2',
    'cmsFooter' => 'Copyright &copy; ' . date('Y') . ' by clh021 chen on Yii2. All Rights Reserved.',
    'cmsPostPageCount' => '2',
    'cmsLinks' => [
        'Google' => 'http://www.google.com',
        '' => 'http://github.com/clh021/yii2-wechat_ionic1',
    ],
];

访问URL

  1. 后端:http://you-domain/backend/web/wechat
  2. 前端:http://you-domain/fontend/web/wechat