diff --git a/api/assets/AppAsset.php b/api/assets/AppAsset.php new file mode 100644 index 0000000..6a7b360 --- /dev/null +++ b/api/assets/AppAsset.php @@ -0,0 +1,26 @@ + 'api', + 'basePath' => dirname(__DIR__), + 'controllerNamespace' => 'api\controllers', + 'bootstrap' => ['log'], + 'modules' => [], + 'components' => [ + 'request' => [ + 'parsers' => [ + 'application/json' => 'yii\web\JsonParser', + ], + 'csrfParam' => '_csrf-backend', + ], + 'user' => [ + 'identityClass' => 'common\models\User', + 'enableAutoLogin' => true, + 'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true], + ], + 'session' => [ + // this is the name of the session cookie used for login on the app + 'name' => 'advanced-api', + ], + 'log' => [ + 'traceLevel' => YII_DEBUG ? 3 : 0, + 'targets' => [ + [ + 'class' => 'yii\log\FileTarget', + 'levels' => ['error', 'warning'], + ], + ], + ], + 'errorHandler' => [ + 'errorAction' => 'site/error', + ], + 'urlManager' => [ + 'enablePrettyUrl' => true, + 'showScriptName' => true, + 'enableStrictParsing' => false, + 'rules' => [ + ['class' => 'yii\rest\UrlRule', 'controller' => 'test'], + ], + ], + ], + 'params' => $params, +]; diff --git a/api/config/params.php b/api/config/params.php new file mode 100644 index 0000000..d0b9c34 --- /dev/null +++ b/api/config/params.php @@ -0,0 +1,3 @@ + [ + 'class' => 'yii\web\ErrorAction', + ], + ]; + } +} diff --git a/api/controllers/TestController.php b/api/controllers/TestController.php new file mode 100644 index 0000000..7ede9df --- /dev/null +++ b/api/controllers/TestController.php @@ -0,0 +1,59 @@ + Goods::find(), + 'pagination' => [ + 'pageSize' => 1, + ], + ]); + } +} diff --git a/api/runtime/.gitignore b/api/runtime/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/api/runtime/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/api/views/site/error.php b/api/views/site/error.php new file mode 100644 index 0000000..0ba2574 --- /dev/null +++ b/api/views/site/error.php @@ -0,0 +1,27 @@ +title = $name; +?> +
+ +

title) ?>

+ +
+ +
+ +

+ The above error occurred while the Web server was processing your request. +

+

+ Please contact us if you think this is a server error. Thank you. +

+ +
diff --git a/api/web/.gitignore b/api/web/.gitignore new file mode 100644 index 0000000..ab89d98 --- /dev/null +++ b/api/web/.gitignore @@ -0,0 +1,5 @@ +/index.php +/index-test.php +/robots.txt +uploads + diff --git a/api/web/assets/.gitignore b/api/web/assets/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/api/web/assets/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/api/web/css/site.css b/api/web/css/site.css new file mode 100644 index 0000000..f787e34 --- /dev/null +++ b/api/web/css/site.css @@ -0,0 +1,120 @@ +html, +body { + height: 100%; +} + +.wrap { + min-height: 100%; + height: auto; + margin: 0 auto -60px; + padding: 0 0 60px; +} + +.wrap > .container { + padding: 70px 15px 20px; +} + +.footer { + height: 60px; + background-color: #f5f5f5; + border-top: 1px solid #ddd; + padding-top: 20px; +} + +.jumbotron { + text-align: center; + background-color: transparent; +} + +.jumbotron .btn { + font-size: 21px; + padding: 14px 24px; +} + +.not-set { + color: #c55; + font-style: italic; +} + +/* add sorting icons to gridview sort links */ +a.asc:after, a.desc:after { + position: relative; + top: 1px; + display: inline-block; + font-family: 'Glyphicons Halflings'; + font-style: normal; + font-weight: normal; + line-height: 1; + padding-left: 5px; +} + +a.asc:after { + content: /*"\e113"*/ "\e151"; +} + +a.desc:after { + content: /*"\e114"*/ "\e152"; +} + +.sort-numerical a.asc:after { + content: "\e153"; +} + +.sort-numerical a.desc:after { + content: "\e154"; +} + +.sort-ordinal a.asc:after { + content: "\e155"; +} + +.sort-ordinal a.desc:after { + content: "\e156"; +} + +.grid-view td { + white-space: nowrap; +} + +.grid-view .filters input, +.grid-view .filters select { + min-width: 50px; +} + +.hint-block { + display: block; + margin-top: 5px; + color: #999; +} + +.error-summary { + color: #a94442; + background: #fdf7f7; + border-left: 3px solid #eed3d7; + padding: 10px 20px; + margin: 0 0 15px 0; +} + +/* align the logout "link" (button in forms) of the navbar */ +.nav li > form > button.logout { + padding: 15px; + border: none; +} + +@media(max-width:767px) { + .nav li > form > button.logout { + display:block; + text-align: left; + width: 100%; + padding: 10px 15px; + } +} + +.nav > li > form > button.logout:focus, +.nav > li > form > button.logout:hover { + text-decoration: none; +} + +.nav > li > form > button.logout:focus { + outline: none; +} diff --git a/api/web/favicon.ico b/api/web/favicon.ico new file mode 100644 index 0000000..580ed73 Binary files /dev/null and b/api/web/favicon.ico differ diff --git a/backend/views/layouts/sidebar.php b/backend/views/layouts/sidebar.php index 828322f..a975ac1 100644 --- a/backend/views/layouts/sidebar.php +++ b/backend/views/layouts/sidebar.php @@ -15,22 +15,21 @@ use iron\widgets\Menu; echo Menu::widget([ 'items' => [ // ['label' => 'MAIN NAVIGATION', 'is_header' => true], - ['label' => '商城管理', 'url' => '#', 'icon' => 'far fa-store', 'items' => [ - ['label' => '运营数据', 'url' => ['site/index', 'tag' => 'new']], - ['label' => '基础配置', 'url' => ['config/index', 'tag' => 'new']], + ['label' => '商城管理', 'url' => '#', 'icon' => 'fa-store', 'items' => [ + ['label' => '运营数据', 'url' => ['site/index']], + ['label' => '基础配置', 'url' => ['config/index']], ] ], - ['label' => '商品管理', 'url' => '#', 'icon' => 'far fa-archive', 'items' => [ - ['label' => '商品分类', 'url' => ['category/index', 'tag' => 'new']], - ['label' => '商品列表', 'url' => ['goods/index']], - ['label' => '属性管理', 'url' => ['attribute/index']], + ['label' => '商品管理', 'url' => '#', 'icon' => 'fa-archive', 'items' => [ + ['label' => '商品分类', 'url' => ['/category']], + ['label' => '商品列表', 'url' => ['/goods']], + ['label' => '属性管理', 'url' => ['/attribute']], ] ], - ['label' => '订单管理', 'url' => '#', 'icon' => 'far fa-list-alt', 'items' => [ - ['label' => '订单列表', 'url' => ['order/index', 'tag' => 'new']], + ['label' => '订单管理', 'url' => '#', 'icon' => 'fa-list-alt', 'items' => [ + ['label' => '订单列表', 'url' => ['order/index']], ] ], - ] ]); ?> diff --git a/common/config/bootstrap.php b/common/config/bootstrap.php index 4102199..b8d4302 100755 --- a/common/config/bootstrap.php +++ b/common/config/bootstrap.php @@ -2,3 +2,4 @@ Yii::setAlias('@common', dirname(__DIR__)); Yii::setAlias('@console', dirname(dirname(__DIR__)) . '/console'); Yii::setAlias('@backend', dirname(dirname(__DIR__)) . '/backend'); +Yii::setAlias('@api', dirname(dirname(__DIR__)) . '/api'); diff --git a/datadictionary.md b/datadictionary.md deleted file mode 100644 index e69de29..0000000