linyaostalker
5 years ago
62 changed files with 0 additions and 1244 deletions
-
0backend/controllers/AttributeController.php
-
0backend/controllers/BrandController.php
-
149backend/controllers/CategoryController.php
-
0backend/controllers/ConfigController.php
-
0backend/controllers/OrderController.php
-
149backend/controllers/ShopCategoryController.php
-
0backend/controllers/SiteController.php
-
0backend/controllers/SupplierController.php
-
0backend/views/attribute/_form.php
-
0backend/views/attribute/_search.php
-
0backend/views/attribute/create.php
-
0backend/views/attribute/index.php
-
0backend/views/attribute/update.php
-
0backend/views/attribute/view.php
-
0backend/views/brand/_form.php
-
0backend/views/brand/_search.php
-
0backend/views/brand/create.php
-
0backend/views/brand/index.php
-
0backend/views/brand/update.php
-
0backend/views/brand/view.php
-
38backend/views/category/_form.php
-
49backend/views/category/_search.php
-
18backend/views/category/create.php
-
28backend/views/category/index.php
-
98backend/views/category/test.php
-
19backend/views/category/update.php
-
37backend/views/category/view.php
-
0backend/views/config/index.php
-
0backend/views/layouts/base.php
-
0backend/views/layouts/breadcrumb.php
-
0backend/views/layouts/footer.php
-
0backend/views/layouts/header.php
-
0backend/views/layouts/main.php
-
2backend/views/layouts/sidebar.php
-
0backend/views/order/_form.php
-
0backend/views/order/_search.php
-
0backend/views/order/create.php
-
0backend/views/order/index.php
-
0backend/views/order/update.php
-
0backend/views/order/view.php
-
44backend/views/shop-category/_form.php
-
49backend/views/shop-category/_search.php
-
18backend/views/shop-category/create.php
-
28backend/views/shop-category/index.php
-
19backend/views/shop-category/update.php
-
40backend/views/shop-category/view.php
-
0backend/views/site/error.php
-
0backend/views/site/index.php
-
0backend/views/site/login.php
-
0backend/views/site/test.php
-
0backend/views/supplier/_form.php
-
0backend/views/supplier/_search.php
-
0backend/views/supplier/create.php
-
0backend/views/supplier/index.php
-
0backend/views/supplier/update.php
-
0backend/views/supplier/view.php
-
147common/models/searchs/AttributeSearch.php
-
0common/models/searchs/BrandSearch.php
-
153common/models/searchs/CategorySearch.php
-
0common/models/searchs/OrderSearch.php
-
159common/models/searchs/ShopCategorySearch.php
-
0common/models/searchs/SupplierSearch.php
@ -1,149 +0,0 @@ |
|||
<?php |
|||
|
|||
namespace backend\controllers; |
|||
|
|||
use Yii; |
|||
use common\models\ars\Category; |
|||
use common\models\searchs\CategorySearch; |
|||
use yii\web\Controller; |
|||
use yii\web\NotFoundHttpException; |
|||
use yii\filters\VerbFilter; |
|||
|
|||
/** |
|||
* CategoryController implements the CRUD actions for Category model. |
|||
*/ |
|||
class CategoryController extends Controller |
|||
{ |
|||
/** |
|||
* {@inheritdoc} |
|||
*/ |
|||
public function behaviors() |
|||
{ |
|||
return [ |
|||
'verbs' => [ |
|||
'class' => VerbFilter::className(), |
|||
'actions' => [ |
|||
'delete' => ['POST'], |
|||
], |
|||
], |
|||
]; |
|||
} |
|||
|
|||
/** |
|||
* Lists all Category models. |
|||
* @return mixed |
|||
*/ |
|||
public function actionIndex() |
|||
{ |
|||
$searchModel = new CategorySearch(); |
|||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams); |
|||
|
|||
return $this->render('index', [ |
|||
'searchModel' => $searchModel, |
|||
'dataProvider' => $dataProvider, |
|||
'columns' => $searchModel->columns() |
|||
]); |
|||
} |
|||
|
|||
/** |
|||
* Displays a single Category model. |
|||
* @param integer $id |
|||
* @return mixed |
|||
* @throws NotFoundHttpException if the model cannot be found |
|||
*/ |
|||
public function actionView($id) |
|||
{ |
|||
return $this->render('view', [ |
|||
'model' => $this->findModel($id), |
|||
]); |
|||
} |
|||
|
|||
/** |
|||
* Creates a new Category model. |
|||
* If creation is successful, the browser will be redirected to the 'view' page. |
|||
* @return mixed |
|||
*/ |
|||
public function actionCreate() |
|||
{ |
|||
$model = new Category(); |
|||
|
|||
if ($model->load(Yii::$app->request->post()) && $model->save()) { |
|||
return $this->redirect('index'); |
|||
} |
|||
|
|||
return $this->render('create', [ |
|||
'model' => $model, |
|||
]); |
|||
} |
|||
|
|||
/** |
|||
* Updates an existing Category model. |
|||
* If update is successful, the browser will be redirected to the 'view' page. |
|||
* @param integer $id |
|||
* @return mixed |
|||
* @throws NotFoundHttpException if the model cannot be found |
|||
*/ |
|||
public function actionUpdate($id) |
|||
{ |
|||
$model = $this->findModel($id); |
|||
|
|||
if ($model->load(Yii::$app->request->post()) && $model->save()) { |
|||
return $this->redirect('index'); |
|||
} |
|||
|
|||
return $this->render('update', [ |
|||
'model' => $model, |
|||
]); |
|||
} |
|||
|
|||
/** |
|||
* Deletes an existing Category model. |
|||
* If deletion is successful, the browser will be redirected to the 'index' page. |
|||
* @param integer $id |
|||
* @return mixed |
|||
* @throws NotFoundHttpException if the model cannot be found |
|||
*/ |
|||
public function actionDelete($id) |
|||
{ |
|||
$this->findModel($id)->delete(); |
|||
|
|||
return $this->redirect(['index']); |
|||
} |
|||
|
|||
/** |
|||
* Finds the Category model based on its primary key value. |
|||
* If the model is not found, a 404 HTTP exception will be thrown. |
|||
* @param integer $id |
|||
* @return Category the loaded model |
|||
* @throws NotFoundHttpException if the model cannot be found |
|||
*/ |
|||
protected function findModel($id) |
|||
{ |
|||
if (($model = Category::findOne($id)) !== null) { |
|||
return $model; |
|||
} |
|||
|
|||
throw new NotFoundHttpException('The requested page does not exist.'); |
|||
} |
|||
/** |
|||
* @author iron |
|||
* 文件导出 |
|||
*/ |
|||
public function actionExport() |
|||
{ |
|||
$searchModel = new CategorySearch(); |
|||
$params = Yii::$app->request->queryParams; |
|||
if ($params['page-type'] == 'all') { |
|||
$dataProvider = $searchModel->allData($params); |
|||
} else { |
|||
$dataProvider = $searchModel->search($params); |
|||
} |
|||
\iron\widget\Excel::export([ |
|||
'models' => $dataProvider->getModels(), |
|||
'format' => 'Xlsx', |
|||
'asAttachment' => true, |
|||
'fileName' =>'Categories'. "-" .date('Y-m-d H/i/s', time()), |
|||
'columns' => $searchModel->columns() |
|||
]); |
|||
} |
|||
} |
@ -1,149 +0,0 @@ |
|||
<?php |
|||
|
|||
namespace backend\controllers; |
|||
|
|||
use Yii; |
|||
use common\models\ars\ShopCategory; |
|||
use common\models\searchs\ShopCategorySearch; |
|||
use yii\web\Controller; |
|||
use yii\web\NotFoundHttpException; |
|||
use yii\filters\VerbFilter; |
|||
|
|||
/** |
|||
* ShopCategoryController implements the CRUD actions for ShopCategory model. |
|||
*/ |
|||
class ShopCategoryController extends Controller |
|||
{ |
|||
/** |
|||
* {@inheritdoc} |
|||
*/ |
|||
public function behaviors() |
|||
{ |
|||
return [ |
|||
'verbs' => [ |
|||
'class' => VerbFilter::className(), |
|||
'actions' => [ |
|||
'delete' => ['POST'], |
|||
], |
|||
], |
|||
]; |
|||
} |
|||
|
|||
/** |
|||
* Lists all ShopCategory models. |
|||
* @return mixed |
|||
*/ |
|||
public function actionIndex() |
|||
{ |
|||
$searchModel = new ShopCategorySearch(); |
|||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams); |
|||
|
|||
return $this->render('index', [ |
|||
'searchModel' => $searchModel, |
|||
'dataProvider' => $dataProvider, |
|||
'columns' => $searchModel->columns() |
|||
]); |
|||
} |
|||
|
|||
/** |
|||
* Displays a single ShopCategory model. |
|||
* @param integer $id |
|||
* @return mixed |
|||
* @throws NotFoundHttpException if the model cannot be found |
|||
*/ |
|||
public function actionView($id) |
|||
{ |
|||
return $this->render('view', [ |
|||
'model' => $this->findModel($id), |
|||
]); |
|||
} |
|||
|
|||
/** |
|||
* Creates a new ShopCategory model. |
|||
* If creation is successful, the browser will be redirected to the 'view' page. |
|||
* @return mixed |
|||
*/ |
|||
public function actionCreate() |
|||
{ |
|||
$model = new ShopCategory(); |
|||
|
|||
if ($model->load(Yii::$app->request->post()) && $model->save()) { |
|||
return $this->redirect('index'); |
|||
} |
|||
|
|||
return $this->render('create', [ |
|||
'model' => $model, |
|||
]); |
|||
} |
|||
|
|||
/** |
|||
* Updates an existing ShopCategory model. |
|||
* If update is successful, the browser will be redirected to the 'view' page. |
|||
* @param integer $id |
|||
* @return mixed |
|||
* @throws NotFoundHttpException if the model cannot be found |
|||
*/ |
|||
public function actionUpdate($id) |
|||
{ |
|||
$model = $this->findModel($id); |
|||
|
|||
if ($model->load(Yii::$app->request->post()) && $model->save()) { |
|||
return $this->redirect('index'); |
|||
} |
|||
|
|||
return $this->render('update', [ |
|||
'model' => $model, |
|||
]); |
|||
} |
|||
|
|||
/** |
|||
* Deletes an existing ShopCategory model. |
|||
* If deletion is successful, the browser will be redirected to the 'index' page. |
|||
* @param integer $id |
|||
* @return mixed |
|||
* @throws NotFoundHttpException if the model cannot be found |
|||
*/ |
|||
public function actionDelete($id) |
|||
{ |
|||
$this->findModel($id)->delete(); |
|||
|
|||
return $this->redirect(['index']); |
|||
} |
|||
|
|||
/** |
|||
* Finds the ShopCategory model based on its primary key value. |
|||
* If the model is not found, a 404 HTTP exception will be thrown. |
|||
* @param integer $id |
|||
* @return ShopCategory the loaded model |
|||
* @throws NotFoundHttpException if the model cannot be found |
|||
*/ |
|||
protected function findModel($id) |
|||
{ |
|||
if (($model = ShopCategory::findOne($id)) !== null) { |
|||
return $model; |
|||
} |
|||
|
|||
throw new NotFoundHttpException('The requested page does not exist.'); |
|||
} |
|||
/** |
|||
* @author iron |
|||
* 文件导出 |
|||
*/ |
|||
public function actionExport() |
|||
{ |
|||
$searchModel = new ShopCategorySearch(); |
|||
$params = Yii::$app->request->queryParams; |
|||
if ($params['page-type'] == 'all') { |
|||
$dataProvider = $searchModel->allData($params); |
|||
} else { |
|||
$dataProvider = $searchModel->search($params); |
|||
} |
|||
\iron\widget\Excel::export([ |
|||
'models' => $dataProvider->getModels(), |
|||
'format' => 'Xlsx', |
|||
'asAttachment' => true, |
|||
'fileName' =>'Shop Categories'. "-" .date('Y-m-d H/i/s', time()), |
|||
'columns' => $searchModel->columns() |
|||
]); |
|||
} |
|||
} |
@ -1,38 +0,0 @@ |
|||
<?php |
|||
|
|||
use yii\helpers\Html; |
|||
use yii\widgets\ActiveForm; |
|||
|
|||
/* @var $this yii\web\View */ |
|||
/* @var $model common\models\ars\Category */ |
|||
/* @var $form yii\widgets\ActiveForm */ |
|||
?>
|
|||
|
|||
<div class="category-form"> |
|||
|
|||
<?php $form = ActiveForm::begin(); ?>
|
|||
|
|||
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
|||
|
|||
<?= $form->field($model, 'pid')->textInput() ?>
|
|||
|
|||
<?= $form->field($model, 'goods_count')->textInput() ?>
|
|||
|
|||
<?= $form->field($model, 'sort_order')->textInput() ?>
|
|||
|
|||
<?= $form->field($model, 'icon_type')->textInput() ?>
|
|||
|
|||
<?= $form->field($model, 'icon')->textInput(['maxlength' => true]) ?>
|
|||
|
|||
<?= $form->field($model, 'is_show')->textInput() ?>
|
|||
|
|||
<?= $form->field($model, 'is_delete')->textInput() ?>
|
|||
|
|||
<div class="form-group"> |
|||
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
|
|||
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
|
|||
</div> |
|||
|
|||
<?php ActiveForm::end(); ?>
|
|||
|
|||
</div> |
@ -1,49 +0,0 @@ |
|||
<?php |
|||
|
|||
use yii\helpers\Html; |
|||
use yii\widgets\ActiveForm; |
|||
use \blobt\widgets\DateRangePicker; |
|||
|
|||
/* @var $this yii\web\View */ |
|||
/* @var $model common\models\searchs\CategorySearch */ |
|||
/* @var $form yii\widgets\ActiveForm */ |
|||
?>
|
|||
|
|||
<?php $form = ActiveForm::begin([ |
|||
'action' => ['index'], |
|||
'method' => 'get', |
|||
'validateOnType' => true, |
|||
]); |
|||
?>
|
|||
<div class="row"> |
|||
<div class="col"> |
|||
<?= $form->field($model, 'id', [ |
|||
"template" => "{input}{error}", |
|||
"inputOptions" => [ |
|||
"placeholder" => "检索ID", |
|||
"class" => "form-control", |
|||
], |
|||
"errorOptions" => [ |
|||
"class" => "error-tips" |
|||
] |
|||
]) |
|||
?>
|
|||
</div> |
|||
<div class="col"> |
|||
<?= $form->field($model, "created_at_range", [ |
|||
"template" => "{input}{error}", |
|||
"inputOptions" => [ |
|||
"placeholder" => "创建时间", |
|||
], |
|||
"errorOptions" => [ |
|||
"class" => "error-tips" |
|||
] |
|||
])->widget(DateRangePicker::className()); |
|||
?>
|
|||
</div> |
|||
<div class="form-group"> |
|||
<?= Html::submitButton('<i class="fa fa-filter"></i>', ['class' => 'btn btn-default']) ?>
|
|||
<?= Html::resetButton('<i class="fa fa-eraser"></i>', ['class' => 'btn btn-default']) ?>
|
|||
</div> |
|||
</div> |
|||
<?php ActiveForm::end(); ?>
|
@ -1,18 +0,0 @@ |
|||
<?php |
|||
|
|||
use yii\helpers\Html; |
|||
|
|||
/* @var $this yii\web\View */ |
|||
/* @var $model common\models\ars\Category */ |
|||
|
|||
$this->title = '创建 Category'; |
|||
$this->params['breadcrumbs'][] = ['label' => 'Categories', 'url' => ['index']]; |
|||
$this->params['breadcrumbs'][] = $this->title; |
|||
?>
|
|||
<div class="category-create"> |
|||
|
|||
<?= $this->render('_form', [ |
|||
'model' => $model, |
|||
]) ?>
|
|||
|
|||
</div> |
@ -1,28 +0,0 @@ |
|||
<?php |
|||
|
|||
use yii\helpers\Html; |
|||
use iron\grid\GridView; |
|||
|
|||
/* @var $this yii\web\View */ |
|||
/* @var $searchModel common\models\searchs\CategorySearch */ |
|||
/* @var $dataProvider yii\data\ActiveDataProvider */ |
|||
|
|||
$this->title = 'Categories'; |
|||
$this->params['breadcrumbs'][] = $this->title; |
|||
?>
|
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<?= GridView::widget([ |
|||
'dataProvider' => $dataProvider, |
|||
'filter' => $this->render("_search", ['model' => $searchModel]), |
|||
'batch' => [ |
|||
[ |
|||
"label" => "删除", |
|||
"url" => "category/deletes" |
|||
], |
|||
], |
|||
'columns' => $columns |
|||
]); |
|||
?>
|
|||
</div> |
|||
</div> |
@ -1,98 +0,0 @@ |
|||
<?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. |
|||
*/ |
|||
?>
|
|||
|
|||
<header> |
|||
<link href="http://hayageek.github.io/jQuery-Upload-File/4.0.11/uploadfile.css" rel="stylesheet"> |
|||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
|||
<script src="http://hayageek.github.io/jQuery-Upload-File/4.0.11/jquery.uploadfile.min.js"></script> |
|||
</header> |
|||
<body> |
|||
<div id="showoldupload"> |
|||
<div class="ajax-upload-dragdrop" style="vertical-align: top; width: 600px;"> |
|||
<div class="ajax-file-upload" style="position: relative; overflow: hidden; cursor: default;">Upload |
|||
<form method="POST" action="upload.php" enctype="multipart/form-data" style="margin: 0px; padding: 0px;"> |
|||
<input type="file" id="ajax-upload-id-1573635462220" name="myfile[]" accept="*" multiple="" |
|||
style="position: absolute; cursor: pointer; top: 0px; width: 100%; height: 100%; left: 0px; z-index: 100; opacity: 0;"> |
|||
</form> |
|||
</div> |
|||
<span><b>Drag & Drop Files</b></span></div> |
|||
<div></div> |
|||
</div> |
|||
<div class="ajax-file-upload-container"></div> |
|||
</body> |
|||
<script> |
|||
$("#showoldupload").uploadFile( |
|||
{ |
|||
url: "upload", |
|||
dragDrop: true, |
|||
fileName: "file", |
|||
returnType: "json", |
|||
showDelete: true, |
|||
showDownload: false, |
|||
statusBarWidth: 300, |
|||
dragdropWidth: 300, |
|||
maxFileSize: 200 * 1024, |
|||
dragDropStr: "<span><b>拖动上传</b></span>", |
|||
sizeErrorStr: "图片超过最大尺寸限制", |
|||
uploadErrorStr: "上传失败", |
|||
showPreview: true, |
|||
previewHeight: "60px", |
|||
previewWidth: "60px", |
|||
onSuccess: function (files, data) { |
|||
$.ajax({ |
|||
url: "save-database", |
|||
dataType: "json", |
|||
data: {data: data, fileName: files}, |
|||
}); |
|||
}, |
|||
onLoad: function (obj) { |
|||
$.ajax({ |
|||
cache: false, |
|||
url: "previews", |
|||
dataType: "json", |
|||
success: function (data) { |
|||
for (var i = 0; i < data.length; i++) { |
|||
obj.createProgress(data[i]["name"], data[i]["path"], data[i]["size"]); |
|||
} |
|||
} |
|||
}); |
|||
}, |
|||
deleteCallback: function (data, pd) { |
|||
for (var i = 0; i < data.length; i++) { |
|||
// alertify.confirm('系统提示', "确定执行批量 '"+act+"' 操作?", function() {
|
|||
$.post("image-del", {op: "delete", name: data[i]}, |
|||
function (resp, textStatus, jqXHR) { |
|||
//Show Message
|
|||
alert("File Deleted"); |
|||
}); |
|||
// },function(){
|
|||
// });
|
|||
} |
|||
pd.statusbar.hide(); //You choice.
|
|||
}, |
|||
|
|||
}); |
|||
</script> |
@ -1,19 +0,0 @@ |
|||
<?php |
|||
|
|||
use yii\helpers\Html; |
|||
|
|||
/* @var $this yii\web\View */ |
|||
/* @var $model common\models\ars\Category */ |
|||
|
|||
$this->title = '编辑 Category: ' . $model->name; |
|||
$this->params['breadcrumbs'][] = ['label' => 'Categories', 'url' => ['index']]; |
|||
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; |
|||
$this->params['breadcrumbs'][] = 'Update '; |
|||
?>
|
|||
<div class="category-update"> |
|||
|
|||
<?= $this->render('_form', [ |
|||
'model' => $model, |
|||
]) ?>
|
|||
|
|||
</div> |
@ -1,37 +0,0 @@ |
|||
<?php |
|||
|
|||
use yii\helpers\Html; |
|||
use yii\widgets\DetailView; |
|||
|
|||
/* @var $this yii\web\View */ |
|||
/* @var $model common\models\ars\Category */ |
|||
|
|||
$this->title = $model->name; |
|||
$this->params['breadcrumbs'][] = ['label' => 'Categories', 'url' => ['index']]; |
|||
$this->params['breadcrumbs'][] = $this->title; |
|||
\yii\web\YiiAsset::register($this); |
|||
?>
|
|||
<div class="category-view"> |
|||
|
|||
<p> |
|||
<?= Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?>
|
|||
</p> |
|||
|
|||
<?= DetailView::widget([ |
|||
'model' => $model, |
|||
'attributes' => [ |
|||
'id', |
|||
'name', |
|||
'pid', |
|||
'goods_count', |
|||
'sort_order', |
|||
'icon_type', |
|||
'icon', |
|||
'is_show', |
|||
'is_delete', |
|||
'created_at', |
|||
'updated_at', |
|||
], |
|||
]) ?>
|
|||
|
|||
</div> |
@ -1,44 +0,0 @@ |
|||
<?php |
|||
|
|||
use yii\helpers\Html; |
|||
use yii\widgets\ActiveForm; |
|||
|
|||
/* @var $this yii\web\View */ |
|||
/* @var $model common\models\ars\ShopCategory */ |
|||
/* @var $form yii\widgets\ActiveForm */ |
|||
?>
|
|||
|
|||
<div class="shop-category-form"> |
|||
|
|||
<?php $form = ActiveForm::begin(); ?>
|
|||
|
|||
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
|||
|
|||
<?= $form->field($model, 'pid')->textInput() ?>
|
|||
|
|||
<?= $form->field($model, 'goods_count')->textInput() ?>
|
|||
|
|||
<?= $form->field($model, 'keywords')->textInput(['maxlength' => true]) ?>
|
|||
|
|||
<?= $form->field($model, 'desc')->textInput(['maxlength' => true]) ?>
|
|||
|
|||
<?= $form->field($model, 'sort_order')->textInput() ?>
|
|||
|
|||
<?= $form->field($model, 'icon_type')->textInput() ?>
|
|||
|
|||
<?= $form->field($model, 'icon')->textInput(['maxlength' => true]) ?>
|
|||
|
|||
<?= $form->field($model, 'filter_attr')->textarea(['rows' => 6]) ?>
|
|||
|
|||
<?= $form->field($model, 'is_show')->textInput() ?>
|
|||
|
|||
<?= $form->field($model, 'is_delete')->textInput() ?>
|
|||
|
|||
<div class="form-group"> |
|||
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
|
|||
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
|
|||
</div> |
|||
|
|||
<?php ActiveForm::end(); ?>
|
|||
|
|||
</div> |
@ -1,49 +0,0 @@ |
|||
<?php |
|||
|
|||
use yii\helpers\Html; |
|||
use yii\widgets\ActiveForm; |
|||
use \blobt\widgets\DateRangePicker; |
|||
|
|||
/* @var $this yii\web\View */ |
|||
/* @var $model common\models\searchs\ShopCategorySearch */ |
|||
/* @var $form yii\widgets\ActiveForm */ |
|||
?>
|
|||
|
|||
<?php $form = ActiveForm::begin([ |
|||
'action' => ['index'], |
|||
'method' => 'get', |
|||
'validateOnType' => true, |
|||
]); |
|||
?>
|
|||
<div class="row"> |
|||
<div class="col"> |
|||
<?= $form->field($model, 'id', [ |
|||
"template" => "{input}{error}", |
|||
"inputOptions" => [ |
|||
"placeholder" => "检索ID", |
|||
"class" => "form-control", |
|||
], |
|||
"errorOptions" => [ |
|||
"class" => "error-tips" |
|||
] |
|||
]) |
|||
?>
|
|||
</div> |
|||
<div class="col"> |
|||
<?= $form->field($model, "created_at_range", [ |
|||
"template" => "{input}{error}", |
|||
"inputOptions" => [ |
|||
"placeholder" => "创建时间", |
|||
], |
|||
"errorOptions" => [ |
|||
"class" => "error-tips" |
|||
] |
|||
])->widget(DateRangePicker::className()); |
|||
?>
|
|||
</div> |
|||
<div class="form-group"> |
|||
<?= Html::submitButton('<i class="fa fa-filter"></i>', ['class' => 'btn btn-default']) ?>
|
|||
<?= Html::resetButton('<i class="fa fa-eraser"></i>', ['class' => 'btn btn-default']) ?>
|
|||
</div> |
|||
</div> |
|||
<?php ActiveForm::end(); ?>
|
@ -1,18 +0,0 @@ |
|||
<?php |
|||
|
|||
use yii\helpers\Html; |
|||
|
|||
/* @var $this yii\web\View */ |
|||
/* @var $model common\models\ars\ShopCategory */ |
|||
|
|||
$this->title = '创建 Shop Category'; |
|||
$this->params['breadcrumbs'][] = ['label' => 'Shop Categories', 'url' => ['index']]; |
|||
$this->params['breadcrumbs'][] = $this->title; |
|||
?>
|
|||
<div class="shop-category-create"> |
|||
|
|||
<?= $this->render('_form', [ |
|||
'model' => $model, |
|||
]) ?>
|
|||
|
|||
</div> |
@ -1,28 +0,0 @@ |
|||
<?php |
|||
|
|||
use yii\helpers\Html; |
|||
use iron\grid\GridView; |
|||
|
|||
/* @var $this yii\web\View */ |
|||
/* @var $searchModel common\models\searchs\ShopCategorySearch */ |
|||
/* @var $dataProvider yii\data\ActiveDataProvider */ |
|||
|
|||
$this->title = 'Shop Categories'; |
|||
$this->params['breadcrumbs'][] = $this->title; |
|||
?>
|
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<?= GridView::widget([ |
|||
'dataProvider' => $dataProvider, |
|||
'filter' => $this->render("_search", ['model' => $searchModel]), |
|||
'batch' => [ |
|||
[ |
|||
"label" => "删除", |
|||
"url" => "shop-category/deletes" |
|||
], |
|||
], |
|||
'columns' => $columns |
|||
]); |
|||
?>
|
|||
</div> |
|||
</div> |
@ -1,19 +0,0 @@ |
|||
<?php |
|||
|
|||
use yii\helpers\Html; |
|||
|
|||
/* @var $this yii\web\View */ |
|||
/* @var $model common\models\ars\ShopCategory */ |
|||
|
|||
$this->title = '编辑 Shop Category: ' . $model->name; |
|||
$this->params['breadcrumbs'][] = ['label' => 'Shop Categories', 'url' => ['index']]; |
|||
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; |
|||
$this->params['breadcrumbs'][] = 'Update '; |
|||
?>
|
|||
<div class="shop-category-update"> |
|||
|
|||
<?= $this->render('_form', [ |
|||
'model' => $model, |
|||
]) ?>
|
|||
|
|||
</div> |
@ -1,40 +0,0 @@ |
|||
<?php |
|||
|
|||
use yii\helpers\Html; |
|||
use yii\widgets\DetailView; |
|||
|
|||
/* @var $this yii\web\View */ |
|||
/* @var $model common\models\ars\ShopCategory */ |
|||
|
|||
$this->title = $model->name; |
|||
$this->params['breadcrumbs'][] = ['label' => 'Shop Categories', 'url' => ['index']]; |
|||
$this->params['breadcrumbs'][] = $this->title; |
|||
\yii\web\YiiAsset::register($this); |
|||
?>
|
|||
<div class="shop-category-view"> |
|||
|
|||
<p> |
|||
<?= Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?>
|
|||
</p> |
|||
|
|||
<?= DetailView::widget([ |
|||
'model' => $model, |
|||
'attributes' => [ |
|||
'id', |
|||
'name', |
|||
'pid', |
|||
'goods_count', |
|||
'keywords', |
|||
'desc', |
|||
'sort_order', |
|||
'icon_type', |
|||
'icon', |
|||
'filter_attr:ntext', |
|||
'is_show', |
|||
'is_delete', |
|||
'created_at', |
|||
'updated_at', |
|||
], |
|||
]) ?>
|
|||
|
|||
</div> |
@ -1,147 +0,0 @@ |
|||
<?php |
|||
|
|||
namespace common\models\searchs; |
|||
|
|||
use yii\base\Model; |
|||
use yii\data\ActiveDataProvider; |
|||
use yii\helpers\ArrayHelper; |
|||
use common\models\ars\Attribute; |
|||
|
|||
/** |
|||
* attributeSearch represents the model behind the search form of `common\models\ars\Attribute`. |
|||
*/ |
|||
class attributeSearch extends Attribute |
|||
{ |
|||
/** |
|||
* @return array |
|||
* 增加创建时间查询字段 |
|||
*/ |
|||
public function attributes() |
|||
{ |
|||
return ArrayHelper::merge(['created_at_range'], parent::attributes()); |
|||
} |
|||
/** |
|||
* {@inheritdoc} |
|||
*/ |
|||
public function rules() |
|||
{ |
|||
return [ |
|||
[['id', 'type', 'sort_order', 'is_delete', 'created_at', 'updated_at'], 'integer'], |
|||
[['name', 'value'], 'safe'], |
|||
['created_at_range','safe'], |
|||
]; |
|||
} |
|||
|
|||
/** |
|||
* {@inheritdoc} |
|||
*/ |
|||
public function scenarios() |
|||
{ |
|||
// bypass scenarios() implementation in the parent class
|
|||
return Model::scenarios(); |
|||
} |
|||
/** |
|||
* @return array |
|||
* 列格式 |
|||
*/ |
|||
public function columns() |
|||
{ |
|||
return [ |
|||
[ |
|||
'class' => 'blobt\grid\CheckboxColumn', |
|||
'width' => '2%', |
|||
'align' => 'center' |
|||
], |
|||
'id', |
|||
'name', |
|||
'value', |
|||
'type', |
|||
'sort_order', |
|||
//'is_delete',
|
|||
//'created_at',
|
|||
//'updated_at',
|
|||
[ |
|||
'class' => 'iron\grid\ActionColumn', |
|||
'align' => 'center', |
|||
], |
|||
]; |
|||
} |
|||
/** |
|||
* @param $params |
|||
* @return ActiveDataProvider |
|||
* 不分页的所有数据 |
|||
*/ |
|||
public function allData($params) |
|||
{ |
|||
$query = Attribute::find(); |
|||
$dataProvider = new ActiveDataProvider([ |
|||
'query' => $query, |
|||
'pagination' => false, |
|||
'sort' => false |
|||
]); |
|||
$this->load($params); |
|||
return $this->filter($query, $dataProvider); |
|||
} |
|||
|
|||
/** |
|||
* Creates data provider instance with search query applied |
|||
* |
|||
* @param array $params |
|||
* |
|||
* @return ActiveDataProvider |
|||
*/ |
|||
public function search($params) |
|||
{ |
|||
$query = Attribute::find(); |
|||
|
|||
// add conditions that should always apply here
|
|||
|
|||
$dataProvider = new ActiveDataProvider([ |
|||
'query' => $query, |
|||
'pagination' => [ |
|||
'pageSizeLimit' => [1, 200] |
|||
], |
|||
'sort' => [ |
|||
'defaultOrder' => [ |
|||
'id' => SORT_DESC, |
|||
] |
|||
], |
|||
]); |
|||
|
|||
$this->load($params); |
|||
return $this->filter($query, $dataProvider); |
|||
} |
|||
/** |
|||
* @param $query |
|||
* @param $dataProvider |
|||
* @return ActiveDataProvider |
|||
* 条件筛选 |
|||
*/ |
|||
private function filter($query, $dataProvider){ |
|||
if (!$this->validate()) { |
|||
// uncomment the following line if you do not want to return any records when validation fails
|
|||
// $query->where('0=1');
|
|||
return $dataProvider; |
|||
} |
|||
|
|||
// grid filtering conditions
|
|||
$query->andFilterWhere([ |
|||
'id' => $this->id, |
|||
'type' => $this->type, |
|||
'sort_order' => $this->sort_order, |
|||
'is_delete' => $this->is_delete, |
|||
'created_at' => $this->created_at, |
|||
'updated_at' => $this->updated_at, |
|||
]); |
|||
|
|||
$query->andFilterWhere(['like', 'name', $this->name]) |
|||
->andFilterWhere(['like', 'value', $this->value]); |
|||
if ($this->created_at_range) { |
|||
$arr = explode(' ~ ', $this->created_at_range); |
|||
$start = strtotime($arr[0]); |
|||
$end = strtotime($arr[1]) + 3600 * 24; |
|||
$query->andFilterWhere(['between', 'created_at', $start, $end]); |
|||
} |
|||
return $dataProvider; |
|||
} |
|||
} |
@ -1,153 +0,0 @@ |
|||
<?php |
|||
|
|||
namespace common\models\searchs; |
|||
|
|||
use yii\base\Model; |
|||
use yii\data\ActiveDataProvider; |
|||
use yii\helpers\ArrayHelper; |
|||
use common\models\ars\Category; |
|||
|
|||
/** |
|||
* CategorySearch represents the model behind the search form of `common\models\ars\Category`. |
|||
*/ |
|||
class CategorySearch extends Category |
|||
{ |
|||
/** |
|||
* @return array |
|||
* 增加创建时间查询字段 |
|||
*/ |
|||
public function attributes() |
|||
{ |
|||
return ArrayHelper::merge(['created_at_range'], parent::attributes()); |
|||
} |
|||
/** |
|||
* {@inheritdoc} |
|||
*/ |
|||
public function rules() |
|||
{ |
|||
return [ |
|||
[['id', 'pid', 'goods_count', 'sort_order', 'icon_type', 'is_show', 'is_delete', 'created_at', 'updated_at'], 'integer'], |
|||
[['name', 'icon'], 'safe'], |
|||
['created_at_range','safe'], |
|||
]; |
|||
} |
|||
|
|||
/** |
|||
* {@inheritdoc} |
|||
*/ |
|||
public function scenarios() |
|||
{ |
|||
// bypass scenarios() implementation in the parent class
|
|||
return Model::scenarios(); |
|||
} |
|||
/** |
|||
* @return array |
|||
* 列格式 |
|||
*/ |
|||
public function columns() |
|||
{ |
|||
return [ |
|||
[ |
|||
'class' => 'blobt\grid\CheckboxColumn', |
|||
'width' => '2%', |
|||
'align' => 'center' |
|||
], |
|||
'id', |
|||
'name', |
|||
'pid', |
|||
'goods_count', |
|||
'sort_order', |
|||
//'icon_type',
|
|||
//'icon',
|
|||
//'is_show',
|
|||
//'is_delete',
|
|||
//'created_at',
|
|||
//'updated_at',
|
|||
[ |
|||
'class' => 'iron\grid\ActionColumn', |
|||
'align' => 'center', |
|||
], |
|||
]; |
|||
} |
|||
/** |
|||
* @param $params |
|||
* @return ActiveDataProvider |
|||
* 不分页的所有数据 |
|||
*/ |
|||
public function allData($params) |
|||
{ |
|||
$query = Category::find(); |
|||
$dataProvider = new ActiveDataProvider([ |
|||
'query' => $query, |
|||
'pagination' => false, |
|||
'sort' => false |
|||
]); |
|||
$this->load($params); |
|||
return $this->filter($query, $dataProvider); |
|||
} |
|||
|
|||
/** |
|||
* Creates data provider instance with search query applied |
|||
* |
|||
* @param array $params |
|||
* |
|||
* @return ActiveDataProvider |
|||
*/ |
|||
public function search($params) |
|||
{ |
|||
$query = Category::find(); |
|||
|
|||
// add conditions that should always apply here
|
|||
|
|||
$dataProvider = new ActiveDataProvider([ |
|||
'query' => $query, |
|||
'pagination' => [ |
|||
'pageSizeLimit' => [1, 200] |
|||
], |
|||
'sort' => [ |
|||
'defaultOrder' => [ |
|||
'id' => SORT_DESC, |
|||
] |
|||
], |
|||
]); |
|||
|
|||
$this->load($params); |
|||
return $this->filter($query, $dataProvider); |
|||
} |
|||
/** |
|||
* @param $query |
|||
* @param $dataProvider |
|||
* @return ActiveDataProvider |
|||
* 条件筛选 |
|||
*/ |
|||
private function filter($query, $dataProvider){ |
|||
if (!$this->validate()) { |
|||
// uncomment the following line if you do not want to return any records when validation fails
|
|||
// $query->where('0=1');
|
|||
return $dataProvider; |
|||
} |
|||
|
|||
// grid filtering conditions
|
|||
$query->andFilterWhere([ |
|||
'id' => $this->id, |
|||
'pid' => $this->pid, |
|||
'goods_count' => $this->goods_count, |
|||
'sort_order' => $this->sort_order, |
|||
'icon_type' => $this->icon_type, |
|||
'is_show' => $this->is_show, |
|||
'is_delete' => $this->is_delete, |
|||
'created_at' => $this->created_at, |
|||
'updated_at' => $this->updated_at, |
|||
]); |
|||
|
|||
$query->andFilterWhere(['like', 'name', $this->name]) |
|||
->andFilterWhere(['like', 'icon', $this->icon]); |
|||
if ($this->created_at_range) { |
|||
$arr = explode(' ~ ', $this->created_at_range); |
|||
$start = strtotime($arr[0]); |
|||
$end = strtotime($arr[1]) + 3600 * 24; |
|||
$query->andFilterWhere(['between', 'created_at', $start, $end]); |
|||
} |
|||
return $dataProvider; |
|||
} |
|||
} |
@ -1,159 +0,0 @@ |
|||
<?php |
|||
|
|||
namespace common\models\searchs; |
|||
|
|||
use yii\base\Model; |
|||
use yii\data\ActiveDataProvider; |
|||
use yii\helpers\ArrayHelper; |
|||
use common\models\ars\ShopCategory; |
|||
|
|||
/** |
|||
* ShopCategorySearch represents the model behind the search form of `common\models\ars\ShopCategory`. |
|||
*/ |
|||
class ShopCategorySearch extends ShopCategory |
|||
{ |
|||
/** |
|||
* @return array |
|||
* 增加创建时间查询字段 |
|||
*/ |
|||
public function attributes() |
|||
{ |
|||
return ArrayHelper::merge(['created_at_range'], parent::attributes()); |
|||
} |
|||
/** |
|||
* {@inheritdoc} |
|||
*/ |
|||
public function rules() |
|||
{ |
|||
return [ |
|||
[['id', 'pid', 'goods_count', 'sort_order', 'icon_type', 'is_show', 'is_delete', 'created_at', 'updated_at'], 'integer'], |
|||
[['name', 'keywords', 'desc', 'icon', 'filter_attr'], 'safe'], |
|||
['created_at_range','safe'], |
|||
]; |
|||
} |
|||
|
|||
/** |
|||
* {@inheritdoc} |
|||
*/ |
|||
public function scenarios() |
|||
{ |
|||
// bypass scenarios() implementation in the parent class
|
|||
return Model::scenarios(); |
|||
} |
|||
/** |
|||
* @return array |
|||
* 列格式 |
|||
*/ |
|||
public function columns() |
|||
{ |
|||
return [ |
|||
[ |
|||
'class' => 'blobt\grid\CheckboxColumn', |
|||
'width' => '2%', |
|||
'align' => 'center' |
|||
], |
|||
'id', |
|||
'name', |
|||
'pid', |
|||
'goods_count', |
|||
'keywords', |
|||
//'desc',
|
|||
//'sort_order',
|
|||
//'icon_type',
|
|||
//'icon',
|
|||
//'filter_attr',
|
|||
//'is_show',
|
|||
//'is_delete',
|
|||
//'created_at',
|
|||
//'updated_at',
|
|||
[ |
|||
'class' => 'iron\grid\ActionColumn', |
|||
'align' => 'center', |
|||
], |
|||
]; |
|||
} |
|||
/** |
|||
* @param $params |
|||
* @return ActiveDataProvider |
|||
* 不分页的所有数据 |
|||
*/ |
|||
public function allData($params) |
|||
{ |
|||
$query = ShopCategory::find(); |
|||
$dataProvider = new ActiveDataProvider([ |
|||
'query' => $query, |
|||
'pagination' => false, |
|||
'sort' => false |
|||
]); |
|||
$this->load($params); |
|||
return $this->filter($query, $dataProvider); |
|||
} |
|||
|
|||
/** |
|||
* Creates data provider instance with search query applied |
|||
* |
|||
* @param array $params |
|||
* |
|||
* @return ActiveDataProvider |
|||
*/ |
|||
public function search($params) |
|||
{ |
|||
$query = ShopCategory::find(); |
|||
|
|||
// add conditions that should always apply here
|
|||
|
|||
$dataProvider = new ActiveDataProvider([ |
|||
'query' => $query, |
|||
'pagination' => [ |
|||
'pageSizeLimit' => [1, 200] |
|||
], |
|||
'sort' => [ |
|||
'defaultOrder' => [ |
|||
'id' => SORT_DESC, |
|||
] |
|||
], |
|||
]); |
|||
|
|||
$this->load($params); |
|||
return $this->filter($query, $dataProvider); |
|||
} |
|||
/** |
|||
* @param $query |
|||
* @param $dataProvider |
|||
* @return ActiveDataProvider |
|||
* 条件筛选 |
|||
*/ |
|||
private function filter($query, $dataProvider){ |
|||
if (!$this->validate()) { |
|||
// uncomment the following line if you do not want to return any records when validation fails
|
|||
// $query->where('0=1');
|
|||
return $dataProvider; |
|||
} |
|||
|
|||
// grid filtering conditions
|
|||
$query->andFilterWhere([ |
|||
'id' => $this->id, |
|||
'pid' => $this->pid, |
|||
'goods_count' => $this->goods_count, |
|||
'sort_order' => $this->sort_order, |
|||
'icon_type' => $this->icon_type, |
|||
'is_show' => $this->is_show, |
|||
'is_delete' => $this->is_delete, |
|||
'created_at' => $this->created_at, |
|||
'updated_at' => $this->updated_at, |
|||
]); |
|||
|
|||
$query->andFilterWhere(['like', 'name', $this->name]) |
|||
->andFilterWhere(['like', 'keywords', $this->keywords]) |
|||
->andFilterWhere(['like', 'desc', $this->desc]) |
|||
->andFilterWhere(['like', 'icon', $this->icon]) |
|||
->andFilterWhere(['like', 'filter_attr', $this->filter_attr]); |
|||
if ($this->created_at_range) { |
|||
$arr = explode(' ~ ', $this->created_at_range); |
|||
$start = strtotime($arr[0]); |
|||
$end = strtotime($arr[1]) + 3600 * 24; |
|||
$query->andFilterWhere(['between', 'created_at', $start, $end]); |
|||
} |
|||
return $dataProvider; |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue