diff --git a/backend/controllers/AttributeController.php b/backend/controllers/AttributeController.php new file mode 100644 index 0000000..92fb14b --- /dev/null +++ b/backend/controllers/AttributeController.php @@ -0,0 +1,149 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + /** + * Lists all Attribute models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new AttributeSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + 'columns' => $searchModel->columns() + ]); + } + + /** + * Displays a single Attribute 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 Attribute model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Attribute(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect('index'); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + /** + * Updates an existing Attribute 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 Attribute 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 Attribute model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return Attribute the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = Attribute::findOne($id)) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } + /** + * @author iron + * 文件导出 + */ + public function actionExport() + { + $searchModel = new AttributeSearch(); + $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' =>'Attributes'. "-" .date('Y-m-d H/i/s', time()), + 'columns' => $searchModel->columns() + ]); + } +} diff --git a/backend/controllers/BrandController.php b/backend/controllers/BrandController.php new file mode 100644 index 0000000..0dd6523 --- /dev/null +++ b/backend/controllers/BrandController.php @@ -0,0 +1,149 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + /** + * Lists all Brand models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new BrandSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + 'columns' => $searchModel->columns() + ]); + } + + /** + * Displays a single Brand 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 Brand model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Brand(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect('index'); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + /** + * Updates an existing Brand 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 Brand 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 Brand model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return Brand the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = Brand::findOne($id)) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } + /** + * @author iron + * 文件导出 + */ + public function actionExport() + { + $searchModel = new BrandSearch(); + $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' =>'Brands'. "-" .date('Y-m-d H/i/s', time()), + 'columns' => $searchModel->columns() + ]); + } +} diff --git a/backend/controllers/CategoryController.php b/backend/controllers/CategoryController.php new file mode 100644 index 0000000..4be79f8 --- /dev/null +++ b/backend/controllers/CategoryController.php @@ -0,0 +1,149 @@ + [ + '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() + ]); + } +} diff --git a/backend/controllers/GoodsController.php b/backend/controllers/GoodsController.php new file mode 100644 index 0000000..c9024d1 --- /dev/null +++ b/backend/controllers/GoodsController.php @@ -0,0 +1,149 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + /** + * Lists all Goods models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new GoodsSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + 'columns' => $searchModel->columns() + ]); + } + + /** + * Displays a single Goods 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 Goods model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Goods(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect('index'); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + /** + * Updates an existing Goods 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 Goods 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 Goods model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return Goods the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = Goods::findOne($id)) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } + /** + * @author iron + * 文件导出 + */ + public function actionExport() + { + $searchModel = new GoodsSearch(); + $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' =>'Goods'. "-" .date('Y-m-d H/i/s', time()), + 'columns' => $searchModel->columns() + ]); + } +} diff --git a/backend/controllers/ShopcategoryController.php b/backend/controllers/ShopcategoryController.php new file mode 100644 index 0000000..647dec1 --- /dev/null +++ b/backend/controllers/ShopcategoryController.php @@ -0,0 +1,149 @@ + [ + '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() + ]); + } +} diff --git a/backend/controllers/SupplierController.php b/backend/controllers/SupplierController.php new file mode 100644 index 0000000..b538566 --- /dev/null +++ b/backend/controllers/SupplierController.php @@ -0,0 +1,149 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + /** + * Lists all Supplier models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new SupplierSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + 'columns' => $searchModel->columns() + ]); + } + + /** + * Displays a single Supplier 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 Supplier model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Supplier(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect('index'); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + /** + * Updates an existing Supplier 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 Supplier 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 Supplier model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return Supplier the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = Supplier::findOne($id)) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } + /** + * @author iron + * 文件导出 + */ + public function actionExport() + { + $searchModel = new SupplierSearch(); + $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' =>'Suppliers'. "-" .date('Y-m-d H/i/s', time()), + 'columns' => $searchModel->columns() + ]); + } +} diff --git a/backend/views/attribute/_form.php b/backend/views/attribute/_form.php new file mode 100644 index 0000000..de4e895 --- /dev/null +++ b/backend/views/attribute/_form.php @@ -0,0 +1,32 @@ + + +
+ + + + field($model, 'name')->textInput(['maxlength' => true]) ?> + + field($model, 'value')->textarea(['rows' => 6]) ?> + + field($model, 'type')->textInput() ?> + + field($model, 'sort_order')->textInput() ?> + + field($model, 'is_delete')->textInput() ?> + +
+ 'btn btn-success']) ?> + 'btn btn-info']) ?> +
+ + + +
diff --git a/backend/views/attribute/_search.php b/backend/views/attribute/_search.php new file mode 100644 index 0000000..64b6bd4 --- /dev/null +++ b/backend/views/attribute/_search.php @@ -0,0 +1,47 @@ + + + ['index'], + 'method' => 'get', + 'validateOnType' => true, + ]); +?> +
+
+ field($model, 'id', [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "检索ID", + "class" => "form-control", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ]) + ?> + field($model, "created_at_range", [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "创建时间", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ])->widget(DateRangePicker::className()); + ?> +
+ ', ['class' => 'btn btn-default']) ?> + ', ['class' => 'btn btn-default']) ?> +
+
+
+ \ No newline at end of file diff --git a/backend/views/attribute/create.php b/backend/views/attribute/create.php new file mode 100644 index 0000000..d5578e6 --- /dev/null +++ b/backend/views/attribute/create.php @@ -0,0 +1,18 @@ +title = '创建 Attribute'; +$this->params['breadcrumbs'][] = ['label' => 'Attributes', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/attribute/index.php b/backend/views/attribute/index.php new file mode 100644 index 0000000..27999ad --- /dev/null +++ b/backend/views/attribute/index.php @@ -0,0 +1,28 @@ +title = 'Attributes'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+
+ $dataProvider, + 'filter' => $this->render("_search", ['model' => $searchModel]), + 'batch' => [ + [ + "label" => "删除", + "url" => "attribute/deletes" + ], + ], + 'columns' => $columns + ]); + ?> +
+
\ No newline at end of file diff --git a/backend/views/attribute/update.php b/backend/views/attribute/update.php new file mode 100644 index 0000000..4532da0 --- /dev/null +++ b/backend/views/attribute/update.php @@ -0,0 +1,19 @@ +title = '编辑 Attribute: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Attributes', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; +$this->params['breadcrumbs'][] = 'Update '; +?> +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/attribute/view.php b/backend/views/attribute/view.php new file mode 100644 index 0000000..8e54adb --- /dev/null +++ b/backend/views/attribute/view.php @@ -0,0 +1,34 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Attributes', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> +
+ +

