Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
刘俊涛 committed Nov 25, 2015
0 parents commit fc03768
Show file tree
Hide file tree
Showing 267 changed files with 15,592 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory" : "vendor/bower"
}
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# yii console command
/yii

# phpstorm project files
.idea

# netbeans project files
nbproject

# zend studio for eclipse project files
.buildpath
.project
.settings

# windows thumbnail cache
Thumbs.db

# composer vendor dir
/vendor

# composer itself is not needed
composer.phar

# Mac DS_Store Files
.DS_Store

# phpunit itself is not needed
phpunit.phar
# local phpunit config
/phpunit.xml
32 changes: 32 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
The Yii framework is free software. It is released under the terms of
the following BSD License.

Copyright © 2008 by Yii Software LLC (http:https://www.yiisoft.com)
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Yii Software LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Yii 2 Advanced Project Template
===============================

Yii 2 Advanced Project Template is a skeleton [Yii 2](http:https://www.yiiframework.com/) application best for
developing complex Web applications with multiple tiers.

The template includes three tiers: front end, back end, and console, each of which
is a separate Yii application.

The template is designed to work in a team development environment. It supports
deploying the application in different environments.

Documentation is at [docs/guide/README.md](docs/guide/README.md).

[![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-app-advanced/v/stable.png)](https://packagist.org/packages/yiisoft/yii2-app-advanced)
[![Total Downloads](https://poser.pugx.org/yiisoft/yii2-app-advanced/downloads.png)](https://packagist.org/packages/yiisoft/yii2-app-advanced)
[![Build Status](https://travis-ci.org/yiisoft/yii2-app-advanced.svg?branch=master)](https://travis-ci.org/yiisoft/yii2-app-advanced)

DIRECTORY STRUCTURE
-------------------

```
common
config/ contains shared configurations
mail/ contains view files for e-mails
models/ contains model classes used in both backend and frontend
console
config/ contains console configurations
controllers/ contains console controllers (commands)
migrations/ contains database migrations
models/ contains console-specific model classes
runtime/ contains files generated during runtime
backend
assets/ contains application assets such as JavaScript and CSS
config/ contains backend configurations
controllers/ contains Web controller classes
models/ contains backend-specific model classes
runtime/ contains files generated during runtime
views/ contains view files for the Web application
web/ contains the entry script and Web resources
frontend
assets/ contains application assets such as JavaScript and CSS
config/ contains frontend configurations
controllers/ contains Web controller classes
models/ contains frontend-specific model classes
runtime/ contains files generated during runtime
views/ contains view files for the Web application
web/ contains the entry script and Web resources
widgets/ contains frontend widgets
vendor/ contains dependent 3rd-party packages
environments/ contains environment-based overrides
tests contains various tests for the advanced application
codeception/ contains tests developed with Codeception PHP Testing Framework
```
29 changes: 29 additions & 0 deletions backend/assets/AppAsset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* @link http:https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http:https://www.yiiframework.com/license/
*/

namespace backend\assets;

use yii\web\AssetBundle;

/**
* @author Qiang Xue <[email protected]>
* @since 2.0
*/
class AppAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'css/site.css',
];
public $js = [
];
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset',
];
}
2 changes: 2 additions & 0 deletions backend/config/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
main-local.php
params-local.php
1 change: 1 addition & 0 deletions backend/config/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php
89 changes: 89 additions & 0 deletions backend/config/main.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php
$params = array_merge(
require(__DIR__ . '/../../common/config/params.php'),
require(__DIR__ . '/../../common/config/params-local.php'),
require(__DIR__ . '/params.php'),
require(__DIR__ . '/params-local.php')
);

return [
'id' => 'app-backend',
'name'=>'博客后台',
'basePath' => dirname(__DIR__),
'controllerNamespace' => 'backend\controllers',
'bootstrap' => ['log'],
'modules' => [],
'components' => [
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'authManager' => [
'class' => 'yii\rbac\DbManager',
],
'db2' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=ejiajie2external.mysql.rds.aliyuncs.com;dbname=ameituan',
'username' => 'sq_ejiajie',
'password' => 'dudu1020',
'charset' => 'utf8',
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'i18n'=>[
'translations' => [
'app'=>[
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@backend/messages',
'forceTranslation' => true
],
'kvgrid'=>[
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@kvgrid/messages',
'forceTranslation' => true
]
]
]
],
'modules' => [
'admin' => [
'class' => 'mdm\admin\Module'
],

'datecontrol' => [
'class' => '\kartik\datecontrol\Module'
],
'gridview' => [
'class' => '\kartik\grid\Module',
// enter optional module parameters below - only if you need to
// use your own export download action or custom translation
// message source
// 'downloadAction' => 'gridview/export/download',
'i18n' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@kvgrid/messages',
'forceTranslation' => true
]
],
],
'aliases' => [
'@mdm/admin' => '@backend/mdmsoft/yii2-admin',
'@kvgrid' =>'@vendor/kartik-v/yii2-grid'
],
'as access' => [
'class' => 'mdm\admin\components\AccessControl',
'allowActions' => [
]
],
'params' => $params,
];
4 changes: 4 additions & 0 deletions backend/config/params.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
return [
'adminEmail' => '[email protected]',
];
83 changes: 83 additions & 0 deletions backend/controllers/SiteController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php
namespace backend\controllers;

use Yii;
use yii\filters\AccessControl;
use yii\web\Controller;
use common\models\LoginForm;
use yii\filters\VerbFilter;

/**
* Site controller
*/
class SiteController extends Controller
{
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'actions' => ['login', 'error'],
'allow' => true,
],
[
'actions' => ['logout', 'index'],
'allow' => true,
'roles' => ['@'],
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'logout' => ['post'],
],
],
];
}

/**
* @inheritdoc
*/
public function actions()
{
return [
'error' => [
'class' => 'yii\web\ErrorAction',
],
];
}

public function actionIndex()
{
return $this->render('index');
}

public function actionLogin()
{
if (!\Yii::$app->user->isGuest) {
return $this->goHome();
}

$model = new LoginForm();
if ($model->load(Yii::$app->request->post()) && $model->login()) {
return $this->goBack();
} else {
return $this->render('login', [
'model' => $model,
]);
}
}

public function actionLogout()
{
Yii::$app->user->logout();

return $this->goHome();
}
}
1 change: 1 addition & 0 deletions backend/mdmsoft/yii2-admin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/nbproject/private/
28 changes: 28 additions & 0 deletions backend/mdmsoft/yii2-admin/AdminAsset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace mdm\admin;

/**
* AdminAsset
*
* @author Misbahul D Munir <[email protected]>
* @since 1.0
*/
class AdminAsset extends \yii\web\AssetBundle
{
/**
* @inheritdoc
*/
public $sourcePath = '@mdm/admin/assets';

/**
* @inheritdoc
*/
public $js = [
'yii.admin.js',
];

public $depends = [
'yii\web\YiiAsset',
];
}

0 comments on commit fc03768

Please sign in to comment.