Browse Source

tmp

wechat_public_accounts
blobt 6 years ago
parent
commit
4a2abcd59a
  1. 46
      .gitignore
  2. 4
      common/config/.gitignore
  3. 5
      common/config/bootstrap.php
  4. 13
      common/config/main.php
  5. 8
      common/config/params.php
  6. 85
      common/models/LoginForm.php
  7. 209
      common/models/User.php
  8. 75
      common/widgets/Alert.php
  9. 34
      composer.json
  10. 776
      composer.lock
  11. 3
      console/config/.gitignore
  12. 1
      console/config/bootstrap.php
  13. 35
      console/config/main.php
  14. 4
      console/config/params.php
  15. 4
      console/config/test.php
  16. 0
      console/controllers/.gitkeep
  17. 91
      console/controllers/InitController.php
  18. 33
      console/migrations/m130524_201442_init.php
  19. 16
      console/migrations/m190124_110200_add_verification_token_column_to_user_table.php
  20. 1
      console/models/.gitkeep
  21. 2
      console/runtime/.gitignore
  22. 17
      environments/web_application/index.php
  23. 25
      environments/web_application/main-local.php
  24. 3
      environments/web_application/params-local.php
  25. 2
      environments/web_application/robots.txt
  26. 110
      init.php
  27. 26
      kcadmin/assets/AppAsset.php
  28. 4
      kcadmin/config/.gitignore
  29. 1
      kcadmin/config/bootstrap.php
  30. 49
      kcadmin/config/main.php
  31. 4
      kcadmin/config/params.php
  32. 108
      kcadmin/controllers/SiteController.php
  33. 1
      kcadmin/models/.gitkeep
  34. 2
      kcadmin/runtime/.gitignore
  35. 33
      kcadmin/views/layouts/base.php
  36. 79
      kcadmin/views/layouts/main.php
  37. 27
      kcadmin/views/site/error.php
  38. 4
      kcadmin/views/site/index.php
  39. 34
      kcadmin/views/site/login.php
  40. 17
      kcadmin/views/site/test.php
  41. 2
      kcadmin/web/assets/.gitignore
  42. 48
      kcadmin/web/css/reset.css
  43. 182
      kcadmin/web/css/site.css
  44. BIN
      kcadmin/web/favicon.ico
  45. BIN
      kcadmin/web/images/robust-logo-light.png
  46. BIN
      kcadmin/web/images/robust-logo-small.png
  47. 20
      kcadmin/web/index.php

46
.gitignore

