Browse Source

合并新内容

antshop
linyaostalker 5 years ago
parent
commit
f94055a8e4
  1. 26
      api/assets/AppAsset.php
  2. 4
      api/config/.gitignore
  3. 1
      api/config/bootstrap.php
  4. 51
      api/config/main.php
  5. 3
      api/config/params.php
  6. 22
      api/controllers/SiteController.php
  7. 59
      api/controllers/TestController.php
  8. 2
      api/runtime/.gitignore
  9. 27
      api/views/site/error.php
  10. 5
      api/web/.gitignore
  11. 2
      api/web/assets/.gitignore
  12. 120
      api/web/css/site.css
  13. BIN
      api/web/favicon.ico
  14. BIN
      backend/web/uploads/xls/15738696921690.jpg
  15. 0
      datadictionary.md
  16. 10
      vendor/iron/grid/GridView.php
  17. 33
      vendor/iron/widgets/Menu.php

26
api/assets/AppAsset.php

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

4
api/config/.gitignore

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

1
api/config/bootstrap.php

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

51
api/config/main.php

@ -0,0 +1,51 @@
<?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' => '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,
];

3
api/config/params.php

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

22
api/controllers/SiteController.php

@ -0,0 +1,22 @@
<?php
namespace api\controllers;
use yii\web\Controller;
/**
* Created by PhpStorm.
* User: iron
* Date: 2018/5/25
* Time: 16:42
*/
class SiteController extends Controller
{
public function actions() {
return [
'error' => [
'class' => 'yii\web\ErrorAction',
],
];
}
}

59
api/controllers/TestController.php

@ -0,0 +1,59 @@
<?php
/*
* The MIT License
*
* Copyright 2019 Blobt.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
namespace api\controllers;
/**
* @author iron
* @email weiriron@gmail.com
*/
use common\models\ars\Goods;
use common\models\searchs\GoodsSearch;
use yii\data\ActiveDataProvider;
use yii\db\ActiveRecord;
use yii\rest\ActiveController;
use yii\web\NotFoundHttpException;
class TestController extends ActiveController
{
public $modelClass = 'common\models\ars\Goods';
public function actions()
{
$action = parent::actions();
unset($action['index']);
return$action;
}
public function actionIndex()
{
return new ActiveDataProvider([
'query' => Goods::find(),
'pagination' => [
'pageSize' => 1,
],
]);
}
}

2
api/runtime/.gitignore

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

27
api/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>

5
api/web/.gitignore

@ -0,0 +1,5 @@
/index.php
/index-test.php
/robots.txt
uploads

2
api/web/assets/.gitignore

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

120
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;
}

BIN
api/web/favicon.ico

BIN
backend/web/uploads/xls/15738696921690.jpg

Before

Width: 1024  |  Height: 759  |  Size: 159 KiB

0
datadictionary.md

10
vendor/iron/grid/GridView.php

@ -219,6 +219,7 @@ class GridView extends BaseListView
<div class="row">
<div class="col-sm-12 col-md-6">
{batch}
{create}
<!-- <a href="#" data-url='export' class="export btn btn-default"><i class="fa fa-file-excel-o"></i>导出</a>-->
{export}
@ -262,13 +263,14 @@ HTML;
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><i class="fas fa-file-upload mr-2"></i>导出</button>
<ul class="dropdown-menu" role="menu">
<li> <a class="dropdown-item export-page" href="#" data-url="export">本页</a></li>
<li> <a class="dropdown-item export-all" href="#" data-url="export">全部</a></li>
<li> <a class="dropdown-item export-page" href="#" data-url="{url}/export">本页</a></li>
<li> <a class="dropdown-item export-all" href="#" data-url="{url}/export">全部</a></li>
</ul>
</div>
HTML;
public $create =<<<HTML
<a href="create" class="btn btn-default"><i class="fas fa-plus-square mr-2"></i>添加</a>
<a href="{url}/create" class="btn btn-default"><i class="fas fa-plus-square mr-2"></i>添加</a>
HTML;
/**
* @var
@ -459,6 +461,8 @@ SCRIPT;
return $this->renderFilter();
case '{batch}':
return $this->renderBatch();
case '{url}':
return Yii::$app->request->url;
case '{export}':
return $this->renderExport();
case '{create}':

33
vendor/iron/widgets/Menu.php

@ -53,7 +53,8 @@ use yii\helpers\Url;
*
*
*/
class Menu extends Widget {
class Menu extends Widget
{
/**
* @var array 菜单的item数组。
@ -164,7 +165,8 @@ class Menu extends Widget {
/**
* 渲染菜单
*/
public function run() {
public function run()
{
if ($this->route === null && Yii::$app->controller !== null) {
$this->route = Yii::$app->controller->getRoute();
}
@ -186,7 +188,8 @@ class Menu extends Widget {
* @param array $items
* @return string 渲染结果
*/
protected function renderItems($items) {
protected function renderItems($items)
{
$lines = [];
$n = count($items);
foreach ($items as $i => $item) {
@ -234,7 +237,8 @@ class Menu extends Widget {
* @param array $item
* @return string 渲染结果
*/
protected function renderItem($item) {
protected function renderItem($item)
{
if (isset($item['url'])) {
if (isset($item['template'])) {
$template = $item['template'];
@ -262,21 +266,31 @@ class Menu extends Widget {
* @param $item array
* @return boolean $item
*/
protected function isItemActive($item) {
protected function isItemActive($item)
{
if (isset($item['url']) && is_array($item['url']) && isset($item['url'][0])) {
$route = Yii::getAlias($item['url'][0]);
if ($route[0] !== '/' && Yii::$app->controller) {
$route = Yii::$app->controller->module->getUniqueId() . '/' . $route;
}
if (ltrim($route, '/') !== $this->route) {
$route = ltrim($route, '/');
if ($route != substr($this->route, 0, strrpos($this->route, '/')) && $route != $this->route &&
ltrim(Yii::$app->request->url, '/') !== $route) {
return false;
}
unset($item['url']['#']);
if (count($item['url']) > 1) {
foreach (array_splice($item['url'], 1) as $name => $value) {
if ($value !== null && (!isset($this->params[$name]) || $this->params[$name] != $value)) {
return false;
}
}
}
return true;
}
return false;
}
@ -285,7 +299,8 @@ class Menu extends Widget {
* @param string $item
* @param bool $active
*/
protected function normalizeItems($items, &$active) {
protected function normalizeItems($items, &$active)
{
foreach ($items as $i => $item) {
/* 去除visible 为 false的item */
if (isset($item['visible']) && !$item['visible']) {

Loading…
Cancel
Save