diff --git a/.gitignore b/.gitignore index e6d67bc..a73b817 100644 --- a/.gitignore +++ b/.gitignore @@ -36,4 +36,4 @@ phpunit.phar /.vagrant vendor.zip /vagrant -/kcadmin/web/uploads +/backend/web/uploads diff --git a/backend/assets/AppAsset.php b/backend/assets/AppAsset.php old mode 100755 new mode 100644 index 6b1209f..6a7b360 --- a/backend/assets/AppAsset.php +++ b/backend/assets/AppAsset.php @@ -19,8 +19,8 @@ class AppAsset extends AssetBundle ]; public $depends = [ 'yii\web\YiiAsset', - 'yii\bootstrap\BootstrapAsset', - 'yii\bootstrap\BootstrapPluginAsset', - 'blobt\web\AdminlteAsset', + 'yii\bootstrap4\BootstrapAsset', + 'yii\bootstrap4\BootstrapPluginAsset', + 'iron\web\AdminlteAsset', ]; } diff --git a/backend/controllers/AttributeController.php b/backend/controllers/AttributeController.php index 92fb14b..a4b35c7 100644 --- a/backend/controllers/AttributeController.php +++ b/backend/controllers/AttributeController.php @@ -2,6 +2,7 @@ namespace backend\controllers; +use common\models\ars\Config; use Yii; use common\models\ars\Attribute; use common\models\searchs\AttributeSearch; @@ -42,7 +43,7 @@ class AttributeController extends Controller 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'columns' => $searchModel->columns() - ]); + ]); } /** @@ -125,24 +126,25 @@ class AttributeController extends Controller throw new NotFoundHttpException('The requested page does not exist.'); } + /** - * @author iron - * 文件导出 - */ + * @author iron + * 文件导出 + */ public function actionExport() { - $searchModel = new AttributeSearch(); + $searchModel = new attributeSearch(); $params = Yii::$app->request->queryParams; if ($params['page-type'] == 'all') { - $dataProvider = $searchModel->allData($params); + $dataProvider = $searchModel->allData($params); } else { $dataProvider = $searchModel->search($params); } - \iron\widget\Excel::export([ + \iron\widget\Excel::export([ 'models' => $dataProvider->getModels(), 'format' => 'Xlsx', 'asAttachment' => true, - 'fileName' =>'Attributes'. "-" .date('Y-m-d H/i/s', time()), + 'fileName' => 'Attributes' . "-" . date('Y-m-d H/i/s', time()), 'columns' => $searchModel->columns() ]); } diff --git a/backend/controllers/ConfigController.php b/backend/controllers/ConfigController.php new file mode 100644 index 0000000..1a0b743 --- /dev/null +++ b/backend/controllers/ConfigController.php @@ -0,0 +1,76 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + /** + * Lists all Category models. + * @return mixed + */ + public function actionIndex() + { + return $this->render('index'); + } + + + /** + * 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, + ]); + } + + /** + * 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.'); + } +} diff --git a/kcadmin/controllers/CategoryController.php b/backend/controllers/OrderController.php similarity index 56% rename from kcadmin/controllers/CategoryController.php rename to backend/controllers/OrderController.php index 1ae4c9a..fd50941 100644 --- a/kcadmin/controllers/CategoryController.php +++ b/backend/controllers/OrderController.php @@ -1,24 +1,19 @@ [ - 'class' => 'iron\actions\UploadAction', - 'path' => 'xls/' - ] - ]; - } - - public function actionSaveDatabase() - { - Yii::$app->response->format = Response::FORMAT_JSON; - //TODO save data in database - return ['status'=>true]; - } - - public function actionPreviews() - { - Yii::$app->response->format = Response::FORMAT_JSON; - return [['name' => '111', 'path' => '/uploads/15736315233032.jpg', 'size' => 1024]]; - } - - /** - * @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\widgets\Excel::export([ - 'models' => $dataProvider->getModels(), - 'format' => 'Xlsx', - 'asAttachment' => true, - 'fileName' => "category" . "-" . date('Y-m-d H/i/s', time()), - 'columns' => Category::columns() - ]); - } - - public function actionTest() - { - return $this->renderPartial('test'); - } - /** - * Lists all Category models. + * Lists all Order models. * @return mixed */ public function actionIndex() { - $searchModel = new CategorySearch(); + $searchModel = new OrderSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, - 'columns' => Category::columns() - ]); - } - - public function actionImageDel() - { - Yii::$app->response->format = Response::FORMAT_JSON; - return ['status' => true]; + 'columns' => $searchModel->columns() + ]); } /** - * Displays a single Category model. + * Displays a single Order model. * @param integer $id * @return mixed * @throws NotFoundHttpException if the model cannot be found @@ -119,16 +59,16 @@ class CategoryController extends Controller } /** - * Creates a new Category model. + * Creates a new Order model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { - $model = new Category(); + $model = new Order(); if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->id]); + return $this->redirect('index'); } return $this->render('create', [ @@ -137,7 +77,7 @@ class CategoryController extends Controller } /** - * Updates an existing Category model. + * Updates an existing Order model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed @@ -148,7 +88,7 @@ class CategoryController extends Controller $model = $this->findModel($id); if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->id]); + return $this->redirect('index'); } return $this->render('update', [ @@ -157,7 +97,7 @@ class CategoryController extends Controller } /** - * Deletes an existing Category model. + * Deletes an existing Order model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed @@ -171,28 +111,39 @@ class CategoryController extends Controller } /** - * - */ - public function actionDeletes() - { - //获取前端post的记录id - $ids = Yii::$app->request->post('ids'); - } - - /** - * Finds the Category model based on its primary key value. + * Finds the Order 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 + * @return Order the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { - if (($model = Category::findOne($id)) !== null) { + if (($model = Order::findOne($id)) !== null) { return $model; } throw new NotFoundHttpException('The requested page does not exist.'); } - + /** + * @author iron + * 文件导出 + */ + public function actionExport() + { + $searchModel = new OrderSearch(); + $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' =>'Orders'. "-" .date('Y-m-d H/i/s', time()), + 'columns' => $searchModel->columns() + ]); + } } diff --git a/backend/controllers/ShopcategoryController.php b/backend/controllers/ShopCategoryController.php similarity index 97% rename from backend/controllers/ShopcategoryController.php rename to backend/controllers/ShopCategoryController.php index 647dec1..ad4e43e 100644 --- a/backend/controllers/ShopcategoryController.php +++ b/backend/controllers/ShopCategoryController.php @@ -10,9 +10,9 @@ use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; /** - * ShopcategoryController implements the CRUD actions for ShopCategory model. + * ShopCategoryController implements the CRUD actions for ShopCategory model. */ -class ShopcategoryController extends Controller +class ShopCategoryController extends Controller { /** * {@inheritdoc} diff --git a/backend/controllers/SiteController.php b/backend/controllers/SiteController.php old mode 100755 new mode 100644 diff --git a/kcadmin/runtime/.gitignore b/backend/runtime/.gitignore similarity index 100% rename from kcadmin/runtime/.gitignore rename to backend/runtime/.gitignore diff --git a/backend/views/attribute/_search.php b/backend/views/attribute/_search.php index 64b6bd4..e8f58ee 100644 --- a/backend/views/attribute/_search.php +++ b/backend/views/attribute/_search.php @@ -5,7 +5,7 @@ use yii\widgets\ActiveForm; use \blobt\widgets\DateRangePicker; /* @var $this yii\web\View */ -/* @var $model common\models\searchs\AttributeSearch */ +/* @var $model common\models\searchs\attributeSearch */ /* @var $form yii\widgets\ActiveForm */ ?> @@ -15,8 +15,8 @@ use \blobt\widgets\DateRangePicker; 'validateOnType' => true, ]); ?> -
-
+
+
field($model, 'id', [ "template" => "{input}{error}", "inputOptions" => [ @@ -28,6 +28,8 @@ use \blobt\widgets\DateRangePicker; ] ]) ?> +
+
field($model, "created_at_range", [ "template" => "{input}{error}", "inputOptions" => [ @@ -38,10 +40,10 @@ use \blobt\widgets\DateRangePicker; ] ])->widget(DateRangePicker::className()); ?> +
', ['class' => 'btn btn-default']) ?> ', ['class' => 'btn btn-default']) ?>
-
\ No newline at end of file diff --git a/backend/views/attribute/index.php b/backend/views/attribute/index.php index 27999ad..3b9e384 100644 --- a/backend/views/attribute/index.php +++ b/backend/views/attribute/index.php @@ -1,17 +1,17 @@ title = 'Attributes'; $this->params['breadcrumbs'][] = $this->title; ?>
-
+
$dataProvider, 'filter' => $this->render("_search", ['model' => $searchModel]), diff --git a/backend/views/category/_search.php b/backend/views/category/_search.php index b795b35..d43cb1d 100644 --- a/backend/views/category/_search.php +++ b/backend/views/category/_search.php @@ -15,8 +15,8 @@ use \blobt\widgets\DateRangePicker; 'validateOnType' => true, ]); ?> -
-
+
+
field($model, 'id', [ "template" => "{input}{error}", "inputOptions" => [ @@ -28,6 +28,8 @@ use \blobt\widgets\DateRangePicker; ] ]) ?> +
+
field($model, "created_at_range", [ "template" => "{input}{error}", "inputOptions" => [ @@ -38,10 +40,10 @@ use \blobt\widgets\DateRangePicker; ] ])->widget(DateRangePicker::className()); ?> +
', ['class' => 'btn btn-default']) ?> ', ['class' => 'btn btn-default']) ?>
-
\ No newline at end of file diff --git a/backend/views/category/index.php b/backend/views/category/index.php index 3f55220..9c6da0b 100644 --- a/backend/views/category/index.php +++ b/backend/views/category/index.php @@ -1,7 +1,7 @@ title = 'Categories'; $this->params['breadcrumbs'][] = $this->title; ?>
-
+
$dataProvider, 'filter' => $this->render("_search", ['model' => $searchModel]), diff --git a/backend/views/config/index.php b/backend/views/config/index.php new file mode 100644 index 0000000..3bbeb28 --- /dev/null +++ b/backend/views/config/index.php @@ -0,0 +1,27 @@ + + +配置页 diff --git a/backend/views/goods/_search.php b/backend/views/goods/_search.php index 9fca514..9a86777 100644 --- a/backend/views/goods/_search.php +++ b/backend/views/goods/_search.php @@ -15,8 +15,8 @@ use \blobt\widgets\DateRangePicker; 'validateOnType' => true, ]); ?> -
-
+
+
field($model, 'id', [ "template" => "{input}{error}", "inputOptions" => [ @@ -28,6 +28,8 @@ use \blobt\widgets\DateRangePicker; ] ]) ?> +
+
field($model, "created_at_range", [ "template" => "{input}{error}", "inputOptions" => [ @@ -38,10 +40,10 @@ use \blobt\widgets\DateRangePicker; ] ])->widget(DateRangePicker::className()); ?> +
', ['class' => 'btn btn-default']) ?> ', ['class' => 'btn btn-default']) ?>
-
\ No newline at end of file diff --git a/backend/views/goods/index.php b/backend/views/goods/index.php index 58d873a..82c38b2 100644 --- a/backend/views/goods/index.php +++ b/backend/views/goods/index.php @@ -1,7 +1,7 @@ title = 'Goods'; $this->params['breadcrumbs'][] = $this->title; ?>
-
+
$dataProvider, 'filter' => $this->render("_search", ['model' => $searchModel]), diff --git a/backend/views/layouts/base.php b/backend/views/layouts/base.php old mode 100755 new mode 100644 index 5d7aa88..987f0b3 --- a/backend/views/layouts/base.php +++ b/backend/views/layouts/base.php @@ -2,7 +2,7 @@ /* @var $this \yii\web\View */ /* @var $content string */ -use kcadmin\assets\AppAsset; +use backend\assets\AppAsset; use yii\helpers\Html; use yii\bootstrap\Nav; use yii\bootstrap\NavBar; diff --git a/backend/views/layouts/breadcrumb.php b/backend/views/layouts/breadcrumb.php old mode 100755 new mode 100644 index a159020..57806ab --- a/backend/views/layouts/breadcrumb.php +++ b/backend/views/layouts/breadcrumb.php @@ -1,13 +1,25 @@ -title)): ?> -