@ -1,8 +1,40 @@
# ---> Yii
assets/*
!assets/.gitignore
protected/runtime/*
!protected/runtime/.gitignore
protected/data/*.db
themes/classic/views/
# yii console commands
/yii
/yii_test
/yii_test.bat
/img
/frontend/images
# 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
!/vendor/kcdev/yii2/web/KcErrorAction.php
!/vendor/lmz
!/vendor/cgb
# 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
# vagrant runtime
/.vagrant
vendor.zip
/vagrant

4
common/config/.gitignore

@ -0,0 +1,4 @@
codeception-local.php
main-local.php
params-local.php
test-local.php

5
common/config/bootstrap.php

@ -0,0 +1,5 @@
<?php
Yii::setAlias('@common', dirname(__DIR__));
Yii::setAlias('@console', dirname(dirname(__DIR__)) . '/console');
Yii::setAlias('@kcadmin', dirname(dirname(__DIR__)) . '/kcadmin');
Yii::setAlias('@blobt', dirname(dirname(__DIR__)) . '/vendor/blobt');

13
common/config/main.php

@ -0,0 +1,13 @@
<?php
return [
'aliases' => [
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
],
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'components' => [
'cache' => [
'class' => 'yii\caching\FileCache',
],
],
];

8
common/config/params.php

@ -0,0 +1,8 @@
<?php
return [
'adminEmail' => 'admin@example.com',
'supportEmail' => 'support@example.com',
'senderEmail' => 'noreply@example.com',
'senderName' => 'Example.com mailer',
'user.passwordResetTokenExpire' => 3600,
];

85
common/models/LoginForm.php

@ -0,0 +1,85 @@
<?php
namespace common\models;
use Yii;
use yii\base\Model;
/**
* Login form
*/
class LoginForm extends Model {
public $username;
public $password;
public $rememberMe = true;
private $_user;
/**
* {@inheritdoc}
*/
public function rules() {
return [
// username and password are both required
[['username', 'password'], 'required'],
// rememberMe must be a boolean value
['rememberMe', 'boolean'],
// password is validated by validatePassword()
['password', 'validatePassword'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels() {
return [
'username' => '用户名',
'password' => '密码',
'rememberMe' => '记住'
];
}
/**
* Validates the password.
* This method serves as the inline validation for password.
*
* @param string $attribute the attribute currently being validated
* @param array $params the additional name-value pairs given in the rule
*/
public function validatePassword($attribute, $params) {
if (!$this->hasErrors()) {
$user = $this->getUser();
if (!$user || !$user->validatePassword($this->password)) {
$this->addError($attribute, 'Incorrect username or password.');
}
}
}
/**
* Logs in a user using the provided username and password.
*
* @return bool whether the user is logged in successfully
*/
public function login() {
if ($this->validate()) {
return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
}
return false;
}
/**
* Finds user by [[username]]
*
* @return User|null
*/
protected function getUser() {
if ($this->_user === null) {
$this->_user = User::findByUsername($this->username);
}
return $this->_user;
}
}

209
common/models/User.php

@ -0,0 +1,209 @@
<?php
namespace common\models;
use Yii;
use yii\base\NotSupportedException;
use yii\behaviors\TimestampBehavior;
use yii\db\ActiveRecord;
use yii\web\IdentityInterface;
/**
* User model
*
* @property integer $id
* @property string $username
* @property string $password_hash
* @property string $password_reset_token
* @property string $verification_token
* @property string $email
* @property string $auth_key
* @property integer $status
* @property integer $created_at
* @property integer $updated_at
* @property string $password write-only password
*/
class User extends ActiveRecord implements IdentityInterface
{
const STATUS_DELETED = 0;
const STATUS_INACTIVE = 9;
const STATUS_ACTIVE = 10;
/**
* {@inheritdoc}
*/
public static function tableName()
{
return '{{%user}}';
}
/**
* {@inheritdoc}
*/
public function behaviors()
{
return [
TimestampBehavior::className(),
];
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
['status', 'default', 'value' => self::STATUS_INACTIVE],
['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_INACTIVE, self::STATUS_DELETED]],
];
}
/**
* {@inheritdoc}
*/
public static function findIdentity($id)
{
return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]);
}
/**
* {@inheritdoc}
*/
public static function findIdentityByAccessToken($token, $type = null)
{
throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
}
/**
* Finds user by username
*
* @param string $username
* @return static|null
*/
public static function findByUsername($username)
{
return static::findOne(['username' => $username, 'status' => self::STATUS_ACTIVE]);
}
/**
* Finds user by password reset token
*
* @param string $token password reset token
* @return static|null
*/
public static function findByPasswordResetToken($token)
{
if (!static::isPasswordResetTokenValid($token)) {
return null;
}
return static::findOne([
'password_reset_token' => $token,
'status' => self::STATUS_ACTIVE,
]);
}
/**
* Finds user by verification email token
*
* @param string $token verify email token
* @return static|null
*/
public static function findByVerificationToken($token) {
return static::findOne([
'verification_token' => $token,
'status' => self::STATUS_INACTIVE
]);
}
/**
* Finds out if password reset token is valid
*
* @param string $token password reset token
* @return bool
*/
public static function isPasswordResetTokenValid($token)
{
if (empty($token)) {
return false;
}
$timestamp = (int) substr($token, strrpos($token, '_') + 1);
$expire = Yii::$app->params['user.passwordResetTokenExpire'];
return $timestamp + $expire >= time();
}
/**
* {@inheritdoc}
*/
public function getId()
{
return $this->getPrimaryKey();
}
/**
* {@inheritdoc}
*/
public function getAuthKey()
{
return $this->auth_key;
}
/**
* {@inheritdoc}
*/
public function validateAuthKey($authKey)
{
return $this->getAuthKey() === $authKey;
}
/**
* Validates password
*
* @param string $password password to validate
* @return bool if password provided is valid for current user
*/
public function validatePassword($password)
{
return Yii::$app->security->validatePassword($password, $this->password_hash);
}
/**
* Generates password hash from password and sets it to the model
*
* @param string $password
*/
public function setPassword($password)
{
$this->password_hash = Yii::$app->security->generatePasswordHash($password);
}
/**
* Generates "remember me" authentication key
*/
public function generateAuthKey()
{
$this->auth_key = Yii::$app->security->generateRandomString();
}
/**
* Generates new password reset token
*/
public function generatePasswordResetToken()
{
$this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time();
}
public function generateEmailVerificationToken()
{
$this->verification_token = Yii::$app->security->generateRandomString() . '_' . time();
}
/**
* Removes password reset token
*/
public function removePasswordResetToken()
{
$this->password_reset_token = null;
}
}

75
common/widgets/Alert.php

@ -0,0 +1,75 @@
<?php
namespace common\widgets;
use Yii;
/**
* Alert widget renders a message from session flash. All flash messages are displayed
* in the sequence they were assigned using setFlash. You can set message as following:
*
* ```php
* Yii::$app->session->setFlash('error', 'This is the message');
* Yii::$app->session->setFlash('success', 'This is the message');
* Yii::$app->session->setFlash('info', 'This is the message');
* ```
*
* Multiple messages could be set as follows:
*
* ```php
* Yii::$app->session->setFlash('error', ['Error 1', 'Error 2']);
* ```
*
* @author Kartik Visweswaran <kartikv2@gmail.com>
* @author Alexander Makarov <sam@rmcreative.ru>
*/
class Alert extends \yii\bootstrap\Widget
{
/**
* @var array the alert types configuration for the flash messages.
* This array is setup as $key => $value, where:
* - key: the name of the session flash variable
* - value: the bootstrap alert type (i.e. danger, success, info, warning)
*/
public $alertTypes = [
'error' => 'alert-danger',
'danger' => 'alert-danger',
'success' => 'alert-success',
'info' => 'alert-info',
'warning' => 'alert-warning'
];
/**
* @var array the options for rendering the close button tag.
* Array will be passed to [[\yii\bootstrap\Alert::closeButton]].
*/
public $closeButton = [];
/**
* {@inheritdoc}
*/
public function run()
{
$session = Yii::$app->session;
$flashes = $session->getAllFlashes();
$appendClass = isset($this->options['class']) ? ' ' . $this->options['class'] : '';
foreach ($flashes as $type => $flash) {
if (!isset($this->alertTypes[$type])) {
continue;
}
foreach ((array) $flash as $i => $message) {
echo \yii\bootstrap\Alert::widget([
'body' => $message,
'closeButton' => $this->closeButton,
'options' => array_merge($this->options, [
'id' => $this->getId() . '-' . $type . '-' . $i,
'class' => $this->alertTypes[$type] . $appendClass,
]),
]);
}
$session->removeFlash($type);
}
}
}

34
composer.json

@ -0,0 +1,34 @@
{
"name": "blobt/kcbasic",
"description": "This is a fast template using for small project in KcDev.",
"type": "project",
"license": "MIT",
"authors": [
{
"name": "blobt",
"email": "380255922@qq.com"
}
],
"minimum-stability": "dev",
"require": {
"php": ">=7.1.0",
"yiisoft/yii2": "~2.0.14",
"yiisoft/yii2-bootstrap": "^2.0@dev",
"yiisoft/yii2-gii": "^2.0@dev"
},
"repositories": {
"kc_packagist": {
"type": "composer",
"url": "https://packagist.kcshop.com.cn/"
},
"packagist": {
"type": "composer",
"url": "https://packagist.phpcomposer.com"
}
},
"require-dev": {
"yiisoft/yii2-debug": "^2.0@dev",
"kint-php/kint": "dev-master"
}
}

776
composer.lock

@ -0,0 +1,776 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "3a4228dae33737e4c38ff88dd6a56a10",
"packages": [
{
"name": "bower-asset/bootstrap",
"version": "v3.4.1",
"source": {
"type": "git",
"url": "https://github.com/twbs/bootstrap.git",
"reference": "68b0d231a13201eb14acd3dc84e51543d16e5f7e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twbs/bootstrap/zipball/68b0d231a13201eb14acd3dc84e51543d16e5f7e",
"reference": "68b0d231a13201eb14acd3dc84e51543d16e5f7e",
"shasum": ""
},
"require": {
"bower-asset/jquery": ">=1.9.1,<4.0"
},
"type": "bower-asset-library",
"extra": {
"bower-asset-main": [
"less/bootstrap.less",
"dist/js/bootstrap.js"
],
"bower-asset-ignore": [
"/.*",
"_config.yml",
"CNAME",
"composer.json",
"CONTRIBUTING.md",
"docs",
"js/tests",
"test-infra"
]
},
"license": [
"MIT"
],
"description": "The most popular front-end framework for developing responsive, mobile first projects on the web.",
"keywords": [
"css",
"framework",
"front-end",
"js",
"less",
"mobile-first",
"responsive",
"web"
],
"time": "2019-02-13T15:55:38+00:00"
},
{
"name": "bower-asset/inputmask",
"version": "3.3.11",
"source": {
"type": "git",
"url": "https://github.com/RobinHerbots/Inputmask.git",
"reference": "5e670ad62f50c738388d4dcec78d2888505ad77b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/RobinHerbots/Inputmask/zipball/5e670ad62f50c738388d4dcec78d2888505ad77b",
"reference": "5e670ad62f50c738388d4dcec78d2888505ad77b",
"shasum": ""
},
"require": {
"bower-asset/jquery": ">=1.7"
},
"type": "bower-asset-library",
"extra": {
"bower-asset-main": [
"./dist/inputmask/inputmask.js",
"./dist/inputmask/inputmask.extensions.js",
"./dist/inputmask/inputmask.date.extensions.js",
"./dist/inputmask/inputmask.numeric.extensions.js",
"./dist/inputmask/inputmask.phone.extensions.js",
"./dist/inputmask/jquery.inputmask.js",
"./dist/inputmask/global/document.js",
"./dist/inputmask/global/window.js",
"./dist/inputmask/phone-codes/phone.js",
"./dist/inputmask/phone-codes/phone-be.js",
"./dist/inputmask/phone-codes/phone-nl.js",
"./dist/inputmask/phone-codes/phone-ru.js",
"./dist/inputmask/phone-codes/phone-uk.js",
"./dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js",
"./dist/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js",
"./dist/inputmask/dependencyLibs/inputmask.dependencyLib.js",
"./dist/inputmask/bindings/inputmask.binding.js"
],
"bower-asset-ignore": [
"**/*",
"!dist/*",
"!dist/inputmask/*",
"!dist/min/*",
"!dist/min/inputmask/*"
]
},
"license": [
"http://opensource.org/licenses/mit-license.php"
],
"description": "Inputmask is a javascript library which creates an input mask. Inputmask can run against vanilla javascript, jQuery and jqlite.",
"keywords": [
"form",
"input",
"inputmask",
"jquery",
"mask",
"plugins"
],
"time": "2017-11-21T11:46:23+00:00"
},
{
"name": "bower-asset/jquery",
"version": "3.4.1",
"source": {
"type": "git",
"url": "https://github.com/jquery/jquery-dist.git",
"reference": "15bc73803f76bc53b654b9fdbbbc096f56d7c03d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/jquery/jquery-dist/zipball/15bc73803f76bc53b654b9fdbbbc096f56d7c03d",
"reference": "15bc73803f76bc53b654b9fdbbbc096f56d7c03d",
"shasum": ""
},
"type": "bower-asset-library",
"extra": {
"bower-asset-main": "dist/jquery.js",
"bower-asset-ignore": [
"package.json"
]
},
"license": [
"MIT"
],
"keywords": [
"browser",
"javascript",
"jquery",
"library"
],
"time": "2019-05-01T21:19:28+00:00"
},
{
"name": "bower-asset/punycode",
"version": "v1.3.2",
"source": {
"type": "git",
"url": "https://github.com/bestiejs/punycode.js.git",
"reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/bestiejs/punycode.js/zipball/38c8d3131a82567bfef18da09f7f4db68c84f8a3",
"reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3",
"shasum": ""
},
"type": "bower-asset-library",
"extra": {
"bower-asset-main": "punycode.js",
"bower-asset-ignore": [
"coverage",
"tests",
".*",
"component.json",
"Gruntfile.js",
"node_modules",
"package.json"
]
},
"time": "2014-10-22T12:02:42+00:00"
},
{
"name": "bower-asset/yii2-pjax",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/yiisoft/jquery-pjax.git",
"reference": "c39f2393883f370d3c0d63d80a122534131b0f56"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yiisoft/jquery-pjax/zipball/c39f2393883f370d3c0d63d80a122534131b0f56",
"reference": "c39f2393883f370d3c0d63d80a122534131b0f56",
"shasum": ""
},
"require": {
"bower-asset/jquery": ">=1.8"
},
"type": "bower-asset-library",
"extra": {
"bower-asset-main": "./jquery.pjax.js",
"bower-asset-ignore": [
".travis.yml",
"Gemfile",
"Gemfile.lock",
"CONTRIBUTING.md",
"vendor/",
"script/",
"test/"
],
"branch-alias": {
"dev-master": "2.0.8-dev"
}
},
"license": [
"MIT"
],
"time": "2017-10-14T08:42:41+00:00"
},
{
"name": "cebe/markdown",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/cebe/markdown.git",
"reference": "eeb1bf622e80f337479e00a5db94c56e7cf1326b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cebe/markdown/zipball/eeb1bf622e80f337479e00a5db94c56e7cf1326b",
"reference": "eeb1bf622e80f337479e00a5db94c56e7cf1326b",
"shasum": ""
},
"require": {
"lib-pcre": "*",
"php": ">=5.4.0"
},
"require-dev": {
"cebe/indent": "*",
"facebook/xhprof": "*@dev",
"phpunit/phpunit": "4.1.*"
},
"bin": [
"bin/markdown"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"psr-4": {
"cebe\\markdown\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Carsten Brandt",
"email": "mail@cebe.cc",
"homepage": "http://cebe.cc/",
"role": "Creator"
}
],
"description": "A super fast, highly extensible markdown parser for PHP",
"homepage": "https://github.com/cebe/markdown#readme",
"keywords": [
"extensible",
"fast",
"gfm",
"markdown",
"markdown-extra"
],
"time": "2018-12-10T09:41:35+00:00"
},
{
"name": "ezyang/htmlpurifier",
"version": "v4.10.0",
"source": {
"type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git",
"reference": "d85d39da4576a6934b72480be6978fb10c860021"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/d85d39da4576a6934b72480be6978fb10c860021",
"reference": "d85d39da4576a6934b72480be6978fb10c860021",
"shasum": ""
},
"require": {
"php": ">=5.2"
},
"require-dev": {
"simpletest/simpletest": "^1.1"
},
"type": "library",
"autoload": {
"psr-0": {
"HTMLPurifier": "library/"
},
"files": [
"library/HTMLPurifier.composer.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL"
],
"authors": [
{
"name": "Edward Z. Yang",
"email": "admin@htmlpurifier.org",
"homepage": "http://ezyang.com"
}
],
"description": "Standards compliant HTML filter written in PHP",
"homepage": "http://htmlpurifier.org/",
"keywords": [
"html"
],
"time": "2018-02-23T01:58:20+00:00"
},
{
"name": "phpspec/php-diff",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/phpspec/php-diff.git",
"reference": "0464787bfa7cd13576c5a1e318709768798bec6a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/php-diff/zipball/0464787bfa7cd13576c5a1e318709768798bec6a",
"reference": "0464787bfa7cd13576c5a1e318709768798bec6a",
"shasum": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-0": {
"Diff": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Chris Boulton",
"homepage": "http://github.com/chrisboulton"
}
],
"description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).",
"time": "2016-04-07T12:29:16+00:00"
},
{
"name": "yiisoft/yii2",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/yiisoft/yii2-framework.git",
"reference": "f61cfa2ab22ddf82377f5c3428066689123b50e5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/f61cfa2ab22ddf82377f5c3428066689123b50e5",
"reference": "f61cfa2ab22ddf82377f5c3428066689123b50e5",
"shasum": ""
},
"require": {
"bower-asset/inputmask": "~3.2.2 | ~3.3.5",
"bower-asset/jquery": "3.4.*@stable | 3.3.*@stable | 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable",
"bower-asset/punycode": "1.3.*",
"bower-asset/yii2-pjax": "~2.0.1",
"cebe/markdown": "~1.0.0 | ~1.1.0 | ~1.2.0",
"ext-ctype": "*",
"ext-mbstring": "*",
"ezyang/htmlpurifier": "~4.6",
"lib-pcre": "*",
"php": ">=5.4.0",
"yiisoft/yii2-composer": "~2.0.4"
},
"bin": [
"yii"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"yii\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Qiang Xue",
"email": "qiang.xue@gmail.com",
"homepage": "http://www.yiiframework.com/",
"role": "Founder and project lead"
},
{
"name": "Alexander Makarov",
"email": "sam@rmcreative.ru",
"homepage": "http://rmcreative.ru/",
"role": "Core framework development"
},
{
"name": "Maurizio Domba",
"homepage": "http://mdomba.info/",
"role": "Core framework development"
},
{
"name": "Carsten Brandt",
"email": "mail@cebe.cc",
"homepage": "http://cebe.cc/",
"role": "Core framework development"
},
{
"name": "Timur Ruziev",
"email": "resurtm@gmail.com",
"homepage": "http://resurtm.com/",
"role": "Core framework development"
},
{
"name": "Paul Klimov",
"email": "klimov.paul@gmail.com",
"role": "Core framework development"
},
{
"name": "Dmitry Naumenko",
"email": "d.naumenko.a@gmail.com",
"role": "Core framework development"
},
{
"name": "Boudewijn Vahrmeijer",
"email": "info@dynasource.eu",
"homepage": "http://dynasource.eu",
"role": "Core framework development"
}
],
"description": "Yii PHP Framework Version 2",
"homepage": "http://www.yiiframework.com/",
"keywords": [
"framework",
"yii2"
],
"time": "2019-07-10T18:16:39+00:00"
},
{
"name": "yiisoft/yii2-bootstrap",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/yiisoft/yii2-bootstrap.git",
"reference": "40a00e20b66057cd32d0c8bbc9377dc0223e541a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yiisoft/yii2-bootstrap/zipball/40a00e20b66057cd32d0c8bbc9377dc0223e541a",
"reference": "40a00e20b66057cd32d0c8bbc9377dc0223e541a",
"shasum": ""
},
"require": {
"bower-asset/bootstrap": "3.4.* | 3.3.* | 3.2.* | 3.1.*",
"yiisoft/yii2": "~2.0.6"
},
"require-dev": {
"phpunit/phpunit": "<7"
},
"type": "yii2-extension",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"yii\\bootstrap\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Paul Klimov",
"email": "klimov.paul@gmail.com"
},
{
"name": "Alexander Makarov",
"email": "sam@rmcreative.ru",
"homepage": "http://rmcreative.ru/"
},
{
"name": "Antonio Ramirez",
"email": "amigo.cobos@gmail.com"
},
{
"name": "Qiang Xue",
"email": "qiang.xue@gmail.com",
"homepage": "http://www.yiiframework.com/"
}
],
"description": "The Twitter Bootstrap extension for the Yii framework",
"keywords": [
"bootstrap",
"yii2"
],
"time": "2019-05-23T16:20:29+00:00"
},
{
"name": "yiisoft/yii2-composer",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/yiisoft/yii2-composer.git",
"reference": "fa0856bb95beb49d30f408639224b0e0ed26b4f3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/fa0856bb95beb49d30f408639224b0e0ed26b4f3",
"reference": "fa0856bb95beb49d30f408639224b0e0ed26b4f3",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0"
},
"require-dev": {
"composer/composer": "^1.0",
"phpunit/phpunit": "<7"
},
"type": "composer-plugin",
"extra": {
"class": "yii\\composer\\Plugin",
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"yii\\composer\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Qiang Xue",
"email": "qiang.xue@gmail.com"
},
{
"name": "Carsten Brandt",
"email": "mail@cebe.cc"
}
],
"description": "The composer plugin for Yii extension installer",
"keywords": [
"composer",
"extension installer",
"yii2"
],
"time": "2019-05-28T08:14:44+00:00"
},
{
"name": "yiisoft/yii2-gii",
"version": "2.1.0",
"source": {
"type": "git",
"url": "https://github.com/yiisoft/yii2-gii.git",
"reference": "d1c18f0dcbd72ab285acd320c56b1aa2554e06fa"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yiisoft/yii2-gii/zipball/d1c18f0dcbd72ab285acd320c56b1aa2554e06fa",
"reference": "d1c18f0dcbd72ab285acd320c56b1aa2554e06fa",
"shasum": ""
},
"require": {
"phpspec/php-diff": "^1.1.0",
"yiisoft/yii2": "~2.0.14"
},
"require-dev": {
"phpunit/phpunit": "<7",
"yiisoft/yii2-coding-standards": "~2.0"
},
"type": "yii2-extension",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"yii\\gii\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Qiang Xue",
"email": "qiang.xue@gmail.com"
}
],
"description": "The Gii extension for the Yii framework",
"keywords": [
"code generator",
"gii",
"yii2"
],
"time": "2019-03-17T19:23:15+00:00"
}
],
"packages-dev": [
{
"name": "kint-php/kint",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/kint-php/kint.git",
"reference": "339b24fc0439d61644ddcc5d5f52cf5fdfbe3fa3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/kint-php/kint/zipball/339b24fc0439d61644ddcc5d5f52cf5fdfbe3fa3",
"reference": "339b24fc0439d61644ddcc5d5f52cf5fdfbe3fa3",
"shasum": ""
},
"require": {
"php": ">=5.3.6"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.0",
"phpunit/phpunit": "^4.0",
"seld/phar-utils": "^1.0",
"symfony/finder": "^2.0 || ^3.0 || ^4.0",
"vimeo/psalm": "^3.0"
},
"suggest": {
"ext-ctype": "Simple data type tests",
"ext-iconv": "Provides fallback detection for ambiguous legacy string encodings such as the Windows and ISO 8859 code pages",
"ext-mbstring": "Provides string encoding detection",
"kint-php/kint-js": "Provides a simplified dump to console.log()",
"kint-php/kint-twig": "Provides d() and s() functions in twig templates",
"symfony/polyfill-ctype": "Replacement for ext-ctype if missing",
"symfony/polyfill-iconv": "Replacement for ext-iconv if missing",
"symfony/polyfill-mbstring": "Replacement for ext-mbstring if missing"
},
"type": "library",
"autoload": {
"files": [
"init.php"
],
"psr-4": {
"Kint\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Rokas Šleinius",
"homepage": "https://github.com/raveren"
},
{
"name": "Jonathan Vollebregt",
"homepage": "https://github.com/jnvsor"
},
{
"name": "Contributors",
"homepage": "https://github.com/kint-php/kint/graphs/contributors"
}
],
"description": "Kint - debugging tool for PHP developers",
"homepage": "https://kint-php.github.io/kint/",
"keywords": [
"debug",
"kint",
"php"
],
"time": "2019-07-11T17:29:14+00:00"
},
{
"name": "yiisoft/yii2-debug",
"version": "2.1.5",
"source": {
"type": "git",
"url": "https://github.com/yiisoft/yii2-debug.git",
"reference": "a6bbf55093e154e2eeb2c778af8717989495270e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yiisoft/yii2-debug/zipball/a6bbf55093e154e2eeb2c778af8717989495270e",
"reference": "a6bbf55093e154e2eeb2c778af8717989495270e",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": ">=5.4",
"yiisoft/yii2": "~2.0.13"
},
"require-dev": {
"phpunit/phpunit": "<7",
"yiisoft/yii2-coding-standards": "~2.0",
"yiisoft/yii2-swiftmailer": "*"
},
"type": "yii2-extension",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"yii\\debug\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Qiang Xue",
"email": "qiang.xue@gmail.com"
},
{
"name": "Simon Karlen",
"email": "simi.albi@outlook.com"
}
],
"description": "The debugger extension for the Yii framework",
"keywords": [
"debug",
"debugger",
"yii2"
],
"time": "2019-06-04T14:21:49+00:00"
}
],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": {
"yiisoft/yii2-bootstrap": 20,
"yiisoft/yii2-gii": 20,
"yiisoft/yii2-debug": 20,
"kint-php/kint": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=7.1.0"
},
"platform-dev": []
}