+ 'btn btn-success']) ?> +

+ + $model, + 'attributes' => [ + 'id', + 'name', + 'value:ntext', + 'type', + 'sort_order', + 'is_delete', + 'created_at', + 'updated_at', + ], + ]) ?> + +
diff --git a/backend/views/brand/_form.php b/backend/views/brand/_form.php new file mode 100644 index 0000000..036e9f6 --- /dev/null +++ b/backend/views/brand/_form.php @@ -0,0 +1,26 @@ + + +
+ + + + field($model, 'name')->textInput(['maxlength' => true]) ?> + + field($model, 'is_delete')->textInput() ?> + +
+ 'btn btn-success']) ?> + 'btn btn-info']) ?> +
+ + + +
diff --git a/backend/views/brand/_search.php b/backend/views/brand/_search.php new file mode 100644 index 0000000..14a96ae --- /dev/null +++ b/backend/views/brand/_search.php @@ -0,0 +1,47 @@ + + + ['index'], + 'method' => 'get', + 'validateOnType' => true, + ]); +?> +
+
+ field($model, 'id', [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "检索ID", + "class" => "form-control", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ]) + ?> + field($model, "created_at_range", [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "创建时间", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ])->widget(DateRangePicker::className()); + ?> +
+ ', ['class' => 'btn btn-default']) ?> + ', ['class' => 'btn btn-default']) ?> +
+
+
+ \ No newline at end of file diff --git a/backend/views/brand/create.php b/backend/views/brand/create.php new file mode 100644 index 0000000..c768fcb --- /dev/null +++ b/backend/views/brand/create.php @@ -0,0 +1,18 @@ +title = '创建 Brand'; +$this->params['breadcrumbs'][] = ['label' => 'Brands', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/brand/index.php b/backend/views/brand/index.php new file mode 100644 index 0000000..f799f7a --- /dev/null +++ b/backend/views/brand/index.php @@ -0,0 +1,28 @@ +title = 'Brands'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+
+ $dataProvider, + 'filter' => $this->render("_search", ['model' => $searchModel]), + 'batch' => [ + [ + "label" => "删除", + "url" => "brand/deletes" + ], + ], + 'columns' => $columns + ]); + ?> +
+
\ No newline at end of file diff --git a/backend/views/brand/update.php b/backend/views/brand/update.php new file mode 100644 index 0000000..453ee2f --- /dev/null +++ b/backend/views/brand/update.php @@ -0,0 +1,19 @@ +title = '编辑 Brand: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Brands', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; +$this->params['breadcrumbs'][] = 'Update '; +?> +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/brand/view.php b/backend/views/brand/view.php new file mode 100644 index 0000000..814b5be --- /dev/null +++ b/backend/views/brand/view.php @@ -0,0 +1,31 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Brands', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> +
+ +