title ?>params['subtitle'])): ?>params['subtitle'] ?>

- - 'ol', - 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], -]); -?> \ No newline at end of file +
+
+
+ title)): ?> +

title ?>params['subtitle'])): ?> + params['subtitle'] ?>

+ +
+
+ 'ol', + 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], + 'itemTemplate' => "\n", + 'activeItemTemplate' => "
  • {link}
  • \n", + 'options' => ['class' => 'breadcrumb float-sm-right'] + ]); + ?> +
    +
    \ No newline at end of file diff --git a/backend/views/layouts/footer.php b/backend/views/layouts/footer.php old mode 100755 new mode 100644 diff --git a/backend/views/layouts/header.php b/backend/views/layouts/header.php old mode 100755 new mode 100644 index 2bbba81..0fd795d --- a/backend/views/layouts/header.php +++ b/backend/views/layouts/header.php @@ -1,71 +1,49 @@ -
    - - - -
    - + \ No newline at end of file diff --git a/backend/views/layouts/main.php b/backend/views/layouts/main.php old mode 100755 new mode 100644 index 421217b..40efd9f --- a/backend/views/layouts/main.php +++ b/backend/views/layouts/main.php @@ -2,10 +2,8 @@ /* @var $this \yii\web\View */ /* @var $content string */ -use kcadmin\assets\AppAsset; +use backend\assets\AppAsset; use yii\helpers\Html; -use yii\bootstrap\Nav; -use yii\bootstrap\NavBar; use yii\widgets\Breadcrumbs; AppAsset::register($this); diff --git a/backend/views/layouts/sidebar.php b/backend/views/layouts/sidebar.php old mode 100755 new mode 100644 index d41b720..828322f --- a/backend/views/layouts/sidebar.php +++ b/backend/views/layouts/sidebar.php @@ -1,28 +1,36 @@ -