3
console/config/.gitignore

@ -0,0 +1,3 @@
main-local.php
params-local.php
test-local.php

1
console/config/bootstrap.php

@ -0,0 +1 @@
<?php

35
console/config/main.php

@ -0,0 +1,35 @@
<?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-console',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'controllerNamespace' => 'console\controllers',
'aliases' => [
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
],
'controllerMap' => [
'fixture' => [
'class' => 'yii\console\controllers\FixtureController',
'namespace' => 'common\fixtures',
],
],
'components' => [
'log' => [
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
],
'params' => $params,
];

4
console/config/params.php

@ -0,0 +1,4 @@
<?php
return [
'adminEmail' => 'admin@example.com',
];

4
console/config/test.php

@ -0,0 +1,4 @@
<?php
return [
];

0
console/controllers/.gitkeep

91
console/controllers/InitController.php

@ -0,0 +1,91 @@
<?php
namespace console\controllers;
use Yii;
use yii\console\Controller;
use yii\helpers\Console;
use yii\db\Query;
use yii\helpers\ArrayHelper;
use common\models\User;
//use common\models\ars\AdminUser;
/**
* Description of RbacsetController
*
* @author blobt
*/
class InitController extends Controller {
public function actionIndex() {
echo "index\n";
}
public function actionCreateAdmin($password = NULL) {
$auth = Yii::$app->authManager;
while ($password == NULL) {
$password = $this->prompt("\n\n请输入admin用户密码(最少6位任意字符):");
if (strlen($password) < 6) {
$password = NULL;
continue;
}
break;
}
$this->createAdmin($password);
}
/**
* 数据迁移
* @param sring $migrationPath 数据迁移代码目录
*/
private function migrate($migrationPath = "@app/migrations") {
$migrate = Yii::createObject("yii\console\controllers\MigrateController", ["action", $this]);
$migrate->interactive = false;
$migrate->migrationPath = $migrationPath;
$migrate->runAction("up", []);
}
/**
* TODO没有完善
* 清空数据库
*/
public function clearDb() {
Yii::$app->db->createCommand("SET FOREIGN_KEY_CHECKS = 0;")->execute();
$dbname = explode('=', explode(';', Yii::$app->db->dsn)[1])[1];
$sql = "SELECT CONCAT('drop table ',table_name,';') FROM information_schema.`TABLES` WHERE table_schema='{$dbname}';";
$sqls = Yii::$app->db->createCommand($sql)->queryColumn();
foreach ($sqls as $dropSql) {
Yii::$app->db->createCommand($dropSql)->execute();
}
}
/**
* 创建管理员
* @param string $password 管理员密码
*/
private function createAdmin($password) {
$auth = Yii::$app->authManager;
$model = User::findOne("username = 'admin");
if (empty($model)) {
$model = new User();
}
$model->username = "admin";
$model->email = "admin@kcshop.store";
$model->setPassword($password);
$model->generateAuthKey();
$model->status = User::STATUS_ACTIVE;
$model->created_at = $model->updated_at = time();
if ($model->save()) {
//$oRole = $auth->getRole("超级管理员");
//if ($auth->assign($oRole, $model->id)) {
$this->stdout("Create admin success!\n", Console::FG_GREEN);
//}
}
}
}