+ 'btn btn-success']) ?> +

+ + $model, + 'attributes' => [ + 'id', + 'name', + 'is_delete', + 'created_at', + 'updated_at', + ], + ]) ?> + +
diff --git a/backend/views/category/_form.php b/backend/views/category/_form.php new file mode 100644 index 0000000..1ce3540 --- /dev/null +++ b/backend/views/category/_form.php @@ -0,0 +1,38 @@ + + +
+ + + + field($model, 'name')->textInput(['maxlength' => true]) ?> + + field($model, 'pid')->textInput() ?> + + field($model, 'goods_count')->textInput() ?> + + field($model, 'sort_order')->textInput() ?> + + field($model, 'icon_type')->textInput() ?> + + field($model, 'icon')->textInput(['maxlength' => true]) ?> + + field($model, 'is_show')->textInput() ?> + + field($model, 'is_delete')->textInput() ?> + +
+ 'btn btn-success']) ?> + 'btn btn-info']) ?> +
+ + + +
diff --git a/backend/views/category/_search.php b/backend/views/category/_search.php new file mode 100644 index 0000000..b795b35 --- /dev/null +++ b/backend/views/category/_search.php @@ -0,0 +1,47 @@ + + + ['index'], + 'method' => 'get', + 'validateOnType' => true, + ]); +?> +
+
+ field($model, 'id', [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "检索ID", + "class" => "form-control", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ]) + ?> + field($model, "created_at_range", [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "创建时间", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ])->widget(DateRangePicker::className()); + ?> +
+ ', ['class' => 'btn btn-default']) ?> + ', ['class' => 'btn btn-default']) ?> +
+
+
+ \ No newline at end of file diff --git a/backend/views/category/create.php b/backend/views/category/create.php new file mode 100644 index 0000000..932a778 --- /dev/null +++ b/backend/views/category/create.php @@ -0,0 +1,18 @@ +title = '创建 Category'; +$this->params['breadcrumbs'][] = ['label' => 'Categories', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/category/index.php b/backend/views/category/index.php new file mode 100644 index 0000000..3f55220 --- /dev/null +++ b/backend/views/category/index.php @@ -0,0 +1,28 @@ +title = 'Categories'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+
+ $dataProvider, + 'filter' => $this->render("_search", ['model' => $searchModel]), + 'batch' => [ + [ + "label" => "删除", + "url" => "category/deletes" + ], + ], + 'columns' => $columns + ]); + ?> +
+
\ No newline at end of file diff --git a/backend/views/category/update.php b/backend/views/category/update.php new file mode 100644 index 0000000..f492c7b --- /dev/null +++ b/backend/views/category/update.php @@ -0,0 +1,19 @@ +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 '; +?> +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/category/view.php b/backend/views/category/view.php new file mode 100644 index 0000000..403a436 --- /dev/null +++ b/backend/views/category/view.php @@ -0,0 +1,37 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Categories', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> +
+ +