33
console/migrations/m130524_201442_init.php

@ -0,0 +1,33 @@
<?php
use yii\db\Migration;
class m130524_201442_init extends Migration
{
public function up()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->createTable('{{%user}}', [
'id' => $this->primaryKey(),
'username' => $this->string()->notNull()->unique(),
'auth_key' => $this->string(32)->notNull(),
'password_hash' => $this->string()->notNull(),
'password_reset_token' => $this->string()->unique(),
'email' => $this->string()->notNull()->unique(),
'status' => $this->smallInteger()->notNull()->defaultValue(10),
'created_at' => $this->integer()->notNull(),
'updated_at' => $this->integer()->notNull(),
], $tableOptions);
}
public function down()
{
$this->dropTable('{{%user}}');
}
}

16
console/migrations/m190124_110200_add_verification_token_column_to_user_table.php

@ -0,0 +1,16 @@
<?php
use \yii\db\Migration;
class m190124_110200_add_verification_token_column_to_user_table extends Migration
{
public function up()
{
$this->addColumn('{{%user}}', 'verification_token', $this->string()->defaultValue(null));
}
public function down()
{
$this->dropColumn('{{%user}}', 'verification_token');
}
}

1
console/models/.gitkeep

@ -0,0 +1 @@
*

2
console/runtime/.gitignore

@ -0,0 +1,2 @@
*
!.gitignore

17
environments/web_application/index.php

@ -0,0 +1,17 @@
<?php
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
require __DIR__ . '/../../vendor/autoload.php';
require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php';
require __DIR__ . '/../../common/config/bootstrap.php';
require __DIR__ . '/../config/bootstrap.php';
$config = yii\helpers\ArrayHelper::merge(
require __DIR__ . '/../../common/config/main.php',
require __DIR__ . '/../../common/config/main-local.php',
require __DIR__ . '/../config/main.php',
require __DIR__ . '/../config/main-local.php'
);
(new yii\web\Application($config))->run();

25
environments/web_application/main-local.php

@ -0,0 +1,25 @@
<?php
$config = [
'components' => [
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => '',
],
],
];
if (!YII_ENV_TEST) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = [
'class' => 'yii\debug\Module',
];
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
];
}
return $config;

3
environments/web_application/params-local.php

@ -0,0 +1,3 @@
<?php
return [
];

2
environments/web_application/robots.txt

@ -0,0 +1,2 @@
User-agent: *
Disallow: /

110
init.php

@ -0,0 +1,110 @@
#!/usr/bin/env php
<?php
/**
* kcbasic初始化工具
*/
echo "KcDev Initialization Tool v1.0\n\n";
/* 检查openssl模块是否已经安装并正确加载 */
if (!extension_loaded('openssl')) {
die('The OpenSSL PHP extension is required by Yii2.');
}
$root = str_replace('\\', '/', __DIR__);
/* 输入app名称 */
echo "Please enter the app name:";
$appName = trim(strtolower(fgets(STDIN)));
if (!preg_match('/^[_a-z]{3,12}$/i', $appName)) {
printError("App name must be 3 to 12 letters or underline");
exit();
}
if (is_dir($root . '/' . $appName)) {
printError("App {$appName} is exists");
exit();
}
/* 输入app类型 */
$types = ["web application", "wechat application", "restfull api"];
echo "\n\nPlease select the type of your app.\n";
foreach ($type as $i => $name) {
echo " [$i] $name\n";
}
echo "\n Your choice [0-" . (count($types) - 1) . ', or "q" to quit] ';
$answer = trim(fgets(STDIN));
if (!ctype_digit($answer) || !in_array($answer, range(0, count($types) - 1))) {
printError("Please enter the correct nunmber");
exit();
}
$type = $answer;
//TODO 后面希望通过这个脚本 可以创建web后台 H5前台 API等程序的基础模板,这些模板保存在environment目录里面
/**
* Prints error message.
* @param string $message message
*/
function printError($message) {
echo "\n " . formatMessage("Error. $message", ['fg-red']) . " \n";
}
/**
* Returns true if the stream supports colorization. ANSI colors are disabled if not supported by the stream.
*
* - windows without ansicon
* - not tty consoles
*
* @return boolean true if the stream supports ANSI colors, otherwise false.
*/
function ansiColorsSupported() {
return DIRECTORY_SEPARATOR === '\\' ? getenv('ANSICON') !== false || getenv('ConEmuANSI') === 'ON' : function_exists('posix_isatty') && @posix_isatty(STDOUT);
}
/**
* Get ANSI code of style.
* @param string $name style name
* @return integer ANSI code of style.
*/
function getStyleCode($name) {
$styles = [
'bold' => 1,
'fg-black' => 30,
'fg-red' => 31,
'fg-green' => 32,
'fg-yellow' => 33,
'fg-blue' => 34,
'fg-magenta' => 35,
'fg-cyan' => 36,
'fg-white' => 37,
'bg-black' => 40,
'bg-red' => 41,
'bg-green' => 42,
'bg-yellow' => 43,
'bg-blue' => 44,
'bg-magenta' => 45,
'bg-cyan' => 46,
'bg-white' => 47,
];
return $styles[$name];
}
/**
* Formats message using styles if STDOUT supports it.
* @param string $message message
* @param string[] $styles styles
* @return string formatted message.
*/
function formatMessage($message, $styles) {
if (empty($styles) || !ansiColorsSupported()) {
return $message;
}
return sprintf("\x1b[%sm", implode(';', array_map('getStyleCode', $styles))) . $message . "\x1b[0m";
}
?>