+ 'btn btn-success']) ?> +

+ + $model, + 'attributes' => [ + 'id', + 'name', + 'pid', + 'goods_count', + 'sort_order', + 'icon_type', + 'icon', + 'is_show', + 'is_delete', + 'created_at', + 'updated_at', + ], + ]) ?> + +
diff --git a/backend/views/goods/_form.php b/backend/views/goods/_form.php new file mode 100644 index 0000000..149e969 --- /dev/null +++ b/backend/views/goods/_form.php @@ -0,0 +1,82 @@ + + +
+ + + + field($model, 'pid')->textInput() ?> + + field($model, 'cat_id')->textInput() ?> + + field($model, 'brand_id')->textInput() ?> + + field($model, 'shop_cat_id')->textInput() ?> + + field($model, 'name')->textInput(['maxlength' => true]) ?> + + field($model, 'sn')->textInput(['maxlength' => true]) ?> + + field($model, 'code')->textInput(['maxlength' => true]) ?> + + field($model, 'supplier_id')->textInput() ?> + + field($model, 'weight')->textInput() ?> + + field($model, 'length')->textInput() ?> + + field($model, 'width')->textInput() ?> + + field($model, 'height')->textInput() ?> + + field($model, 'diameter')->textInput() ?> + + field($model, 'unit')->textInput(['maxlength' => true]) ?> + + field($model, 'sold_count')->textInput() ?> + + field($model, 'limit_count')->textInput() ?> + + field($model, 'stock')->textInput() ?> + + field($model, 'stock_warn')->textInput() ?> + + field($model, 'market_price')->textInput() ?> + + field($model, 'price')->textInput() ?> + + field($model, 'brief')->textInput(['maxlength' => true]) ?> + + field($model, 'description')->textarea(['rows' => 6]) ?> + + field($model, 'image')->textInput() ?> + + field($model, 'model_id')->textInput() ?> + + field($model, 'is_sale')->textInput() ?> + + field($model, 'sort_order')->textInput() ?> + + field($model, 'bouns_points')->textInput() ?> + + field($model, 'experience_points')->textInput() ?> + + field($model, 'is_delete')->textInput() ?> + + field($model, 'express_template')->textInput() ?> + +
+ 'btn btn-success']) ?> + 'btn btn-info']) ?> +
+ + + +
diff --git a/backend/views/goods/_search.php b/backend/views/goods/_search.php new file mode 100644 index 0000000..9fca514 --- /dev/null +++ b/backend/views/goods/_search.php @@ -0,0 +1,47 @@ + + + ['index'], + 'method' => 'get', + 'validateOnType' => true, + ]); +?> +
+
+ field($model, 'id', [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "检索ID", + "class" => "form-control", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ]) + ?> + field($model, "created_at_range", [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "创建时间", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ])->widget(DateRangePicker::className()); + ?> +
+ ', ['class' => 'btn btn-default']) ?> + ', ['class' => 'btn btn-default']) ?> +
+
+
+ \ No newline at end of file diff --git a/backend/views/goods/create.php b/backend/views/goods/create.php new file mode 100644 index 0000000..d32b1b8 --- /dev/null +++ b/backend/views/goods/create.php @@ -0,0 +1,18 @@ +title = '创建 Goods'; +$this->params['breadcrumbs'][] = ['label' => 'Goods', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/goods/index.php b/backend/views/goods/index.php new file mode 100644 index 0000000..58d873a --- /dev/null +++ b/backend/views/goods/index.php @@ -0,0 +1,28 @@ +title = 'Goods'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+
+ $dataProvider, + 'filter' => $this->render("_search", ['model' => $searchModel]), + 'batch' => [ + [ + "label" => "删除", + "url" => "goods/deletes" + ], + ], + 'columns' => $columns + ]); + ?> +
+
\ No newline at end of file diff --git a/backend/views/goods/update.php b/backend/views/goods/update.php new file mode 100644 index 0000000..afaf45f --- /dev/null +++ b/backend/views/goods/update.php @@ -0,0 +1,19 @@ +title = '编辑 Goods: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Goods', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; +$this->params['breadcrumbs'][] = 'Update '; +?> +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/goods/view.php b/backend/views/goods/view.php new file mode 100644 index 0000000..e2a57f2 --- /dev/null +++ b/backend/views/goods/view.php @@ -0,0 +1,59 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Goods', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> +
+ +