26
kcadmin/assets/AppAsset.php

@ -0,0 +1,26 @@
<?php
namespace kcadmin\assets;
use yii\web\AssetBundle;
/**
* Main backend application asset bundle.
*/
class AppAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'css/reset.css',
'css/site.css',
];
public $js = [
];
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset',
'yii\bootstrap\BootstrapPluginAsset',
'blobt\web\AdminlteAsset'
];
}

4
kcadmin/config/.gitignore

@ -0,0 +1,4 @@
codeception-local.php
main-local.php
params-local.php
test-local.php

1
kcadmin/config/bootstrap.php

@ -0,0 +1 @@
<?php

49
kcadmin/config/main.php

@ -0,0 +1,49 @@
<?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' => 'kcadmin',
'basePath' => dirname(__DIR__),
'language' => 'zh-CN',
'controllerNamespace' => 'kcadmin\controllers',
'bootstrap' => ['log'],
'modules' => [],
'components' => [
'request' => [
'csrfParam' => '_csrf-kcadmin',
],
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
'identityCookie' => ['name' => '_identity-kcadmin', 'httpOnly' => true],
],
'session' => [
// this is the name of the session cookie used for login on the app
'name' => 'kcadmin',
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
],
],
],
'params' => $params,
];

4
kcadmin/config/params.php