+ 'btn btn-success']) ?> +

+ + $model, + 'attributes' => [ + 'id', + 'pid', + 'cat_id', + 'brand_id', + 'shop_cat_id', + 'name', + 'sn', + 'code', + 'supplier_id', + 'weight', + 'length', + 'width', + 'height', + 'diameter', + 'unit', + 'sold_count', + 'limit_count', + 'stock', + 'stock_warn', + 'market_price', + 'price', + 'brief', + 'description:ntext', + 'image', + 'model_id', + 'is_sale', + 'sort_order', + 'bouns_points', + 'experience_points', + 'is_delete', + 'express_template', + 'created_at', + 'updated_at', + ], + ]) ?> + +
diff --git a/backend/views/layouts/sidebar.php b/backend/views/layouts/sidebar.php index a164ca5..d41b720 100755 --- a/backend/views/layouts/sidebar.php +++ b/backend/views/layouts/sidebar.php @@ -10,14 +10,18 @@ use blobt\widgets\Menu; 'items' => [ ['label' => 'MAIN NAVIGATION', 'is_header' => true], ['label' => 'IndexController', 'url' => '#', 'icon' => 'fa-hand-o-right', 'items' => [ - ['label' => 'Index', 'url' => ['site/index', 'tag' => 'new']], - ['label' => 'Test', 'url' => ['site/test']], - ] + ['label' => 'Index', 'url' => ['site/index', 'tag' => 'new']], + ['label' => 'Test', 'url' => ['site/test']], + ] ], - ['label' => 'Category', 'url' => '#', 'icon' => 'fa-barcode', 'items' => [ - ['label' => 'List', 'url' => ['category/index', 'tag' => 'new']], - ['label' => 'Create', 'url' => ['category/create', 'tag' => 'popular']], - ] + ['label' => '商品管理', 'url' => '#', 'icon' => 'fa-barcode', 'items' => [ + ['label' => '前端商品分类管理', 'url' => ['shopcategory/index', 'tag' => 'new']], + ['label' => '后台商品分类管理', 'url' => ['category/index', 'tag' => 'popular']], + ['label' => '商品管理', 'url' => ['goods/index', 'tag' => 'popular']], + ['label' => '规格管理', 'url' => ['attribute/index', 'tag' => 'popular']], + ['label' => '品牌管理', 'url' => ['brand/index', 'tag' => 'popular']], + ['label' => '供应商管理', 'url' => ['supplier/index', 'tag' => 'popular']] + ] ] ] ]); diff --git a/backend/views/shopcategory/_form.php b/backend/views/shopcategory/_form.php new file mode 100644 index 0000000..5f0949f --- /dev/null +++ b/backend/views/shopcategory/_form.php @@ -0,0 +1,44 @@ + + +
+ + + + field($model, 'name')->textInput(['maxlength' => true]) ?> + + field($model, 'pid')->textInput() ?> + + field($model, 'goods_count')->textInput() ?> + + field($model, 'keywords')->textInput(['maxlength' => true]) ?> + + field($model, 'desc')->textInput(['maxlength' => true]) ?> + + field($model, 'sort_order')->textInput() ?> + + field($model, 'icon_type')->textInput() ?> + + field($model, 'icon')->textInput(['maxlength' => true]) ?> + + field($model, 'filter_attr')->textarea(['rows' => 6]) ?> + + field($model, 'is_show')->textInput() ?> + + field($model, 'is_delete')->textInput() ?> + +
+ 'btn btn-success']) ?> + 'btn btn-info']) ?> +
+ + + +
diff --git a/backend/views/shopcategory/_search.php b/backend/views/shopcategory/_search.php new file mode 100644 index 0000000..3bc2c78 --- /dev/null +++ b/backend/views/shopcategory/_search.php @@ -0,0 +1,47 @@ + + + ['index'], + 'method' => 'get', + 'validateOnType' => true, + ]); +?> +
+
+ field($model, 'id', [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "检索ID", + "class" => "form-control", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ]) + ?> + field($model, "created_at_range", [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "创建时间", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ])->widget(DateRangePicker::className()); + ?> +
+ ', ['class' => 'btn btn-default']) ?> + ', ['class' => 'btn btn-default']) ?> +
+
+
+ \ No newline at end of file diff --git a/backend/views/shopcategory/create.php b/backend/views/shopcategory/create.php new file mode 100644 index 0000000..2fe2348 --- /dev/null +++ b/backend/views/shopcategory/create.php @@ -0,0 +1,18 @@ +title = '创建 Shop Category'; +$this->params['breadcrumbs'][] = ['label' => 'Shop Categories', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/shopcategory/index.php b/backend/views/shopcategory/index.php new file mode 100644 index 0000000..8b52bf6 --- /dev/null +++ b/backend/views/shopcategory/index.php @@ -0,0 +1,28 @@ +title = 'Shop Categories'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+
+ $dataProvider, + 'filter' => $this->render("_search", ['model' => $searchModel]), + 'batch' => [ + [ + "label" => "删除", + "url" => "shopcategory/deletes" + ], + ], + 'columns' => $columns + ]); + ?> +
+
\ No newline at end of file diff --git a/backend/views/shopcategory/update.php b/backend/views/shopcategory/update.php new file mode 100644 index 0000000..93e68c8 --- /dev/null +++ b/backend/views/shopcategory/update.php @@ -0,0 +1,19 @@ +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 '; +?> +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/shopcategory/view.php b/backend/views/shopcategory/view.php new file mode 100644 index 0000000..b94aaa9 --- /dev/null +++ b/backend/views/shopcategory/view.php @@ -0,0 +1,40 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Shop Categories', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> +
+ +