@ -0,0 +1,4 @@
<?php
return [
'adminEmail' => 'admin@example.com',
];

108
kcadmin/controllers/SiteController.php

@ -0,0 +1,108 @@
<?php
namespace kcadmin\controllers;
use Yii;
use yii\web\Controller;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use common\models\LoginForm;
/**
* Site controller
*/
class SiteController extends Controller {
/**
* {@inheritdoc}
*/
public function behaviors() {
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'actions' => ['login', 'error', 'test'],
'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',
],
];
}
/**
* Displays homepage.
*
* @return string
*/
public function actionIndex() {
return $this->render('index');
}
/**
* Login action.
*
* @return string
*/
public function actionLogin() {
$this->layout = 'base';
if (!Yii::$app->user->isGuest) {
return $this->goHome();
}
$model = new LoginForm();
if ($model->load(Yii::$app->request->post()) && $model->login()) {
return $this->goBack();
} else {
$model->password = '';
return $this->render('login', [
'model' => $model,
]);
}
}
/**
* Logout action.
*
* @return string
*/
public function actionLogout() {
Yii::$app->user->logout();
return $this->goHome();
}
public function actionTest() {
$model = new LoginForm();
return $this->render('test', [
'name' => 'blobt',
'model' => $model
]);
}
}

1
kcadmin/models/.gitkeep

@ -0,0 +1 @@
*

2
kcadmin/runtime/.gitignore

@ -0,0 +1,2 @@
*
!.gitignore

33
kcadmin/views/layouts/base.php

@ -0,0 +1,33 @@
<?php
/* @var $this \yii\web\View */
/* @var $content string */
use kcadmin\assets\AppAsset;
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use common\widgets\Alert;
AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
<meta charset="<?= Yii::$app->charset ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php $this->registerCsrfMetaTags() ?>
<title><?= Html::encode($this->title) ?></title>
<?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<?= $content ?>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>

79
kcadmin/views/layouts/main.php

@ -0,0 +1,79 @@
<?php
/* @var $this \yii\web\View */
/* @var $content string */
use kcadmin\assets\AppAsset;
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use common\widgets\Alert;
use yii\bootstrap\Dropdown;
AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
<meta charset="<?= Yii::$app->charset ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php $this->registerCsrfMetaTags() ?>
<title><?= Html::encode($this->title) ?></title>
<?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<nav class="navbar">
<div class="navbar-header">
<a href="/"><img alt="branding logo" src="./images/robust-logo-light.png"/></a>
</div>
<div class="navbar-content">
<ul class="navbar-left nav">
<li><a href="#" class="glyphicon glyphicon-menu-hamburger f30"></a></li>
</ul>
<ul class="navbar-right nav">
<li>
<a href="#" data-toggle="dropdown" class="dropdown-toggle f24">
<i class="glyphicon glyphicon-user"></i><?= Yii::$app->user->identity->username ?> <b class="caret"></b>
</a>
<?php
echo Dropdown::widget([
'items' => [
['label' => '帐户设置', 'url' => '/user/profile'],
['label' => '退出', 'url' => '/site/logout'],
],
]);
?>
</li>
<li><a href="#" class="glyphicon glyphicon-envelope f20"></a></li>
</ul>
</div>
</nav>
<div class="sidebar">
<div class="sidebar-content">
<ul class="">
<li class="sidebar-item">
<a href="#" class="sidebar-item-title">Dashboard</a>
<ul class="sidebar-item-list">
<li>sasa</li>
<li>dola</li>
</ul>
</li>
<li class="sidebar-item">
<a href="#" class="sidebar-item-title">项目</a>
<ul class="sidebar-item-list">
<li>sasa</li>
<li>dola</li>
</ul>
</li>
</ul>
</div>
</div>
<?= $content ?>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>

27
kcadmin/views/site/error.php