+ 'btn btn-success']) ?> +

+ + $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', + ], + ]) ?> + +
diff --git a/backend/views/supplier/_form.php b/backend/views/supplier/_form.php new file mode 100644 index 0000000..dde074b --- /dev/null +++ b/backend/views/supplier/_form.php @@ -0,0 +1,32 @@ + + +
+ + + + field($model, 'name')->textInput(['maxlength' => true]) ?> + + field($model, 'full_name')->textInput(['maxlength' => true]) ?> + + field($model, 'phone')->textInput(['maxlength' => true]) ?> + + field($model, 'address')->textInput(['maxlength' => true]) ?> + + field($model, 'is_delete')->textInput() ?> + +
+ 'btn btn-success']) ?> + 'btn btn-info']) ?> +
+ + + +
diff --git a/backend/views/supplier/_search.php b/backend/views/supplier/_search.php new file mode 100644 index 0000000..f014a90 --- /dev/null +++ b/backend/views/supplier/_search.php @@ -0,0 +1,47 @@ + + + ['index'], + 'method' => 'get', + 'validateOnType' => true, + ]); +?> +
+
+ field($model, 'id', [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "检索ID", + "class" => "form-control", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ]) + ?> + field($model, "created_at_range", [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "创建时间", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ])->widget(DateRangePicker::className()); + ?> +
+ ', ['class' => 'btn btn-default']) ?> + ', ['class' => 'btn btn-default']) ?> +
+
+
+ \ No newline at end of file diff --git a/backend/views/supplier/create.php b/backend/views/supplier/create.php new file mode 100644 index 0000000..eeb7fb0 --- /dev/null +++ b/backend/views/supplier/create.php @@ -0,0 +1,18 @@ +title = '创建 Supplier'; +$this->params['breadcrumbs'][] = ['label' => 'Suppliers', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/supplier/index.php b/backend/views/supplier/index.php new file mode 100644 index 0000000..1c15fb2 --- /dev/null +++ b/backend/views/supplier/index.php @@ -0,0 +1,28 @@ +title = 'Suppliers'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+
+ $dataProvider, + 'filter' => $this->render("_search", ['model' => $searchModel]), + 'batch' => [ + [ + "label" => "删除", + "url" => "supplier/deletes" + ], + ], + 'columns' => $columns + ]); + ?> +
+
\ No newline at end of file diff --git a/backend/views/supplier/update.php b/backend/views/supplier/update.php new file mode 100644 index 0000000..b2b5eec --- /dev/null +++ b/backend/views/supplier/update.php @@ -0,0 +1,19 @@ +title = '编辑 Supplier: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Suppliers', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; +$this->params['breadcrumbs'][] = 'Update '; +?> +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/supplier/view.php b/backend/views/supplier/view.php new file mode 100644 index 0000000..9fef302 --- /dev/null +++ b/backend/views/supplier/view.php @@ -0,0 +1,34 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Suppliers', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> +
+ +