@ -0,0 +1,27 @@
<?php
/* @var $this yii\web\View */
/* @var $name string */
/* @var $message string */
/* @var $exception Exception */
use yii\helpers\Html;
$this->title = $name;
?>
<div class="site-error">
<h1><?= Html::encode($this->title) ?></h1>
<div class="alert alert-danger">
<?= nl2br(Html::encode($message)) ?>
</div>
<p>
The above error occurred while the Web server was processing your request.
</p>
<p>
Please contact us if you think this is a server error. Thank you.
</p>
</div>

4
kcadmin/views/site/index.php

@ -0,0 +1,4 @@
<?php
/* @var $this yii\web\View */
$this->title = 'My Yii Application';
?>

34
kcadmin/views/site/login.php

@ -0,0 +1,34 @@
<?php
/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \common\models\LoginForm */
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
$this->title = '系统登录';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="login-body">
<div class="login-form col-md-3 offset-md-4">
<h2><?= Html::encode($this->title) ?></h2>
<h6 class="login-tips font-small-3 line text-muted"><span>Login with Blobt Admin</span></h6>
<div class="row">
<div class="col-lg-12">
<?php $form = ActiveForm::begin(['id' => 'login-form']); ?>
<?= $form->field($model, 'username')->textInput(['autofocus' => true]) ?>
<?= $form->field($model, 'password')->passwordInput() ?>
<?= $form->field($model, 'rememberMe')->checkbox() ?>
<div class="form-group">
<?= Html::submitButton('Login', ['class' => 'btn btn-primary btn-lg btn-block', 'name' => 'login-button']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
</div>
</div>

17
kcadmin/views/site/test.php

@ -0,0 +1,17 @@
<?PHP
use yii\widgets\ActiveForm;
use yii\helpers\Html;
?>
<h1><?= $name ?></h1>
<?php $form = ActiveForm::begin(['id' => 'login-form']); ?>
<?= $form->field($model, '用户:',['template' => '{input}'])->textInput(['autofocus' => true]) ?>
<div class="form-group">
<?= Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
</div>
<?php ActiveForm::end(); ?>

2
kcadmin/web/assets/.gitignore

@ -0,0 +1,2 @@
*
!.gitignore

48
kcadmin/web/css/reset.css

@ -0,0 +1,48 @@
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}

182
kcadmin/web/css/site.css

@ -0,0 +1,182 @@
/*公共样式*/
body{
/* font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;*/
font-size: 1rem;
line-height: 1.45;
color: #373a3c;
background-color: #F1F1F1;
}
.f30{
font-size:30px;
}
.f24{
font-size:24px;
}
.f20{
font-size:20px;
}
/*登录页*/
.login-body{
display: flex;
align-items: center;
height: 100vh;
}
.login-body .line {
border-bottom: 1px solid #dadada;
line-height: 0.1em;
margin: 10px 0 20px;
}
.login-body .line span {
background: #fff;
padding: 0 10px;
}
.login-form {
box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
margin: 0 auto;
}
.login-form h2{
text-align: center;
margin-bottom: 20px;
}
.login-form h6 {
text-align: center;
}
/*导航部分*/
.navbar {
position: relative;
min-height: 58px;
margin-bottom: 20px;
padding: 0px;
transition: 300ms ease all;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
background: #FFFFFF;
border: 0px;
}
.navbar-header{
float: left;
width: 240px;
background: #1D2B36;
height: 58px;
}
.navbar-header a{
display: block;
margin-left: 20px;
margin-top: 15px;
}
.navbar-content {
margin-left: 240px;
padding: 0rem 1rem;
transition: 300ms ease all;
background: inherit;
height: 58px;
}
.navbar-content .navbar-left {
float: left;
padding-left: 0;
margin-bottom: 0;
list-style: none;
height: 58px;
width: 300px;
}
.navbar-content > .navbar-left > li {
float: left;
height: 58px;
line-height: 58px;
margin-left: 25px;
}
.navbar-content > .navbar-left > li > a{
text-decoration: none;
line-height: 58px;
color: #55595c;
position: relative;
display: block;
padding: 0;
background-color: #fff;
}
.navbar-content > .navbar-left > li > a:hover,
.navbar-content > .navbar-left > li > a:focus {
text-decoration: none;
background-color: inherit !important;
}
.navbar-content .navbar-right {
float: right;
padding-right: 0;
margin-bottom: 0;
list-style: none;
height: 58px;
width: 500px;
}
.navbar-content > .navbar-right > li {
float: right;
height: 58px;
line-height: 58px;
margin-right: 30px;
}
.navbar-content > .navbar-right > li > a{
text-decoration: none;
line-height: 58px;
color: #55595c;
position: relative;
display: block;
padding: 0;
background-color: #fff;
}
.navbar-content > .navbar-right > li > a:hover,
.navbar-content > .navbar-right > li > a:focus {
text-decoration: none;
background-color: inherit !important;
}
.dropdown-menu > li > a {
font-size: 18px;
}
.navbar-content .navbar-right i {
font-size: 16px;
margin-right: 8px;
}
/*侧边栏*/
.sidebar{
width: 240px;
background: #1D2B36;
}
.sidebar-content{
height: 100%;
position: relative;
}
.sidebar-content > ul {
overflow-x: hidden;
list-style: none;
margin: 0;
padding: 0;
font-size: 1rem;
overflow-y: hidden;
}
.sidebar-content > ul > li{
line-height: 2.8;
border: 1px solid red;
}
.sidebar-item-list{
display: none;
}

BIN
kcadmin/web/favicon.ico

BIN
kcadmin/web/images/robust-logo-light.png

After

Width: 117  |  Height: 25  |  Size: 3.9 KiB

BIN
kcadmin/web/images/robust-logo-small.png

After

Width: 32  |  Height: 18  |  Size: 2.0 KiB

20
kcadmin/web/index.php

@ -0,0 +1,20 @@
<?php
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
require __DIR__ . '/../../vendor/autoload.php';
require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php';
require __DIR__ . '/../../common/config/bootstrap.php';
require __DIR__ . '/../config/bootstrap.php';
$config = yii\helpers\ArrayHelper::merge(
require __DIR__ . '/../../common/config/main.php',
require __DIR__ . '/../../common/config/main-local.php',
require __DIR__ . '/../config/main.php',
require __DIR__ . '/../config/main-local.php'
);
(new yii\web\Application($config))->run();
Loading…
Cancel
Save