+ 'btn btn-success']) ?> +

+ + $model, + 'attributes' => [ + 'id', + 'name', + 'full_name', + 'phone', + 'address', + 'is_delete', + 'created_at', + 'updated_at', + ], + ]) ?> + +
diff --git a/common/models/searchs/AttributeSearch.php b/common/models/searchs/AttributeSearch.php new file mode 100644 index 0000000..50b1827 --- /dev/null +++ b/common/models/searchs/AttributeSearch.php @@ -0,0 +1,147 @@ + '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; + } +} diff --git a/common/models/searchs/BrandSearch.php b/common/models/searchs/BrandSearch.php new file mode 100644 index 0000000..c75e607 --- /dev/null +++ b/common/models/searchs/BrandSearch.php @@ -0,0 +1,141 @@ + 'blobt\grid\CheckboxColumn', + 'width' => '2%', + 'align' => 'center' + ], + 'id', + 'name', + 'is_delete', + 'created_at', + 'updated_at', + [ + 'class' => 'iron\grid\ActionColumn', + 'align' => 'center', + ], + ]; + } + /** + * @param $params + * @return ActiveDataProvider + * 不分页的所有数据 + */ + public function allData($params) + { + $query = Brand::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 = Brand::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, + 'is_delete' => $this->is_delete, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + ]); + + $query->andFilterWhere(['like', 'name', $this->name]); + 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; + } +} diff --git a/common/models/searchs/CategorySearch.php b/common/models/searchs/CategorySearch.php new file mode 100644 index 0000000..2693c7f --- /dev/null +++ b/common/models/searchs/CategorySearch.php @@ -0,0 +1,153 @@ + '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; + } +} diff --git a/common/models/searchs/GoodsSearch.php b/common/models/searchs/GoodsSearch.php new file mode 100644 index 0000000..2e7cfcf --- /dev/null +++ b/common/models/searchs/GoodsSearch.php @@ -0,0 +1,197 @@ + 'blobt\grid\CheckboxColumn', + 'width' => '2%', + 'align' => 'center' + ], + 'id', + 'pid', + 'cat_id', + 'brand_id', + 'shop_cat_id', + //'name', + //'sn', + //'code', + //'supplier_id', + //'weight', + //'length', + //'width', + //'height', + //'diameter', + //'unit', + //'sold_count', + //'limit_count', + //'stock', + //'stock_warn', + //'market_price', + //'price', + //'brief', + //'description', + //'image', + //'model_id', + //'is_sale', + //'sort_order', + //'bouns_points', + //'experience_points', + //'is_delete', + //'express_template', + //'created_at', + //'updated_at', + [ + 'class' => 'iron\grid\ActionColumn', + 'align' => 'center', + ], + ]; + } + /** + * @param $params + * @return ActiveDataProvider + * 不分页的所有数据 + */ + public function allData($params) + { + $query = Goods::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 = Goods::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, + 'cat_id' => $this->cat_id, + 'brand_id' => $this->brand_id, + 'shop_cat_id' => $this->shop_cat_id, + 'supplier_id' => $this->supplier_id, + 'weight' => $this->weight, + 'length' => $this->length, + 'width' => $this->width, + 'height' => $this->height, + 'diameter' => $this->diameter, + 'sold_count' => $this->sold_count, + 'limit_count' => $this->limit_count, + 'stock' => $this->stock, + 'stock_warn' => $this->stock_warn, + 'market_price' => $this->market_price, + 'price' => $this->price, + 'image' => $this->image, + 'model_id' => $this->model_id, + 'is_sale' => $this->is_sale, + 'sort_order' => $this->sort_order, + 'bouns_points' => $this->bouns_points, + 'experience_points' => $this->experience_points, + 'is_delete' => $this->is_delete, + 'express_template' => $this->express_template, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + ]); + + $query->andFilterWhere(['like', 'name', $this->name]) + ->andFilterWhere(['like', 'sn', $this->sn]) + ->andFilterWhere(['like', 'code', $this->code]) + ->andFilterWhere(['like', 'unit', $this->unit]) + ->andFilterWhere(['like', 'brief', $this->brief]) + ->andFilterWhere(['like', 'description', $this->description]); + 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; + } +} diff --git a/common/models/searchs/ShopCategorySearch.php b/common/models/searchs/ShopCategorySearch.php new file mode 100644 index 0000000..8704080 --- /dev/null +++ b/common/models/searchs/ShopCategorySearch.php @@ -0,0 +1,159 @@ + '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; + } +} diff --git a/common/models/searchs/SupplierSearch.php b/common/models/searchs/SupplierSearch.php new file mode 100644 index 0000000..ca170c5 --- /dev/null +++ b/common/models/searchs/SupplierSearch.php @@ -0,0 +1,147 @@ + 'blobt\grid\CheckboxColumn', + 'width' => '2%', + 'align' => 'center' + ], + 'id', + 'name', + 'full_name', + 'phone', + 'address', + //'is_delete', + //'created_at', + //'updated_at', + [ + 'class' => 'iron\grid\ActionColumn', + 'align' => 'center', + ], + ]; + } + /** + * @param $params + * @return ActiveDataProvider + * 不分页的所有数据 + */ + public function allData($params) + { + $query = Supplier::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 = Supplier::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, + 'is_delete' => $this->is_delete, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + ]); + + $query->andFilterWhere(['like', 'name', $this->name]) + ->andFilterWhere(['like', 'full_name', $this->full_name]) + ->andFilterWhere(['like', 'phone', $this->phone]) + ->andFilterWhere(['like', 'address', $this->address]); + 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; + } +}