From 9ffc9f148f8ca568ba97d3f0ea49463b1e62b86a Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 4 Dec 2019 14:53:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E7=94=9F=E6=88=90antgoods=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- antgoods123/.gitignore | 2 - antgoods123/assets/AppAsset.php | 26 - antgoods123/assets/GoodsAttributeAsset.php | 21 - .../assets/GoodsFilterAttributeAsset.php | 20 - antgoods123/assets/GoodsSkuEditAsset.php | 20 - antgoods123/config/.gitignore | 4 - antgoods123/config/bootstrap.php | 1 - antgoods123/config/main.php | 62 - antgoods123/config/params.php | 4 - .../controllers/AttributeController.php | 170 - antgoods123/controllers/BrandController.php | 151 - .../controllers/CategoryController.php | 276 - antgoods123/controllers/ConfigController.php | 76 - antgoods123/controllers/GoodsController.php | 359 - .../controllers/ShopCategoryController.php | 287 - antgoods123/controllers/SiteController.php | 112 - .../controllers/SupplierController.php | 151 - antgoods123/logic/goods/GoodsManager.php | 578 -- ...1119_021851_create_table_shop_category.php | 42 - .../m191119_022641_create_table_category.php | 39 - .../m191119_022939_create_table_attribute.php | 36 - ...m191119_023115_create_table_goods_attr.php | 35 - .../m191119_024029_create_table_brand.php | 33 - .../m191119_024205_create_table_goods.php | 27 - .../m191119_024345_create_table_goods_sku.php | 27 - .../m191119_025607_create_table_supplier.php | 36 - ...191119_025843_create_table_filter_attr.php | 35 - ..._column_icon_type_in_antgoods_category.php | 22 - ...n_icon_type_in_table_antgoods_category.php | 20 - ...id_and_icon_in_table_antgoods_category.php | 26 - ...n_type_in_table_antgoods_shop_category.php | 20 - ...d_icon_in_table_antgoods_shop_category.php | 26 - ..._is_manaul_in_table_antgoods_goods_sku.php | 20 - ..._add_column_sku_mode_in_antgoods_goods.php | 20 - ...d_attr_id_in_table_antgoods_goods_attr.php | 26 - ...umn_cat_id_in_table_antgoods_attribute.php | 20 - ...op_columns_in_table_antgoods_goods_sku.php | 27 - antgoods123/migrations/sql/goods.sql | 37 - antgoods123/migrations/sql/goods_sku.sql | 24 - antgoods123/models/.gitkeep | 1 - antgoods123/models/ars/Attribute.php | 111 - antgoods123/models/ars/Brand.php | 82 - antgoods123/models/ars/Category.php | 114 - antgoods123/models/ars/FilterAttr.php | 81 - antgoods123/models/ars/Goods.php | 232 - antgoods123/models/ars/GoodsAttr.php | 81 - antgoods123/models/ars/GoodsSku.php | 102 - antgoods123/models/ars/ShopCategory.php | 122 - antgoods123/models/ars/Supplier.php | 96 - .../models/searchs/AttributeSearch.php | 162 - antgoods123/models/searchs/BrandSearch.php | 152 - antgoods123/models/searchs/CategorySearch.php | 172 - antgoods123/models/searchs/GoodsSearch.php | 241 - .../models/searchs/ShopCategorySearch.php | 162 - antgoods123/models/searchs/SupplierSearch.php | 161 - antgoods123/views/attribute/_form.php | 32 - antgoods123/views/attribute/_search.php | 49 - antgoods123/views/attribute/create.php | 18 - antgoods123/views/attribute/index.php | 28 - antgoods123/views/attribute/update.php | 19 - antgoods123/views/attribute/view.php | 33 - antgoods123/views/brand/_form.php | 24 - antgoods123/views/brand/_search.php | 49 - antgoods123/views/brand/create.php | 18 - antgoods123/views/brand/index.php | 28 - antgoods123/views/brand/update.php | 19 - antgoods123/views/brand/view.php | 30 - antgoods123/views/category/_form.php | 47 - antgoods123/views/category/_search.php | 49 - antgoods123/views/category/create.php | 18 - antgoods123/views/category/index.php | 28 - antgoods123/views/category/update.php | 19 - antgoods123/views/category/view.php | 41 - antgoods123/views/config/index.php | 27 - antgoods123/views/goods/_form.php | 107 - antgoods123/views/goods/_search.php | 49 - antgoods123/views/goods/attribute.php | 22 - antgoods123/views/goods/create.php | 72 - antgoods123/views/goods/filter_attribute.php | 22 - antgoods123/views/goods/goods.php | 64 - antgoods123/views/goods/index.php | 28 - antgoods123/views/goods/new_editor.php | 31 - antgoods123/views/goods/picture.php | 37 - antgoods123/views/goods/sku_edit.php | 15 - antgoods123/views/goods/update.php | 80 - antgoods123/views/goods/view.php | 113 - antgoods123/views/layouts/base.php | 33 - antgoods123/views/layouts/breadcrumb.php | 25 - antgoods123/views/layouts/footer.php | 7 - antgoods123/views/layouts/header.php | 67 - antgoods123/views/layouts/main.php | 57 - antgoods123/views/layouts/sidebar.php | 33 - antgoods123/views/shop-category/_form.php | 55 - antgoods123/views/shop-category/_search.php | 49 - antgoods123/views/shop-category/create.php | 18 - antgoods123/views/shop-category/index.php | 28 - antgoods123/views/shop-category/update.php | 19 - antgoods123/views/shop-category/view.php | 64 - antgoods123/views/site/error.php | 27 - antgoods123/views/site/index.php | 6 - antgoods123/views/site/login.php | 34 - antgoods123/views/site/test.php | 68 - antgoods123/views/supplier/_form.php | 30 - antgoods123/views/supplier/_search.php | 49 - antgoods123/views/supplier/create.php | 18 - antgoods123/views/supplier/index.php | 28 - antgoods123/views/supplier/update.php | 19 - antgoods123/views/supplier/view.php | 33 - antgoods123/web/.gitignore | 11 - antgoods123/web/assets/.gitignore | 2 - antgoods123/web/css/reset.css | 48 - antgoods123/web/css/site.css | 52 - .../web/custom/sku.49a56a9198d9c3ec233c.js | 58 - .../web/custom/sku.52802ed907a316501cd7.js | 58 - .../web/custom/sku.9a46222d01b3d601e5ad.js | 58 - .../custom/sku_item.6649e882bedbeb22ea3d.js | 64 - antgoods123/web/favicon.ico | Bin 318 -> 0 bytes antgoods123/web/img/avatar.png | Bin 8117 -> 0 bytes antgoods123/web/img/avatar04.png | Bin 13539 -> 0 bytes antgoods123/web/img/avatar2.png | Bin 8262 -> 0 bytes antgoods123/web/img/avatar3.png | Bin 9241 -> 0 bytes antgoods123/web/img/avatar5.png | Bin 7578 -> 0 bytes .../web/img/credit/american-express.png | Bin 2163 -> 0 bytes antgoods123/web/img/credit/cirrus.png | Bin 1582 -> 0 bytes antgoods123/web/img/credit/mastercard.png | Bin 1589 -> 0 bytes antgoods123/web/img/credit/mestro.png | Bin 1581 -> 0 bytes antgoods123/web/img/credit/paypal.png | Bin 2033 -> 0 bytes antgoods123/web/img/credit/paypal2.png | Bin 1219 -> 0 bytes antgoods123/web/img/credit/visa.png | Bin 1061 -> 0 bytes antgoods123/web/img/default-50x50.gif | Bin 184 -> 0 bytes antgoods123/web/img/icons.png | Bin 1142 -> 0 bytes antgoods123/web/img/logo.jpeg | Bin 5580 -> 0 bytes antgoods123/web/img/photo1.png | Bin 672008 -> 0 bytes antgoods123/web/img/photo2.png | Bin 422438 -> 0 bytes antgoods123/web/img/photo3.jpg | Bin 392079 -> 0 bytes antgoods123/web/img/photo4.jpg | Bin 1179224 -> 0 bytes antgoods123/web/img/user1-128x128.jpg | Bin 2879 -> 0 bytes antgoods123/web/img/user2-160x160.jpg | Bin 7070 -> 0 bytes antgoods123/web/img/user3-128x128.jpg | Bin 3511 -> 0 bytes antgoods123/web/img/user4-128x128.jpg | Bin 3477 -> 0 bytes antgoods123/web/img/user5-128x128.jpg | Bin 6446 -> 0 bytes antgoods123/web/img/user6-128x128.jpg | Bin 4342 -> 0 bytes antgoods123/web/img/user7-128x128.jpg | Bin 6434 -> 0 bytes antgoods123/web/img/user8-128x128.jpg | Bin 5060 -> 0 bytes antgoods123/web/js/common.js | 0 antgoods123/web/js/jquery.js | 9210 ----------------- antgoods123/web/js/jquery.min.js | 2966 ------ 147 files changed, 19500 deletions(-) delete mode 100755 antgoods123/.gitignore delete mode 100755 antgoods123/assets/AppAsset.php delete mode 100644 antgoods123/assets/GoodsAttributeAsset.php delete mode 100644 antgoods123/assets/GoodsFilterAttributeAsset.php delete mode 100644 antgoods123/assets/GoodsSkuEditAsset.php delete mode 100755 antgoods123/config/.gitignore delete mode 100755 antgoods123/config/bootstrap.php delete mode 100755 antgoods123/config/main.php delete mode 100755 antgoods123/config/params.php delete mode 100644 antgoods123/controllers/AttributeController.php delete mode 100644 antgoods123/controllers/BrandController.php delete mode 100644 antgoods123/controllers/CategoryController.php delete mode 100755 antgoods123/controllers/ConfigController.php delete mode 100644 antgoods123/controllers/GoodsController.php delete mode 100644 antgoods123/controllers/ShopCategoryController.php delete mode 100755 antgoods123/controllers/SiteController.php delete mode 100644 antgoods123/controllers/SupplierController.php delete mode 100644 antgoods123/logic/goods/GoodsManager.php delete mode 100644 antgoods123/migrations/m191119_021851_create_table_shop_category.php delete mode 100644 antgoods123/migrations/m191119_022641_create_table_category.php delete mode 100644 antgoods123/migrations/m191119_022939_create_table_attribute.php delete mode 100644 antgoods123/migrations/m191119_023115_create_table_goods_attr.php delete mode 100644 antgoods123/migrations/m191119_024029_create_table_brand.php delete mode 100644 antgoods123/migrations/m191119_024205_create_table_goods.php delete mode 100644 antgoods123/migrations/m191119_024345_create_table_goods_sku.php delete mode 100644 antgoods123/migrations/m191119_025607_create_table_supplier.php delete mode 100644 antgoods123/migrations/m191119_025843_create_table_filter_attr.php delete mode 100644 antgoods123/migrations/m191125_012449_update_column_icon_type_in_antgoods_category.php delete mode 100644 antgoods123/migrations/m191125_083820_drop_column_icon_type_in_table_antgoods_category.php delete mode 100644 antgoods123/migrations/m191125_084547_update_column_pid_and_icon_in_table_antgoods_category.php delete mode 100644 antgoods123/migrations/m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category.php delete mode 100644 antgoods123/migrations/m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category.php delete mode 100644 antgoods123/migrations/m191127_114228_add_column_is_manaul_in_table_antgoods_goods_sku.php delete mode 100644 antgoods123/migrations/m191129_010349_add_column_sku_mode_in_antgoods_goods.php delete mode 100644 antgoods123/migrations/m191129_020131_add_columns_goods_id_and_attr_id_in_table_antgoods_goods_attr.php delete mode 100644 antgoods123/migrations/m191130_004933_add_column_cat_id_in_table_antgoods_attribute.php delete mode 100644 antgoods123/migrations/m191202_082041_drop_columns_in_table_antgoods_goods_sku.php delete mode 100755 antgoods123/migrations/sql/goods.sql delete mode 100755 antgoods123/migrations/sql/goods_sku.sql delete mode 100755 antgoods123/models/.gitkeep delete mode 100644 antgoods123/models/ars/Attribute.php delete mode 100644 antgoods123/models/ars/Brand.php delete mode 100644 antgoods123/models/ars/Category.php delete mode 100644 antgoods123/models/ars/FilterAttr.php delete mode 100644 antgoods123/models/ars/Goods.php delete mode 100644 antgoods123/models/ars/GoodsAttr.php delete mode 100644 antgoods123/models/ars/GoodsSku.php delete mode 100644 antgoods123/models/ars/ShopCategory.php delete mode 100644 antgoods123/models/ars/Supplier.php delete mode 100644 antgoods123/models/searchs/AttributeSearch.php delete mode 100644 antgoods123/models/searchs/BrandSearch.php delete mode 100644 antgoods123/models/searchs/CategorySearch.php delete mode 100644 antgoods123/models/searchs/GoodsSearch.php delete mode 100644 antgoods123/models/searchs/ShopCategorySearch.php delete mode 100644 antgoods123/models/searchs/SupplierSearch.php delete mode 100644 antgoods123/views/attribute/_form.php delete mode 100644 antgoods123/views/attribute/_search.php delete mode 100644 antgoods123/views/attribute/create.php delete mode 100644 antgoods123/views/attribute/index.php delete mode 100644 antgoods123/views/attribute/update.php delete mode 100644 antgoods123/views/attribute/view.php delete mode 100644 antgoods123/views/brand/_form.php delete mode 100644 antgoods123/views/brand/_search.php delete mode 100644 antgoods123/views/brand/create.php delete mode 100644 antgoods123/views/brand/index.php delete mode 100644 antgoods123/views/brand/update.php delete mode 100644 antgoods123/views/brand/view.php delete mode 100644 antgoods123/views/category/_form.php delete mode 100644 antgoods123/views/category/_search.php delete mode 100644 antgoods123/views/category/create.php delete mode 100644 antgoods123/views/category/index.php delete mode 100644 antgoods123/views/category/update.php delete mode 100644 antgoods123/views/category/view.php delete mode 100755 antgoods123/views/config/index.php delete mode 100644 antgoods123/views/goods/_form.php delete mode 100644 antgoods123/views/goods/_search.php delete mode 100755 antgoods123/views/goods/attribute.php delete mode 100644 antgoods123/views/goods/create.php delete mode 100755 antgoods123/views/goods/filter_attribute.php delete mode 100644 antgoods123/views/goods/goods.php delete mode 100644 antgoods123/views/goods/index.php delete mode 100644 antgoods123/views/goods/new_editor.php delete mode 100644 antgoods123/views/goods/picture.php delete mode 100644 antgoods123/views/goods/sku_edit.php delete mode 100644 antgoods123/views/goods/update.php delete mode 100644 antgoods123/views/goods/view.php delete mode 100755 antgoods123/views/layouts/base.php delete mode 100755 antgoods123/views/layouts/breadcrumb.php delete mode 100755 antgoods123/views/layouts/footer.php delete mode 100755 antgoods123/views/layouts/header.php delete mode 100755 antgoods123/views/layouts/main.php delete mode 100755 antgoods123/views/layouts/sidebar.php delete mode 100644 antgoods123/views/shop-category/_form.php delete mode 100644 antgoods123/views/shop-category/_search.php delete mode 100644 antgoods123/views/shop-category/create.php delete mode 100644 antgoods123/views/shop-category/index.php delete mode 100644 antgoods123/views/shop-category/update.php delete mode 100644 antgoods123/views/shop-category/view.php delete mode 100755 antgoods123/views/site/error.php delete mode 100755 antgoods123/views/site/index.php delete mode 100755 antgoods123/views/site/login.php delete mode 100755 antgoods123/views/site/test.php delete mode 100644 antgoods123/views/supplier/_form.php delete mode 100644 antgoods123/views/supplier/_search.php delete mode 100644 antgoods123/views/supplier/create.php delete mode 100644 antgoods123/views/supplier/index.php delete mode 100644 antgoods123/views/supplier/update.php delete mode 100644 antgoods123/views/supplier/view.php delete mode 100755 antgoods123/web/.gitignore delete mode 100755 antgoods123/web/assets/.gitignore delete mode 100755 antgoods123/web/css/reset.css delete mode 100755 antgoods123/web/css/site.css delete mode 100644 antgoods123/web/custom/sku.49a56a9198d9c3ec233c.js delete mode 100644 antgoods123/web/custom/sku.52802ed907a316501cd7.js delete mode 100644 antgoods123/web/custom/sku.9a46222d01b3d601e5ad.js delete mode 100644 antgoods123/web/custom/sku_item.6649e882bedbeb22ea3d.js delete mode 100755 antgoods123/web/favicon.ico delete mode 100755 antgoods123/web/img/avatar.png delete mode 100755 antgoods123/web/img/avatar04.png delete mode 100755 antgoods123/web/img/avatar2.png delete mode 100755 antgoods123/web/img/avatar3.png delete mode 100755 antgoods123/web/img/avatar5.png delete mode 100755 antgoods123/web/img/credit/american-express.png delete mode 100755 antgoods123/web/img/credit/cirrus.png delete mode 100755 antgoods123/web/img/credit/mastercard.png delete mode 100755 antgoods123/web/img/credit/mestro.png delete mode 100755 antgoods123/web/img/credit/paypal.png delete mode 100755 antgoods123/web/img/credit/paypal2.png delete mode 100755 antgoods123/web/img/credit/visa.png delete mode 100755 antgoods123/web/img/default-50x50.gif delete mode 100755 antgoods123/web/img/icons.png delete mode 100755 antgoods123/web/img/logo.jpeg delete mode 100755 antgoods123/web/img/photo1.png delete mode 100755 antgoods123/web/img/photo2.png delete mode 100755 antgoods123/web/img/photo3.jpg delete mode 100755 antgoods123/web/img/photo4.jpg delete mode 100755 antgoods123/web/img/user1-128x128.jpg delete mode 100755 antgoods123/web/img/user2-160x160.jpg delete mode 100755 antgoods123/web/img/user3-128x128.jpg delete mode 100755 antgoods123/web/img/user4-128x128.jpg delete mode 100755 antgoods123/web/img/user5-128x128.jpg delete mode 100755 antgoods123/web/img/user6-128x128.jpg delete mode 100755 antgoods123/web/img/user7-128x128.jpg delete mode 100755 antgoods123/web/img/user8-128x128.jpg delete mode 100755 antgoods123/web/js/common.js delete mode 100755 antgoods123/web/js/jquery.js delete mode 100755 antgoods123/web/js/jquery.min.js diff --git a/antgoods123/.gitignore b/antgoods123/.gitignore deleted file mode 100755 index 4b9a47c..0000000 --- a/antgoods123/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -cert -runtime diff --git a/antgoods123/assets/AppAsset.php b/antgoods123/assets/AppAsset.php deleted file mode 100755 index 1ba7e78..0000000 --- a/antgoods123/assets/AppAsset.php +++ /dev/null @@ -1,26 +0,0 @@ - 'antgoods', - 'basePath' => dirname(__DIR__), - 'controllerNamespace' => 'antgoods\controllers', - 'bootstrap' => ['log'], - 'defaultRoute' => '/category', - 'modules' => [ - ], - 'components' => [ - 'request' => [ - 'parsers' => [ - 'application/json' => 'yii\web\JsonParser', - ], - 'csrfParam' => '_csrf-api', - ], - 'user' => [ - 'identityClass' => 'common\models\User', - 'enableAutoLogin' => true, - 'identityCookie' => ['name' => '_identity-antgoods', 'httpOnly' => true], - ], - 'session' => [ - // this is the name of the session cookie used for login on the app - 'name' => 'antgoods', - ], - 'log' => [ - 'traceLevel' => YII_DEBUG ? 3 : 0, - 'targets' => [ - [ - 'class' => 'yii\log\FileTarget', - 'levels' => ['error', 'warning'], - ], - [ - 'class' => 'yii\log\FileTarget', - 'levels' => ['info', 'error'], - 'categories' => ['imagetest'], - 'logFile' => '@app/runtime/logs/imagetest.log', - 'logVars' => [], - 'exportInterval' => 1, - 'prefix' => function ($message) { - } - ], - ], - ], - 'errorHandler' => [ - 'errorAction' => 'site/error', - ], - 'urlManager' => [ - 'enablePrettyUrl' => true, - 'showScriptName' => false, - 'rules' => [ - ], - ], - 'file' => ['class' => 'backend\logic\file\FileManager'], - ], - 'params' => $params, -]; diff --git a/antgoods123/config/params.php b/antgoods123/config/params.php deleted file mode 100755 index 7f754b9..0000000 --- a/antgoods123/config/params.php +++ /dev/null @@ -1,4 +0,0 @@ - 'admin@example.com', -]; diff --git a/antgoods123/controllers/AttributeController.php b/antgoods123/controllers/AttributeController.php deleted file mode 100644 index 18061b6..0000000 --- a/antgoods123/controllers/AttributeController.php +++ /dev/null @@ -1,170 +0,0 @@ - [ - '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(); - $model->sort_order = 0; - $model->cat_id = 0; - - if ($model->load(Yii::$app->request->post()) && $model->validate()) { - $model->value = str_replace(',', ',', $model->value); - $array = explode(',', $model->value); - if (count($array) != count(array_unique($array))) { - \Yii::$app->getSession()->setFlash('error', '不能有相同的属性值'); - return $this->render('create', ['model' => $model]); - } - if ($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->validate()) { - $model->value = str_replace(',', ',', $model->value); - $array = explode(',', $model->value); - if (count($array) != count(array_unique($array))) { - \Yii::$app->getSession()->setFlash('error', '不能有相同的属性值'); - return $this->render('create', ['model' => $model]); - } - if ($model->save()) { - return $this->redirect(['index']); - } - 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) - { - $model = $this->findModel($id); - $model->is_delete = Attribute::IS_DELETE_YES; - $model->save(); - - 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/antgoods123/controllers/BrandController.php b/antgoods123/controllers/BrandController.php deleted file mode 100644 index af957b2..0000000 --- a/antgoods123/controllers/BrandController.php +++ /dev/null @@ -1,151 +0,0 @@ - [ - '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) - { - $model = $this->findModel($id); - $model->is_delete = Brand::IS_DELETE_YES; - $model->save(); - - 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/antgoods123/controllers/CategoryController.php b/antgoods123/controllers/CategoryController.php deleted file mode 100644 index fcc2366..0000000 --- a/antgoods123/controllers/CategoryController.php +++ /dev/null @@ -1,276 +0,0 @@ - [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['POST'], - ], - ], - ]; - } - - public function actions() - { - return [ - 'upload' => [ - 'class' => 'iron\actions\UploadAction', - 'path' => 'xls/', - 'maxSize' => 20480, - ] - ]; - } - - /** - * 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(); - $model->is_show = Category::IS_SHOW_DISPLAY; - $model->sort_order = 0; - - if ($model->load(Yii::$app->request->post()) && $model->validate()) { - - //类目图片上传保存处理 - $icon_image_id_str = $model->iconImageId; - $model->save(); - $save_icon_image_res = GoodsManager::saveFile(explode(',', $icon_image_id_str), $model, [], File::OWN_TYPE_CATEGORY_ICON); - if($save_icon_image_res['status']){ - $model->icon = $save_icon_image_res['first_file_id']; - $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); - $model->iconImageId = $model->icon; - //记录已保存的类目图片id,用于修改 - $icon_image_old_id_arr = $model->icon; - - if ($model->load(Yii::$app->request->post()) && $model->validate()) { - - //类目图片上传保存处理 - $icon_image_id_str = $model->iconImageId; - $model->save(); - $save_icon_image_res = GoodsManager::saveFile(explode(',', $icon_image_id_str), $model, explode(',', $icon_image_old_id_arr), File::OWN_TYPE_CATEGORY_ICON); - if($save_icon_image_res['status'] && $save_icon_image_res['first_file_id'] !== 0){ - $model->icon = $save_icon_image_res['first_file_id']; - $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) - { - $model = $this->findModel($id); - - $model->is_delete = Category::IS_DELETE_YES; - $model->save(); - - 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() - ]); - } - - /** - * 处理文件上传成功后回调保存到临时文件表中,并返回临时文件id - */ - public function actionSaveFile() - { - if(!class_exists('\common\models\ars\TemFile') || !class_exists('\backend\logic\file\FileManager')){ - return ''; - } - - $data = Yii::$app->request->get('data'); - $file_name = Yii::$app->request->get('fileName')[0]; - - if ($data['status'] == true) { - $model = new \common\models\ars\TemFile(); - $model->user_id = Yii::$app->user->identity->id; - $model->name = $file_name; - $file_manager = new \backend\logic\file\FileManager(); - $type_res = $file_manager->searchType(\backend\logic\file\FileManager::$extension, pathinfo($data['path'])['extension']); - if ($type_res['status']) { - $model->type = $type_res['type']; - } - $model->alias = $data['alias']; - $model->path = $data['path']; - $model->save(); - return $model->id; - } - } - - /** - * @return string - * 点击删除按钮时同时删除字符串中的id - */ - public function actionImgIdDel() - { - //判断该类是否存在 - if(!class_exists('\common\models\ars\TemFile') || !class_exists('\common\models\ars\File')){ - return ''; - } - - $img_id = Yii::$app->request->get('imgid'); - $img_id_arr = explode(',', $img_id); - if(isset(Yii::$app->request->get('data')['alias'])) { - $alias = Yii::$app->request->get('data')['alias']; - $tem_file = \common\models\ars\TemFile::findOne(['alias' => $alias]); - if ($tem_file) { - $img_id_arr = array_diff($img_id_arr, [$tem_file->id]); - } - }else{ - foreach (Yii::$app->request->get() as $key => $value) { - $tem_file = \common\models\ars\File::findOne(['alias' => $value]); - if ($tem_file) { - $img_id_arr = array_diff($img_id_arr, [$tem_file->id]); - } - } - } - $img_id_str = implode(',', $img_id_arr); - return $img_id_str; - } - - /** - * @return bool|false|string - * 加载已有的文件 - */ - public function actionImageFile() - { - //判断该类是否存在 - if(!class_exists('\common\models\ars\File')){ - return false; - } - - $file_id_str = Yii::$app->request->get('fileidstr'); - $file_id_arr = explode(',', $file_id_str); - $data = \common\models\ars\File::find()->where(['id' => $file_id_arr])->all(); - $res = array(); - if($data) { - $i = 0; - foreach ($data as $key => $value) { - $res[$i]['name'] = $value->alias; - $res[$i]['path'] = Yii::$app->request->hostInfo . '/' . $value->path; - $res[$i]['size'] = filesize($value->path); - $i++; - } - } - return json_encode($res); - } -} diff --git a/antgoods123/controllers/ConfigController.php b/antgoods123/controllers/ConfigController.php deleted file mode 100755 index 4ae8433..0000000 --- a/antgoods123/controllers/ConfigController.php +++ /dev/null @@ -1,76 +0,0 @@ - [ - '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/antgoods123/controllers/GoodsController.php b/antgoods123/controllers/GoodsController.php deleted file mode 100644 index c2891cc..0000000 --- a/antgoods123/controllers/GoodsController.php +++ /dev/null @@ -1,359 +0,0 @@ - [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['POST'], - ], - ], - ]; - } - - public function actions() - { - return [ - 'upload' => [ - 'class' => 'iron\actions\UploadAction', - 'path' => 'xls/', - 'maxSize' => 20480, - ], - 'ueditor' => [ - 'class' => 'common\widgets\ueditor\UeditorAction', - 'config' => [ - //上传图片配置 - 'imageUrlPrefix' => "", /* 图片访问路径前缀 */ - 'imagePathFormat' => "/uploads/origin/introduce/" . md5(time() . rand(000, 999)), /* 上传保存路径,可以自定义保存路径和文件名格式 */ - ] - ], - ]; - } - - /** - * 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(); - $model->is_sale = Goods::IS_SALE_YES; - $model->stock = -1; - if ($model->load(Yii::$app->request->post()) && $model->validate()) { - //商品封面图和商品详情图上传保存处理 - $res = GoodsManager::updateGoods(Yii::$app->request->post(), $model); - if ($res['status']) { - return $this->redirect('index'); - } - } else { - $model->ruleVerify = 1; - } - 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); - $model->coverImageId = $model->image; - $model->detailImageId = implode(',', File::find()->select('id')->where(['is_delete' => File::IS_DELETE_NO, 'own_id' => $model->id, 'own_type' => File::OWN_TYPE_GOODS_DETAILS])->column()); - //记录已保存的商品图片id,用于修改 - $cover_image_old_id_str = $model->image; - $detail_image_old_id_str = $model->detailImageId; - if ($model->load(Yii::$app->request->post()) && $model->validate()) { - //商品封面图和商品详情图上传保存处理 - $res = GoodsManager::updateGoods(Yii::$app->request->post(), $model, $cover_image_old_id_str, $detail_image_old_id_str); - if ($res['status']) { - return $this->redirect('index'); - } - } - $attributeModel = GoodsManager::getAttribute($id); - $checkAttr = GoodsManager::getSkuInfo($id); - $filterAttributeModel = GoodsManager::getFilterAttribute($id); - $judgeGoodsCategory = GoodsManager::judgeGoodsCategory($model); - return $this->render('update', [ - 'model' => $model, - 'attributeModel' => $attributeModel, - 'attrValue' => $checkAttr, - 'filterAttributeModel' => $filterAttributeModel, - 'judgeGoodsCategory' => $judgeGoodsCategory, - ]); - } - - /** - * 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) - { - $model = $this->findModel($id); - $model->is_delete = Goods::IS_DELETE_YES; - $model->save(); - - 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() - ]); - } - - /** - * 处理文件上传成功后回调保存到临时文件表中,并返回临时文件id - */ - public function actionSaveFile() - { - if(!class_exists('\common\models\ars\TemFile') || !class_exists('\backend\logic\file\FileManager')){ - return ''; - } - - $data = Yii::$app->request->get('data'); - $file_name = Yii::$app->request->get('fileName')[0]; - - if ($data['status'] == true) { - $model = new \common\models\ars\TemFile(); - $model->user_id = Yii::$app->user->identity->id; - $model->name = $file_name; - $file_manager = new \backend\logic\file\FileManager(); - $type_res = $file_manager->searchType(\backend\logic\file\FileManager::$extension, pathinfo($data['path'])['extension']); - if ($type_res['status']) { - $model->type = $type_res['type']; - } - $model->alias = $data['alias']; - $model->path = $data['path']; - $model->save(); - return $model->id; - } - } - - /** - * @return string - * 点击删除按钮时同时删除字符串中的id - */ - public function actionImgIdDel() - { - //判断该类是否存在 - if(!class_exists('\common\models\ars\TemFile') || !class_exists('\common\models\ars\File')){ - return ''; - } - - $img_id = Yii::$app->request->get('imgid'); - $img_id_arr = explode(',', $img_id); - if(isset(Yii::$app->request->get('data')['alias'])) { - $alias = Yii::$app->request->get('data')['alias']; - $tem_file = \common\models\ars\TemFile::findOne(['alias' => $alias]); - if ($tem_file) { - $img_id_arr = array_diff($img_id_arr, [$tem_file->id]); - } - }else{ - foreach (Yii::$app->request->get() as $key => $value) { - $tem_file = \common\models\ars\File::findOne(['alias' => $value]); - if ($tem_file) { - $img_id_arr = array_diff($img_id_arr, [$tem_file->id]); - } - } - } - $img_id_str = implode(',', $img_id_arr); - return $img_id_str; - } - - /** - * @return bool|false|string - * 加载已有的文件 - */ - public function actionImageFile() - { - //判断该类是否存在 - if(!class_exists('\common\models\ars\File')){ - return false; - } - - $rule_verify = Yii::$app->request->get('ruleverify'); - $file_id_str = Yii::$app->request->get('fileidstr'); - $file_id_arr = explode(',', $file_id_str); - if ($rule_verify == 1) { - $data = \common\models\ars\TemFile::find()->where(['id' => $file_id_arr])->all(); - } else { - $data = \common\models\ars\File::find()->where(['id' => $file_id_arr])->all(); - } - $res = array(); - if($data) { - $i = 0; - foreach ($data as $key => $value) { - $res[$i]['name'] = $value->alias; - $res[$i]['path'] = Yii::$app->request->hostInfo . '/' . $value->path; - $res[$i]['size'] = filesize($value->path); - $i++; - } - } - return json_encode($res); - } - - /** - * @param $id - * @return string - * 商品编辑sku - */ - - public function actionEditSku($id) - { - $sku = GoodsManager::getCreatedSku($id); - $attributes = GoodsManager::getAttrs($id); - return $this->render('sku_edit', [ - 'attributes' => $attributes, - 'sku' => $sku,]); - } - - /** - * @return array - * @throws \Throwable - * 添加sku - */ - public function actionAddSku() - { - $data = []; - Yii::$app->response->format = 'json'; - $res = Yii::$app->request->post('sku'); - $goodsId = Yii::$app->request->post('goodsId'); - $tra = Yii::$app->db->beginTransaction(); - try { - $data['originalIds'] = GoodsManager::getOriginalIds($res['type'], $goodsId); - $data['acceptIds'] = []; - foreach ($res['data'] as $sku) { - GoodsManager::AddOrUpdateData($sku, $res['type'], $goodsId); - if ($sku['id'] > 0) { - $data['acceptIds'][] = $sku['id']; - } - } - GoodsManager::deleteSku($res['type'], $data, $goodsId); - $tra->commit(); - return ['status' => true]; - } catch (\Exception $e) { - $tra->rollBack(); - return ['status' => false, 'info' => $e->getMessage()]; - } - } - - public function actionSwitch() - { - Yii::$app->response->format = 'json'; - $data = []; - $type = Yii::$app->request->get('type'); - $id = Yii::$app->request->get('goodsId'); - $data['sku'] = GoodsManager::getCreatedSku($id, $type); - $data['attributes'] = GoodsManager::getAttrs($id, $type); - return $data; - } - - /** - * @return false|string - * 根据商品分类获取商品属性 - */ - public function actionFilterAttribute() - { - $catId = Yii::$app->request->get('catId')??0; - $goodsId = Yii::$app->request->get('goodsId')??0; - $allAttr = Attribute::find()->where(['type' => Attribute::TYPE_ATTR])->andWhere(['cat_id' => [0,$catId]])->asArray()->all(); - return json_encode($allAttr); - } -} diff --git a/antgoods123/controllers/ShopCategoryController.php b/antgoods123/controllers/ShopCategoryController.php deleted file mode 100644 index 3a32b55..0000000 --- a/antgoods123/controllers/ShopCategoryController.php +++ /dev/null @@ -1,287 +0,0 @@ - [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['POST'], - ], - ], - ]; - } - - public function actions() - { - return [ - 'upload' => [ - 'class' => 'iron\actions\UploadAction', - 'path' => 'xls/', - 'maxSize' => 20480, - ] - ]; - } - - /** - * 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(); - $model->is_show = ShopCategory::IS_SHOW_HIDE; - $model->sort_order = 0; - - if ($model->load(Yii::$app->request->post())) { - if ($model->filter_attr != null && is_array($model->filter_attr)) { - $model->filter_attr = implode(',', $model->filter_attr); - } else { - $model->filter_attr = ''; - } - - //类目图片上传保存处理 - $icon_image_id_str = $model->iconImageId; - $model->save(); - $save_icon_image_res = GoodsManager::saveFile(explode(',', $icon_image_id_str), $model, [], File::OWN_TYPE_CATEGORY_ICON); - if($save_icon_image_res['status']){ - $model->icon = $save_icon_image_res['first_file_id']; - $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->filter_attr != null) { - $model->filter_attr = explode(',', $model->filter_attr); - } - $model->iconImageId = $model->icon; - $icon_image_old_id_arr = $model->icon;//记录已保存的类目图片id,用于修改 - - if ($model->load(Yii::$app->request->post())) { - if ($model->filter_attr != null && is_array($model->filter_attr)) { - $model->filter_attr = implode(',', $model->filter_attr); - } else { - $model->filter_attr = ''; - } - - //类目图片上传保存处理 - $icon_image_id_str = $model->iconImageId; - $model->save(); - $save_icon_image_res = GoodsManager::saveFile(explode(',', $icon_image_id_str), $model, explode(',', $icon_image_old_id_arr), File::OWN_TYPE_CATEGORY_ICON); - if($save_icon_image_res['status'] && $save_icon_image_res['first_file_id'] !== 0){ - $model->icon = $save_icon_image_res['first_file_id']; - $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) - { - $model = $this->findModel($id); - $model->is_delete = ShopCategory::IS_DELETE_YES; - $model->save(); - - 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() - ]); - } - - /** - * 处理文件上传成功后回调保存到临时文件表中,并返回临时文件id - */ - public function actionSaveFile() - { - if(!class_exists('\common\models\ars\TemFile') || !class_exists('\backend\logic\file\FileManager')){ - return ''; - } - - $data = Yii::$app->request->get('data'); - $file_name = Yii::$app->request->get('fileName')[0]; - - if ($data['status'] == true) { - $model = new \common\models\ars\TemFile(); - $model->user_id = Yii::$app->user->identity->id; - $model->name = $file_name; - $file_manager = new \backend\logic\file\FileManager(); - $type_res = $file_manager->searchType(\backend\logic\file\FileManager::$extension, pathinfo($data['path'])['extension']); - if ($type_res['status']) { - $model->type = $type_res['type']; - } - $model->alias = $data['alias']; - $model->path = $data['path']; - $model->save(); - return $model->id; - } - } - - /** - * @return string - * 点击删除按钮时同时删除字符串中的id - */ - public function actionImgIdDel() - { - //判断该类是否存在 - if(!class_exists('\common\models\ars\TemFile') || !class_exists('\common\models\ars\File')){ - return ''; - } - - $img_id = Yii::$app->request->get('imgid'); - $img_id_arr = explode(',', $img_id); - if(isset(Yii::$app->request->get('data')['alias'])) { - $alias = Yii::$app->request->get('data')['alias']; - $tem_file = \common\models\ars\TemFile::findOne(['alias' => $alias]); - if ($tem_file) { - $img_id_arr = array_diff($img_id_arr, [$tem_file->id]); - } - }else{ - foreach (Yii::$app->request->get() as $key => $value) { - $tem_file = \common\models\ars\File::findOne(['alias' => $value]); - if ($tem_file) { - $img_id_arr = array_diff($img_id_arr, [$tem_file->id]); - } - } - } - $img_id_str = implode(',', $img_id_arr); - return $img_id_str; - } - - /** - * @return bool|false|string - * 加载已有的文件 - */ - public function actionImageFile() - { - //判断该类是否存在 - if(!class_exists('\common\models\ars\File')){ - return false; - } - - $file_id_str = Yii::$app->request->get('fileidstr'); - $file_id_arr = explode(',', $file_id_str); - $data = \common\models\ars\File::find()->where(['id' => $file_id_arr])->all(); - $res = array(); - if($data) { - $i = 0; - foreach ($data as $key => $value) { - $res[$i]['name'] = $value->alias; - $res[$i]['path'] = Yii::$app->request->hostInfo . '/' . $value->path; - $res[$i]['size'] = filesize($value->path); - $i++; - } - } - return json_encode($res); - } -} diff --git a/antgoods123/controllers/SiteController.php b/antgoods123/controllers/SiteController.php deleted file mode 100755 index 155c9f8..0000000 --- a/antgoods123/controllers/SiteController.php +++ /dev/null @@ -1,112 +0,0 @@ - [ - 'class' => AccessControl::className(), - 'rules' => [ - [ - 'actions' => ['login', 'error', 'test'], - 'allow' => true, - ], - [ - 'actions' => ['logout', 'index'], - 'allow' => true, - 'roles' => ['@'], - ], - ], - ], - 'verbs' => [ - 'class' => VerbFilter::className(), - 'actions' => [ -// 'logout' => ['post'], - ], - ], - ]; - } - - /** - * {@inheritdoc} - */ - public function actions() { - return [ - 'error' => [ - 'class' => 'yii\web\ErrorAction', - ], - 'upload'=>[ - 'class'=>'iron\actions\UploadAction', - ] - ]; - } - - /** - * Displays homepage. - * - * @return string - */ - public function actionIndex() { - return $this->render('index'); - } - - /** - * Login action. - * - * @return string - */ - public function actionLogin() { - - $this->layout = 'base'; - - if (!Yii::$app->user->isGuest) { - return $this->goHome(); - } - - $model = new LoginForm(); - if ($model->load(Yii::$app->request->post()) && $model->login()) { - return $this->goBack(); - } else { - $model->password = ''; - - return $this->render('login', [ - 'model' => $model, - ]); - } - } - - /** - * Logout action. - * - * @return string - */ - public function actionLogout() { - Yii::$app->user->logout(); - - return $this->goHome(); - } - - public function actionTest() { - $searchModel = new CategorySearch(); - return $this->render('test', [ - 'name' => 'blobt', - 'model' => $searchModel - ]); - } - -} diff --git a/antgoods123/controllers/SupplierController.php b/antgoods123/controllers/SupplierController.php deleted file mode 100644 index 67c067b..0000000 --- a/antgoods123/controllers/SupplierController.php +++ /dev/null @@ -1,151 +0,0 @@ - [ - '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) - { - $model = $this->findModel($id); - $model->is_delete = Supplier::IS_DELETE_YES; - $model->save(); - - 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/antgoods123/logic/goods/GoodsManager.php b/antgoods123/logic/goods/GoodsManager.php deleted file mode 100644 index c9d134d..0000000 --- a/antgoods123/logic/goods/GoodsManager.php +++ /dev/null @@ -1,578 +0,0 @@ - false, 'info' => '操作失败']; - } - - //需要新建的文件id - $createFileIdArr = array_diff($newFileIdArr, $oldFileIdArr); - - //创建文件 - $class = new \backend\logic\file\FileManager(); - $createFileRes = $class->saveTemFileToFile($createFileIdArr, $goodsModel->id, $fileType); - - //需要删除的文件id - $delFileIdArr = array_diff($oldFileIdArr, $newFileIdArr); - - //删除文件 - $class->deleteFile($delFileIdArr); - - //记录第一张图片id - $firstFileId = 0; - - //查看修改数组是否为空 - if (!$newFileIdArr[0]) { - $firstFileId = null; - }else { - if ($createFileRes['status']) { - $firstFileId = $createFileRes['first_file_id']; - } - } - - return ['status' => true, 'info' => '操作成功', 'first_file_id' => $firstFileId]; - } - - /** - * @param $data - * @param $model - * @param null $coverImageOldIdStr - * @param null $detailImageOldIdStr - * @return array - * @throws \Throwable - * 创建修改商品操作 - */ - public static function updateGoods($data, $model, $coverImageOldIdStr = null, $detailImageOldIdStr = null) - { - $attribute = $data['attribute']; - $filterAttribute = $data['filterattribute']; - $tra = Yii::$app->db->beginTransaction(); - try { - if (!$model->save()) { - throw new Exception(''); - } - $saveCoverImageRes = self::saveFile(explode(',', $model->coverImageId), $model, explode(',', $coverImageOldIdStr)); - $saveDetailImageRes = self::saveFile(explode(',', $model->detailImageId), $model, explode(',', $detailImageOldIdStr), File::OWN_TYPE_GOODS_DETAILS); - if ($saveCoverImageRes['status'] && $saveDetailImageRes['status']) { - if($saveCoverImageRes['first_file_id'] !== 0) { - $model->image = $saveCoverImageRes['first_file_id']; - if (!$model->save()) { - throw new Exception('图片保存失败'); - } - } - } else { - throw new Exception('图片保存失败'); - } - self::addAttributeOperating(['id' => $model->id, 'attribute' => $attribute]); - self::addFilterAttributeOperating(['id' => $model->id, 'filterAttribute' => $filterAttribute]); - $tra->commit(); - return ['status' => true]; - } catch (\yii\base\Exception $e) { - $tra->rollBack(); - return ['status' => false, 'info' => $e->getMessage()]; - } - } - - /** - * @param $data - * @return bool - * @throws Exception - * 创建修改商品属性操作 - */ - public static function addAttributeOperating($data) - { - if (!$data['attribute']) { - return true; - } - $data['attribute'] = json_decode($data['attribute'], true); - $oldAttr = []; - $goodsAttr = GoodsAttr::find()->where(['goods_id' => $data['id'], 'is_delete' => GoodsAttr::IS_DELETE_NO])->all(); - if ($goodsAttr) { //如果商品有旧的属性 - if(count($data['attribute']) == 0 && is_array($data['attribute'])) { //如果传上来的是空数组,删除该商品下的全部属性 - self::delAttribute($goodsAttr); - return true; - } - foreach ($goodsAttr as $key => $value) { //把旧的商品属性保存到一个数组 - $oldAttr[$value->id] = $value->attr_value; - } - } - $newAttr = self::addAttribute($data['attribute'], $data['id']); //添加新的商品属性 - $delAttr = array_diff(array_keys($oldAttr), array_keys($newAttr)); //找出需要删除的goodsAttrId - if (!$delAttr) { - return true; - } - foreach ($delAttr as $value) { - $model = GoodsAttr::find()->where(['id' => $value, 'is_delete' => GoodsAttr::IS_DELETE_NO])->One(); - if ($model) { - $model->is_delete = GoodsAttr::IS_DELETE_YES; - if (!$model->save()) { - throw new Exception('goodsAttribute delete false'); - } - } - } - } - - /** - * @param $goodsAttr - * @throws Exception - * 删除商品属性 - */ - public static function delAttribute($goodsAttr) - { - foreach ($goodsAttr as $key => $value) { - $value->is_delete = GoodsAttr::IS_DELETE_YES; - if (!$value->save()) { - throw new Exception('goods attribute delete false'); - } - } - } - - /** - * @param $attribute - * @param $goodsId - * @return array - * @throws Exception - * 保存商品属性 - */ - public static function addAttribute($attribute, $goodsId) - { - $newAttr = []; - if (!$attribute) { - return []; - } - foreach ($attribute as $value) { - foreach ($value['value'] as $k => $v) { - $goodsAttrModel = new GoodsAttr(); - $goodsAttrModel->attr_id = $value['id']; - $attr = GoodsAttr::find()->where(['goods_id' => $goodsId, 'attr_id' => $value['id'], 'attr_value' => $v, 'is_delete' => GoodsAttr::IS_DELETE_NO])->one(); - if ($attr) { - $newAttr[$attr->id] = $attr->attr_value; //原有的数据 - } else { - $goodsAttrModel->goods_id = $goodsId; - $goodsAttrModel->attr_value = $v; - if (!$goodsAttrModel->save()) { - throw new Exception('goodsAttribute save false'); - } - $newAttr[$goodsAttrModel->id] = $goodsAttrModel->attr_value; //新增的数据 - } - } - } - return $newAttr; - } - - /** - * @param $id - * @return Attribute|array|null - * 获取属性信息 - */ - public static function getAttribute($id) - { - $goodsAttributes = GoodsAttr::find()->where(['goods_id' => $id, 'is_delete' => GoodsAttr::IS_DELETE_NO])->andWhere(['!=', 'attr_id', 0])->all(); - $filter = []; - $goodsAttributeModel = []; - if (!$goodsAttributes) { - return $goodsAttributeModel; - } - foreach ($goodsAttributes as $key => $value) { - $attribute = Attribute::findOne($value->attr_id); - if (!in_array($attribute->name, $filter)) { - $filter[] = $attribute->name; - $attribute = ['name' => $attribute->name, 'id' => $attribute->id, 'value' => [$value->attr_value]]; - $goodsAttributeModel[] = $attribute; - } else { - foreach ($goodsAttributeModel as $k => $v) { - if ($v['name'] == $attribute->name) { - $goodsAttributeModel[$k]['value'][] = $value->attr_value; - } - } - } - } - return $goodsAttributeModel; - } - - /** - * @param $id - * @return array - * 获取sku信息 - */ - public static function getSkuInfo($id) - { - $skus = GoodsSku::find()->where(['goods_id' => $id, 'is_delete' => GoodsSku::IS_DELETE_NO])->all(); - $attrId = []; - foreach ($skus as $sku) { - $attrId = array_merge(explode(',', $sku->goods_attr), $attrId); - } - $attrs = GoodsAttr::find()->where(['id' => $attrId, 'is_delete' => GoodsAttr::IS_DELETE_NO])->andWhere(['!=', 'attr_id', 0])->all(); - $checkAttr = []; - $filterAttr = []; - foreach ($attrs as $value) { - $attr = Attribute::findOne(['id' => $value->attr_id, 'is_delete' => Attribute::IS_DELETE_NO]); - if (!in_array($attr->name, $filterAttr)) { - $filterAttr[] = $attr->name; - $newAttr = ['id' => $attr->id, 'name' => $attr->name, 'value' => [$value->attr_value]]; - $checkAttr[] = $newAttr; - } else { - foreach ($checkAttr as $key => $item) { - if ($item['name'] == $attr->name) { //如果attr_id与$filter的attr_id相符,入栈 - $checkAttr[$key]['value'][] = $value->attr_value; - } - } - } - } - return $checkAttr; - } - - /** - * @param $id - * @return mixed - * 已创建sku信息 - */ - public static function getCreatedSku($id, $type = 0) - { - $goods = Goods::findOne($id); - $data['type'] = $type ?: $goods->sku_mode; - $data['data'] = []; - if ($data['type'] == Goods::SKU_MODE_ATTR) { - $sku = GoodsSku::find() - ->where(['goods_id' => $id, 'is_manaul' => 0]) - ->all(); - } else { - $sku = GoodsSku::find() - ->where(['goods_id' => $id, 'is_manaul' => 1]) - ->all(); - } - foreach ($sku as $value) { - $data['data'][] = self::getAttrInfo($data['type'], $value); - } - return $data; - } - - /** - * @param $type - * @param $sku - * @return array - * 获取商品详情 - */ - public static function getAttrInfo($type, $sku) - { - $data = []; - if ($type == Goods::SKU_MODE_ATTR) { - $data['value'] = array_filter(explode(',', $sku->goods_attr)); - } else { - $attr = explode(',', $sku->goods_attr); - $goodsAttr = GoodsAttr::findOne($attr[0]); - $data['value'] = $goodsAttr->attr_value; - } - $data['id'] = $sku->id; - $data['price'] = $sku->price; - $data['stock'] = $sku->stock; - $data['weight'] = $sku->weight; - return $data; - } - - /** - * @param $id - * @return array - * 获取商品属性 - */ - public static function getAttrs($id) - { - $attrId = GoodsAttr::find()->where(['goods_id' => $id, 'is_delete' => GoodsAttr::IS_DELETE_NO]) - ->andWhere(['>', 'attr_id', 0]) - ->select('attr_id') - ->distinct() - ->all(); - $attributes = []; - foreach ($attrId as $v) { - $attribute = Attribute::findOne($v); - if ($attribute && $attribute->type == Attribute::TYPE_ATTR) { - $ret['name'] = $attribute->name; - $ret['id'] = $attribute->id; - $ret['attrValue'] = self::getAttrValue($attribute->id, $id); - $attributes[] = $ret; - } - } - return $attributes; - } - - /** - * @param $attrId - * @param $goodsId - * @return GoodsAttr[]|GoodsSku[]|array|File[]|\common\models\ars\TemFile[]|\yii\db\ActiveRecord[] - * 获取属性值 - */ - public static function getAttrValue($attrId, $goodsId) - { - return GoodsAttr::find() - ->select(['id', 'attr_value']) - ->where(['goods_id' => $goodsId]) - ->andWhere(['attr_id' => $attrId]) - ->asArray() - ->all(); - } - - /** - * @param $type - * @param $goodsId - * @return array - * 获取已存储的商品sku的id - */ - public static function getOriginalIds($type, $goodsId) - { - $ids = []; - if ($type == Goods::SKU_MODE_MANUAL) { - $query = GoodsSku::find() - ->where(['is_manaul' => 1]); - } else { - $query = GoodsSku::find() - ->where(['is_manaul' => 0]); - } - $sku = $query - ->andWhere(['goods_id' => $goodsId]) - ->all(); - foreach ($sku as $value) { - $ids[] = $value->id; - } - return $ids; - } - - /** - * @param $sku - * @throws \yii\db\Exception - * 添加或更新sku数据 - */ - public static function AddOrUpdateData($sku, $type, $goodsId) - { - $goodsModel = Goods::findOne($goodsId); - if ($sku['id'] > 0) { - $goodsSku = GoodsSku::findOne($sku['id']); - $attrId = array_filter(explode(',', $goodsSku->goods_attr)); - $attr = GoodsAttr::findOne($attrId[0]); - } else { - $goodsSku = new GoodsSku(); - $attr = new GoodsAttr(); - } - if (!$attr || !$goodsSku || !$goodsModel) { - throw new \yii\db\Exception('系统异常'); - } - if ($type == Goods::SKU_MODE_MANUAL) { - $attr->attr_value = $sku['value']; - if (!$attr->save()) { - throw new \yii\db\Exception('手动属性修改失败'); - } - $goodsSku->goods_attr = (string)$attr->id; - $goodsSku->is_manaul = 1; - } else { - $goodsSku->goods_attr = implode(',', array_filter($sku['value'])); - } - $goodsSku->goods_id = $goodsId; - $goodsSku->price = $sku['price']; - $goodsSku->stock = $sku['stock']; - $goodsSku->weight = $sku['weight']; - $goodsSku->goods_sn = $goodsModel->sn; - if (!$goodsSku->save()) { - throw new \yii\db\Exception('保存失败,请检查是否有重复规格'); - } - $goods = Goods::findOne($goodsId); - $goods->sku_mode = $type; - if (!$goods->save()) { - throw new \yii\db\Exception('商品sku类型修改失败'); - } - } - - /** - * @param $type - * @param $data - * @param $goodsId - * @return bool - * @throws \Throwable - * @throws \yii\db\StaleObjectException - * 删除sku - */ - public static function deleteSku($type, $data, $goodsId) - { - if (!$data['originalIds']) { - return true; - } - if ($type == Goods::SKU_MODE_MANUAL) { - $query = GoodsSku::find() - ->where(['is_manaul' => 1]); - } else { - $query = GoodsSku::find() - ->where(['is_manaul' => 0]); - } - $sku = $query - ->andWhere(['goods_id' => $goodsId]) - ->andWhere(['in', 'id', $data['originalIds']]) - ->andWhere(['not in', 'id', $data['acceptIds']]) - ->all(); - foreach ($sku as $value) { - $value->delete(); - } - } - - /** - * @param $data - * @return bool - * @throws Exception - * 创建修改商品筛选属性操作 - */ - public static function addFilterAttributeOperating($data) - { - if (!$data['filterAttribute']) { - return true; - } - $data['filterAttribute'] = json_decode($data['filterAttribute'], true); - $oldFilterAttr = []; - $goodsFilterAttr = FilterAttr::find()->where(['goods_id' => $data['id'], 'is_delete' => FilterAttr::IS_DELETE_NO])->all(); - if ($goodsFilterAttr) { //如果商品有旧的属性 - if(count($data['filterAttribute']) == 0 && is_array($data['filterAttribute'])) { //如果传上来的是空数组,删除该商品下的全部属性 - self::delFilterAttribute($goodsFilterAttr); - return true; - } - foreach ($goodsFilterAttr as $key => $value) { //把旧的商品属性保存到一个数组 - $oldFilterAttr[$value->id] = $value->attr_value; - } - } - $newAttr = self::addFilterAttribute($data['filterAttribute'], $data['id']); //添加新的商品属性 - $delAttr = array_diff(array_keys($oldFilterAttr), array_keys($newAttr)); //找出需要删除的goodsAttrId - if (!$delAttr) { - return true; - } - foreach ($delAttr as $value) { - $model = FilterAttr::find()->where(['id' => $value, 'is_delete' => FilterAttr::IS_DELETE_NO])->One(); - if ($model) { - $model->is_delete = FilterAttr::IS_DELETE_YES; - if (!$model->save()) { - throw new Exception('goodsAttribute delete false'); - } - } - } - } - - /** - * @param $goodsFilterAttr - * @throws Exception - * 删除商品筛选属性 - */ - public static function delFilterAttribute($goodsFilterAttr) - { - foreach ($goodsFilterAttr as $key => $value) { - $value->is_delete = FilterAttr::IS_DELETE_YES; - if (!$value->save()) { - throw new Exception('goods attribute delete false'); - } - } - } - - /** - * @param $attribute - * @param $goodsId - * @return array - * @throws Exception - * 保存商品筛选属性 - */ - public static function addFilterAttribute($attribute, $goodsId) - { - $newAttr = []; - if (!$attribute) { - return []; - } - foreach ($attribute as $value) { - foreach ($value['value'] as $k => $v) { - $goodsFilterAttrModel = new FilterAttr(); - $goodsFilterAttrModel->attr_id = $value['id']; - $attr = FilterAttr::find()->where(['goods_id' => $goodsId, 'attr_id' => $value['id'], 'attr_value' => $v, 'is_delete' => FilterAttr::IS_DELETE_NO])->one(); - if ($attr) { - $newAttr[$attr->id] = $attr->attr_value; //原有的数据 - } else { - $goodsFilterAttrModel->goods_id = $goodsId; - $goodsFilterAttrModel->attr_value = $v; - if (!$goodsFilterAttrModel->save()) { - throw new Exception('goodsAttribute save false'); - } - $newAttr[$goodsFilterAttrModel->id] = $goodsFilterAttrModel->attr_value; //新增的数据 - } - } - } - return $newAttr; - } - - /** - * @param $id - * @return Attribute|array|null - * 获取筛选属性信息 - */ - public static function getFilterAttribute($id) - { - $goodsFilterAttributes = FilterAttr::find()->where(['goods_id' => $id, 'is_delete' => FilterAttr::IS_DELETE_NO])->andWhere(['!=', 'attr_id', 0])->all(); - $filter = []; - $goodsFilterAttributeModel = []; - if (!$goodsFilterAttributes) { - return $goodsFilterAttributeModel; - } - foreach ($goodsFilterAttributes as $key => $value) { - $attribute = Attribute::findOne($value->attr_id); - if (!in_array($attribute->name, $filter)) { - $filter[] = $attribute->name; - $attribute = ['name' => $attribute->name, 'id' => $attribute->id, 'value' => [$value->attr_value]]; - $goodsFilterAttributeModel[] = $attribute; - } else { - foreach ($goodsFilterAttributeModel as $k => $v) { - if ($v['name'] == $attribute->name) { - $goodsFilterAttributeModel[$k]['value'][] = $value->attr_value; - } - } - } - } - return $goodsFilterAttributeModel; - } - - /** - * @param $goodsModel - * @return bool - * - */ - public static function judgeGoodsCategory($goodsModel) - { - $skus = GoodsSku::find()->where(['goods_id' => $goodsModel->id, 'is_delete' => GoodsSku::IS_DELETE_NO])->all(); - $attrId = []; - foreach ($skus as $sku) { - $attrId = array_merge(explode(',', $sku->goods_attr), $attrId); - } - $goodsAttr = array_unique(GoodsAttr::find()->select(['attr_id'])->where(['id' => $attrId, 'is_delete' => GoodsAttr::IS_DELETE_NO])->andWhere(['!=', 'attr_id', 0])->column()); - $attrArr = array_unique(Attribute::find()->select(['cat_id'])->where(['is_delete' => Attribute::IS_DELETE_NO, 'id' => $goodsAttr])->column()); - if (in_array($goodsModel->cat_id, $attrArr)) { - return true; //存在,则返回true,表示后台分类不得修改 - } - return false; //否则返回false,表示后台分类可以修改 - } - - public static function categoryBtreeList() - { - - } -} \ No newline at end of file diff --git a/antgoods123/migrations/m191119_021851_create_table_shop_category.php b/antgoods123/migrations/m191119_021851_create_table_shop_category.php deleted file mode 100644 index 35f536e..0000000 --- a/antgoods123/migrations/m191119_021851_create_table_shop_category.php +++ /dev/null @@ -1,42 +0,0 @@ -createTable('antgoods_shop_category', [ - 'id' => $this->primaryKey(), - 'name'=>$this->string(60)->notNull()->comment('类别名称'), - 'pid'=>$this->integer(11)->defaultValue(null)->comment('父级id'), - 'goods_count'=>$this->integer(11)->defaultValue(0)->comment('商品数量'), - 'keywords'=>$this->string(100)->defaultValue(null)->comment('关键字'), - 'desc'=>$this->string(255)->defaultValue(null)->comment('描述'), - 'sort_order'=>$this->smallInteger(3)->defaultValue(0)->comment('排序'), - 'icon_type'=>$this->tinyInteger(1)->defaultValue(null)->comment('图标类型'), - 'icon'=>$this->string(64)->defaultValue(null)->comment('图标'), - 'filter_attr'=>$this->text()->comment('筛选属性'), - 'is_show'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否显示,1为不显示'), - 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'), - 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), - 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), - ],$tableOptions); - } - - /** - * {@inheritdoc} - */ - public function down() - { - $this->dropTable('antgoods_shop_category'); - return true; - } -} diff --git a/antgoods123/migrations/m191119_022641_create_table_category.php b/antgoods123/migrations/m191119_022641_create_table_category.php deleted file mode 100644 index 60dd21e..0000000 --- a/antgoods123/migrations/m191119_022641_create_table_category.php +++ /dev/null @@ -1,39 +0,0 @@ -createTable('antgoods_category', [ - 'id' => $this->primaryKey(), - 'name'=>$this->string(60)->notNull()->comment('类别名称'), - 'pid'=>$this->integer(11)->defaultValue(null)->comment('父级id'), - 'goods_count'=>$this->integer(11)->defaultValue(0)->comment('商品数量'), - 'sort_order'=>$this->smallInteger(3)->defaultValue(0)->comment('排序'), - 'icon_type'=>$this->tinyInteger(1)->defaultValue(null)->comment('图标类型'), - 'icon'=>$this->string(64)->defaultValue(null)->comment('图标'), - 'is_show'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否显示,1为不显示'), - 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'), - 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), - 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), - ],$tableOptions); - } - - /** - * {@inheritdoc} - */ - public function down() - { - $this->dropTable('antgoods_category'); - return true; - } -} diff --git a/antgoods123/migrations/m191119_022939_create_table_attribute.php b/antgoods123/migrations/m191119_022939_create_table_attribute.php deleted file mode 100644 index 8f77f8f..0000000 --- a/antgoods123/migrations/m191119_022939_create_table_attribute.php +++ /dev/null @@ -1,36 +0,0 @@ -createTable('antgoods_attribute', [ - 'id' => $this->primaryKey(), - 'name'=>$this->string(50)->notNull()->comment('属性名'), - 'value'=>$this->text()->notNull()->comment('属性值'), - 'type'=>$this->smallInteger(2)->defaultValue(null)->comment('类型'), - 'sort_order'=>$this->smallInteger(3)->defaultValue(null)->comment('排序'), - 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'), - 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), - 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), - ],$tableOptions); - } - - /** - * {@inheritdoc} - */ - public function down() - { - $this->dropTable('antgoods_attribute'); - return true; - } -} diff --git a/antgoods123/migrations/m191119_023115_create_table_goods_attr.php b/antgoods123/migrations/m191119_023115_create_table_goods_attr.php deleted file mode 100644 index 19a263c..0000000 --- a/antgoods123/migrations/m191119_023115_create_table_goods_attr.php +++ /dev/null @@ -1,35 +0,0 @@ -createTable('antgoods_goods_attr', [ - 'id' => $this->primaryKey(), - 'goods_id'=>$this->integer(11)->notNull()->comment('商品id'), - 'attr_id'=>$this->integer(11)->notNull()->comment('属性id'), - 'attr_value'=>$this->string(50)->notNull()->comment('属性名'), - 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'), - 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), - 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), - ],$tableOptions); - } - - /** - * {@inheritdoc} - */ - public function down() - { - $this->dropTable('antgoods_goods_attr'); - return true; - } -} diff --git a/antgoods123/migrations/m191119_024029_create_table_brand.php b/antgoods123/migrations/m191119_024029_create_table_brand.php deleted file mode 100644 index 48984d4..0000000 --- a/antgoods123/migrations/m191119_024029_create_table_brand.php +++ /dev/null @@ -1,33 +0,0 @@ -createTable('antgoods_brand', [ - 'id' => $this->primaryKey(), - 'name'=>$this->string(50)->notNull()->comment('品牌名'), - 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'), - 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), - 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), - ],$tableOptions); - } - - /** - * {@inheritdoc} - */ - public function down() - { - $this->dropTable('antgoods_brand'); - return true; - } -} diff --git a/antgoods123/migrations/m191119_024205_create_table_goods.php b/antgoods123/migrations/m191119_024205_create_table_goods.php deleted file mode 100644 index d16c1e5..0000000 --- a/antgoods123/migrations/m191119_024205_create_table_goods.php +++ /dev/null @@ -1,27 +0,0 @@ -execute($sql); - } - - /** - * {@inheritdoc} - */ - public function down() - { - $this->dropTable("antgoods_goods"); - return true; - } -} diff --git a/antgoods123/migrations/m191119_024345_create_table_goods_sku.php b/antgoods123/migrations/m191119_024345_create_table_goods_sku.php deleted file mode 100644 index 227b38b..0000000 --- a/antgoods123/migrations/m191119_024345_create_table_goods_sku.php +++ /dev/null @@ -1,27 +0,0 @@ -execute($sql); - } - - /** - * {@inheritdoc} - */ - public function down() - { - $this->dropTable("antgoods_goods_sku"); - return true; - } -} diff --git a/antgoods123/migrations/m191119_025607_create_table_supplier.php b/antgoods123/migrations/m191119_025607_create_table_supplier.php deleted file mode 100644 index c7d8f6c..0000000 --- a/antgoods123/migrations/m191119_025607_create_table_supplier.php +++ /dev/null @@ -1,36 +0,0 @@ -createTable('antgoods_supplier', [ - 'id' => $this->primaryKey(), - 'name'=>$this->string(50)->notNull()->comment('供应商名称'), - 'full_name'=>$this->string(50)->notNull()->comment('供应商全称'), - 'phone'=>$this->string(20)->notNull()->comment('手机号码'), - 'address'=>$this->string(50)->notNull()->comment('地址'), - 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'), - 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), - 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), - ],$tableOptions); - } - - /** - * {@inheritdoc} - */ - public function down() - { - $this->dropTable('antgoods_supplier'); - return true; - } -} diff --git a/antgoods123/migrations/m191119_025843_create_table_filter_attr.php b/antgoods123/migrations/m191119_025843_create_table_filter_attr.php deleted file mode 100644 index 0409292..0000000 --- a/antgoods123/migrations/m191119_025843_create_table_filter_attr.php +++ /dev/null @@ -1,35 +0,0 @@ -createTable('antgoods_filter_attr', [ - 'id' => $this->primaryKey(), - 'goods_id'=>$this->integer(11)->notNull()->comment('商品id'), - 'attr_id'=>$this->integer(11)->notNull()->comment('属性id'), - 'attr_value'=>$this->string(50)->notNull()->comment('属性值'), - 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'), - 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), - 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), - ],$tableOptions); - } - - /** - * {@inheritdoc} - */ - public function down() - { - $this->dropTable('antgoods_filter_attr'); - return true; - } -} diff --git a/antgoods123/migrations/m191125_012449_update_column_icon_type_in_antgoods_category.php b/antgoods123/migrations/m191125_012449_update_column_icon_type_in_antgoods_category.php deleted file mode 100644 index 00fb52e..0000000 --- a/antgoods123/migrations/m191125_012449_update_column_icon_type_in_antgoods_category.php +++ /dev/null @@ -1,22 +0,0 @@ -dropColumn('antgoods_category', 'icon_type'); - $this->addColumn('antgoods_category', 'icon_type', $this->tinyInteger(1)->defaultValue(1)->comment('图标类型')); - } - - public function down() - { - $this->dropColumn('antgoods_category', 'icon_type'); - $this->addColumn('antgoods_category', 'icon_type', $this->tinyInteger(1)->defaultValue(null)->comment('图标类型')); - return true; - } -} diff --git a/antgoods123/migrations/m191125_083820_drop_column_icon_type_in_table_antgoods_category.php b/antgoods123/migrations/m191125_083820_drop_column_icon_type_in_table_antgoods_category.php deleted file mode 100644 index 04c6a2b..0000000 --- a/antgoods123/migrations/m191125_083820_drop_column_icon_type_in_table_antgoods_category.php +++ /dev/null @@ -1,20 +0,0 @@ -dropColumn('antgoods_category', 'icon_type'); - } - - public function down() - { - $this->addColumn('antgoods_category', 'icon_type', $this->tinyInteger(1)->defaultValue(null)->comment('图标类型')); - return true; - } -} diff --git a/antgoods123/migrations/m191125_084547_update_column_pid_and_icon_in_table_antgoods_category.php b/antgoods123/migrations/m191125_084547_update_column_pid_and_icon_in_table_antgoods_category.php deleted file mode 100644 index 055e84c..0000000 --- a/antgoods123/migrations/m191125_084547_update_column_pid_and_icon_in_table_antgoods_category.php +++ /dev/null @@ -1,26 +0,0 @@ -dropColumn('antgoods_category', 'icon'); - $this->addColumn('antgoods_category', 'icon', $this->integer(11)->defaultValue(null)->comment('图标')); - $this->dropColumn('antgoods_category', 'pid'); - $this->addColumn('antgoods_category', 'pid', $this->integer(11)->defaultValue(0)->comment('父级id')); - } - - public function down() - { - $this->dropColumn('antgoods_category', 'icon'); - $this->addColumn('antgoods_category', 'icon', $this->string(64)->defaultValue(null)->comment('图标')); - $this->dropColumn('antgoods_category', 'pid'); - $this->addColumn('antgoods_category', 'pid', $this->integer(11)->defaultValue(null)->comment('父级id')); - return true; - } -} diff --git a/antgoods123/migrations/m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category.php b/antgoods123/migrations/m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category.php deleted file mode 100644 index 2f182eb..0000000 --- a/antgoods123/migrations/m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category.php +++ /dev/null @@ -1,20 +0,0 @@ -dropColumn('antgoods_shop_category', 'icon_type'); - } - - public function down() - { - $this->addColumn('antgoods_shop_category', 'icon_type', $this->tinyInteger(1)->defaultValue(null)->comment('图标类型')); - return true; - } -} diff --git a/antgoods123/migrations/m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category.php b/antgoods123/migrations/m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category.php deleted file mode 100644 index b1536ac..0000000 --- a/antgoods123/migrations/m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category.php +++ /dev/null @@ -1,26 +0,0 @@ -dropColumn('antgoods_shop_category', 'icon'); - $this->addColumn('antgoods_shop_category', 'icon', $this->integer(11)->defaultValue(null)->comment('图标')); - $this->dropColumn('antgoods_shop_category', 'pid'); - $this->addColumn('antgoods_shop_category', 'pid', $this->integer(11)->defaultValue(0)->comment('父级id')); - } - - public function down() - { - $this->dropColumn('antgoods_shop_category', 'icon'); - $this->addColumn('antgoods_shop_category', 'icon', $this->string(64)->defaultValue(null)->comment('图标')); - $this->dropColumn('antgoods_shop_category', 'pid'); - $this->addColumn('antgoods_shop_category', 'pid', $this->integer(11)->defaultValue(null)->comment('父级id')); - return true; - } -} diff --git a/antgoods123/migrations/m191127_114228_add_column_is_manaul_in_table_antgoods_goods_sku.php b/antgoods123/migrations/m191127_114228_add_column_is_manaul_in_table_antgoods_goods_sku.php deleted file mode 100644 index a6584d6..0000000 --- a/antgoods123/migrations/m191127_114228_add_column_is_manaul_in_table_antgoods_goods_sku.php +++ /dev/null @@ -1,20 +0,0 @@ -addColumn('antgoods_goods_sku', 'is_manaul', $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('是否手动')); - } - - public function down() - { - $this->dropColumn('antgoods_goods_sku', 'is_manaul'); - return true; - } -} diff --git a/antgoods123/migrations/m191129_010349_add_column_sku_mode_in_antgoods_goods.php b/antgoods123/migrations/m191129_010349_add_column_sku_mode_in_antgoods_goods.php deleted file mode 100644 index 3d4b3ed..0000000 --- a/antgoods123/migrations/m191129_010349_add_column_sku_mode_in_antgoods_goods.php +++ /dev/null @@ -1,20 +0,0 @@ -addColumn('antgoods_goods', 'sku_mode', $this->tinyInteger(1)->notNull()->defaultValue(1)->comment('sku类型')); - } - - public function down() - { - $this->dropColumn('antgoods_goods', 'sku_mode'); - return true; - } -} diff --git a/antgoods123/migrations/m191129_020131_add_columns_goods_id_and_attr_id_in_table_antgoods_goods_attr.php b/antgoods123/migrations/m191129_020131_add_columns_goods_id_and_attr_id_in_table_antgoods_goods_attr.php deleted file mode 100644 index 3ee066e..0000000 --- a/antgoods123/migrations/m191129_020131_add_columns_goods_id_and_attr_id_in_table_antgoods_goods_attr.php +++ /dev/null @@ -1,26 +0,0 @@ -dropColumn('antgoods_goods_attr', 'goods_id'); - $this->dropColumn('antgoods_goods_attr', 'attr_id'); - $this->addColumn('antgoods_goods_attr', 'goods_id', $this->integer(11)->notNull()->defaultValue(0)->comment('商品id')); - $this->addColumn('antgoods_goods_attr', 'attr_id', $this->integer(11)->notNull()->defaultValue(0)->comment('属性id')); - } - - public function down() - { - $this->dropColumn('antgoods_goods_attr', 'goods_id'); - $this->dropColumn('antgoods_goods_attr', 'attr_id'); - $this->addColumn('antgoods_goods_attr', 'goods_id', $this->integer(11)->notNull()->comment('商品id')); - $this->addColumn('antgoods_goods_attr', 'attr_id', $this->integer(11)->notNull()->comment('属性id')); - return true; - } -} diff --git a/antgoods123/migrations/m191130_004933_add_column_cat_id_in_table_antgoods_attribute.php b/antgoods123/migrations/m191130_004933_add_column_cat_id_in_table_antgoods_attribute.php deleted file mode 100644 index f7992f5..0000000 --- a/antgoods123/migrations/m191130_004933_add_column_cat_id_in_table_antgoods_attribute.php +++ /dev/null @@ -1,20 +0,0 @@ -addColumn('antgoods_attribute', 'cat_id', $this->integer(11)->notNull()->defaultValue(0)->comment('后台商品分类id')); - } - - public function down() - { - $this->dropColumn('antgoods_attribute', 'cat_id'); - return true; - } -} diff --git a/antgoods123/migrations/m191202_082041_drop_columns_in_table_antgoods_goods_sku.php b/antgoods123/migrations/m191202_082041_drop_columns_in_table_antgoods_goods_sku.php deleted file mode 100644 index 52d5ca7..0000000 --- a/antgoods123/migrations/m191202_082041_drop_columns_in_table_antgoods_goods_sku.php +++ /dev/null @@ -1,27 +0,0 @@ -dropColumn('antgoods_goods_sku', 'weight'); - $this->dropColumn('antgoods_goods_sku', 'length'); - $this->dropColumn('antgoods_goods_sku', 'width'); - $this->dropColumn('antgoods_goods_sku', 'height'); - $this->dropColumn('antgoods_goods_sku', 'diameter'); - } - - public function down() - { - $this->addColumn('antgoods_goods_sku', 'weight', $this->integer(8)->defaultValue(null)->comment('重量')); - $this->addColumn('antgoods_goods_sku', 'length', $this->integer(8)->defaultValue(null)->comment('长度')); - $this->addColumn('antgoods_goods_sku', 'width', $this->integer(8)->defaultValue(null)->comment('宽度')); - $this->addColumn('antgoods_goods_sku', 'height', $this->integer(8)->defaultValue(null)->comment('高度')); - $this->addColumn('antgoods_goods_sku', 'diameter', $this->integer(8)->defaultValue(null)->comment('直径')); - } -} diff --git a/antgoods123/migrations/sql/goods.sql b/antgoods123/migrations/sql/goods.sql deleted file mode 100755 index 3944770..0000000 --- a/antgoods123/migrations/sql/goods.sql +++ /dev/null @@ -1,37 +0,0 @@ -DROP TABLE IF EXISTS `antgoods_goods`; -CREATE TABLE `antgoods_goods` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `pid` int(11) DEFAULT NULL COMMENT '父级id', - `cat_id` int(11) NOT NULL COMMENT '后台商品类别id', - `brand_id` int(11) NOT NULL COMMENT '品牌id', - `shop_cat_id` int(11) NOT NULL COMMENT '前端商品类别id', - `name` varchar(120) NOT NULL COMMENT '商品名称', - `sn` varchar(60) DEFAULT NULL COMMENT '商品唯一货号', - `code` varchar(50) DEFAULT NULL COMMENT '商品货码', - `supplier_id` int(11) DEFAULT NULL COMMENT '供应商id', - `weight` mediumint(8) DEFAULT NULL unique COMMENT '重量', - `length` mediumint(8) DEFAULT NULL unique COMMENT '长度', - `width` mediumint(8) DEFAULT NULL unique COMMENT '宽度', - `height` mediumint(8) DEFAULT NULL unique COMMENT '高度', - `diameter` mediumint(8) DEFAULT NULL unique COMMENT '直径', - `unit` varchar(16) DEFAULT NULL COMMENT '单位', - `sold_count` int(10) DEFAULT NULL unique COMMENT '已售数量', - `limit_count` int(10) DEFAULT NULL COMMENT '限购数量', - `stock` int(10) DEFAULT NULL COMMENT '库存', - `stock_warn` int(10) DEFAULT NULL COMMENT '库存警告', - `market_price` int(20) DEFAULT NULL unique COMMENT '市场价', - `price` int(20) DEFAULT NULL unique COMMENT '销售价', - `brief` varchar(255) DEFAULT NULL COMMENT '简介', - `description` text COMMENT '详细介绍', - `image` int(11) DEFAULT NULL COMMENT '图片id', - `model_id` int(11) DEFAULT NULL COMMENT '模型id', - `is_sale` tinyint(1) DEFAULT '0' COMMENT '该商品是否开放销售,1为是,0为否', - `sort_order` smallint(3) DEFAULT NULL COMMENT '排序', - `bouns_points` mediumint(8) DEFAULT NULL COMMENT '奖励积分', - `experience_points` mediumint(8) DEFAULT NULL COMMENT '经验值', - `is_delete` tinyint(1) DEFAULT '0' COMMENT '是否删除,1为已删除', - `express_template` int(11) DEFAULT NULL COMMENT '配送详情id', - `created_at` int(10) DEFAULT '0' COMMENT '创建时间', - `updated_at` int(10) DEFAULT '0' COMMENT '更新时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商品表'; \ No newline at end of file diff --git a/antgoods123/migrations/sql/goods_sku.sql b/antgoods123/migrations/sql/goods_sku.sql deleted file mode 100755 index a599a39..0000000 --- a/antgoods123/migrations/sql/goods_sku.sql +++ /dev/null @@ -1,24 +0,0 @@ -DROP TABLE IF EXISTS `antgoods_goods_sku`; -CREATE TABLE `antgoods_goods_sku` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `goods_id` int(11) NOT NULL COMMENT '商品id', - `goods_code` varchar(50) DEFAULT NULL COMMENT '商品条码', - `goods_sn` varchar(60) NOT NULL COMMENT '商品唯一货号', - `goods_attr` varchar(60) DEFAULT NULL COMMENT '属性匹配', - `weight` mediumint(8) DEFAULT NULL COMMENT '重量', - `length` mediumint(8) DEFAULT NULL COMMENT '长度', - `width` mediumint(8) DEFAULT NULL COMMENT '宽度', - `height` mediumint(8) DEFAULT NULL COMMENT '高度', - `diameter` mediumint(8) DEFAULT NULL COMMENT '直径', - `sold_count` int(10) DEFAULT NULL COMMENT '已售数量', - `stock` int(10) DEFAULT NULL COMMENT '库存', - `market_price` int(20) DEFAULT NULL COMMENT '市场价', - `price` int(20) DEFAULT NULL COMMENT '销售价', - `model_id` int(11) DEFAULT NULL COMMENT '模型id', - `is_sale` tinyint(1) DEFAULT '0' COMMENT '该商品是否开放销售,1为是,0为否', - `sort_order` smallint(3) DEFAULT '0' COMMENT '排序', - `is_delete` tinyint(1) DEFAULT '0' COMMENT '是否删除,1为已删除', - `created_at` int(10) DEFAULT '0' COMMENT '创建时间', - `updated_at` int(10) DEFAULT '0' COMMENT '更新时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商品sku表'; \ No newline at end of file diff --git a/antgoods123/models/.gitkeep b/antgoods123/models/.gitkeep deleted file mode 100755 index 72e8ffc..0000000 --- a/antgoods123/models/.gitkeep +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/antgoods123/models/ars/Attribute.php b/antgoods123/models/ars/Attribute.php deleted file mode 100644 index 0b077d7..0000000 --- a/antgoods123/models/ars/Attribute.php +++ /dev/null @@ -1,111 +0,0 @@ - 50], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => '规格名称', - 'value' => '规格内容(每项以逗号隔开)', - 'type' => '类型', - 'sort_order' => '排序', - 'is_delete' => '是否删除,1为已删除', - 'created_at' => '创建时间', - 'updated_at' => '更新时间', - 'cat_id' => '后台商品分类', - ]; - } - - - /** - * @author linyao - * @email 602604991@qq.com - * @created Nov 8, 2019 - * - * 行为存储创建时间和更新时间 - */ - public function behaviors() - { - return [ - [ - 'class' => TimestampBehavior::className(), - 'createdAtAttribute' => 'created_at', - 'updatedAtAttribute' => 'updated_at', - 'value' => function() { - return time(); - }, - ], - ]; - } - - /** - * @return array - * 数据键值对 - */ - public static function modelColumn() - { - return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column(); - } - - public function beforeSave($insert) - { - if(!$this->type){ - $this->type = self::TYPE_ATTR; - } - return parent::beforeSave($insert); // TODO: Change the autogenerated stub - } - - public function getCategory() - { - return $this->hasOne(Category::className(), ['id' => 'cat_id']); - } -} diff --git a/antgoods123/models/ars/Brand.php b/antgoods123/models/ars/Brand.php deleted file mode 100644 index 09ef7c3..0000000 --- a/antgoods123/models/ars/Brand.php +++ /dev/null @@ -1,82 +0,0 @@ - 50], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => '品牌名', - 'is_delete' => '是否删除,1为已删除', - 'created_at' => '创建时间', - 'updated_at' => '更新时间', - ]; - } - - - /** - * @author linyao - * @email 602604991@qq.com - * @created Nov 8, 2019 - * - * 行为存储创建时间和更新时间 - */ - public function behaviors() - { - return [ - [ - 'class' => TimestampBehavior::className(), - 'createdAtAttribute' => 'created_at', - 'updatedAtAttribute' => 'updated_at', - 'value' => function() { - return time(); - }, - ], - ]; - } - - public static function modelColumn() - { - return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column(); - } -} diff --git a/antgoods123/models/ars/Category.php b/antgoods123/models/ars/Category.php deleted file mode 100644 index 181da3e..0000000 --- a/antgoods123/models/ars/Category.php +++ /dev/null @@ -1,114 +0,0 @@ - '显示', - self::IS_SHOW_HIDE => '隐藏' - ]; - - /** - * {@inheritdoc} - */ - public static function tableName() - { - return 'antgoods_category'; - } - - /** - * {@inheritdoc} - */ - public function rules() - { - return [ - [['name'], 'required'], - [['pid', 'goods_count', 'sort_order', 'is_show', 'is_delete', 'icon'], 'integer'], - [['name'], 'string', 'max' => 60], - [['iconImageId'], 'string'], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => '类别名称', - 'pid' => '父级', - 'goods_count' => '商品数量', - 'sort_order' => '排序', - 'icon' => '图标', - 'is_show' => '是否显示', - 'is_delete' => '是否删除,1为已删除', - 'created_at' => '创建时间', - 'updated_at' => '更新时间', - ]; - } - - - /** - * @author linyao - * @email 602604991@qq.com - * @created Nov 8, 2019 - * - * 行为存储创建时间和更新时间 - */ - public function behaviors() - { - return [ - [ - 'class' => TimestampBehavior::className(), - 'createdAtAttribute' => 'created_at', - 'updatedAtAttribute' => 'updated_at', - 'value' => function() { - return time(); - }, - ], - ]; - } - - /** - * @return array - * 数据键值对 - */ - public static function modelColumn() - { - return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column(); - } - - public function getIconFile() - { - return $this->hasOne(File::className(), ['id' => 'icon']); - } -} diff --git a/antgoods123/models/ars/FilterAttr.php b/antgoods123/models/ars/FilterAttr.php deleted file mode 100644 index c6b8aa2..0000000 --- a/antgoods123/models/ars/FilterAttr.php +++ /dev/null @@ -1,81 +0,0 @@ - 50], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'goods_id' => '商品id', - 'attr_id' => '属性id', - 'attr_value' => '属性值', - 'is_delete' => '是否删除,1为已删除', - 'created_at' => '创建时间', - 'updated_at' => '更新时间', - ]; - } - - - /** - * @author linyao - * @email 602604991@qq.com - * @created Nov 8, 2019 - * - * 行为存储创建时间和更新时间 - */ - public function behaviors() - { - return [ - [ - 'class' => TimestampBehavior::className(), - 'createdAtAttribute' => 'created_at', - 'updatedAtAttribute' => 'updated_at', - 'value' => function() { - return time(); - }, - ], - ]; - } -} diff --git a/antgoods123/models/ars/Goods.php b/antgoods123/models/ars/Goods.php deleted file mode 100644 index ebc748e..0000000 --- a/antgoods123/models/ars/Goods.php +++ /dev/null @@ -1,232 +0,0 @@ - '不在售', - self::IS_SALE_YES => '在售' - ]; - public $ruleVerify = 0;//规则验证是否通过 - /** - * {@inheritdoc} - */ - public static function tableName() - { - return 'antgoods_goods'; - } - - /** - * {@inheritdoc} - */ - public function rules() - { - return [ - [['pid', 'cat_id', 'brand_id', 'shop_cat_id', 'supplier_id', 'weight', 'length', 'width', 'height', 'diameter', 'sold_count', 'limit_count', 'stock', 'stock_warn', 'market_price', 'price', 'image', 'model_id', 'is_sale', 'sort_order', 'bouns_points', 'experience_points', 'is_delete', 'express_template', 'sku_mode'], 'integer'], - [['cat_id', 'brand_id', 'shop_cat_id', 'name'], 'required'], - [['sn'], 'checkExist'], - [['description', 'coverImageId', 'detailImageId'], 'string'], - [['name'], 'string', 'max' => 120], - [['sn'], 'string', 'max' => 60], - [['code'], 'string', 'max' => 50], - [['unit'], 'string', 'max' => 16], - [['brief'], 'string', 'max' => 255], - [['weight', 'length', 'width', 'height', 'diameter', 'sold_count', 'market_price', 'price'], 'checkNegative'], - ]; - } - - /** - * @param $attribute - * @param $params - * 验证是否为负数 - */ - public function checkNegative($attribute, $params) - { - if ($this->$attribute < 0) { - $this->addError($attribute, "不得为负数"); - } - } - - /** - * @param $attribute - * @param $params - * 验证商品编号唯一 - */ - public function checkExist($attribute, $params) - { - $goods = self::find()->where([$attribute => $this->$attribute, 'is_delete' => 0])->one(); - if ($this->isNewRecord) { - if ($goods) { - $this->addError($attribute, "该商品编号已经存在"); - } - } else { - if ($goods && $goods->id != $this->id) { - $this->addError($attribute, "该商品编号已经存在"); - } - } - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'pid' => '父级id', - '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' => '模型id', - 'is_sale' => '销售状态', - 'sort_order' => '排序', - 'bouns_points' => '奖励积分', - 'experience_points' => '经验值', - 'is_delete' => '是否删除,1为已删除', - 'express_template' => '配送详情id', - 'created_at' => '创建时间', - 'updated_at' => '更新时间', - ]; - } - - - /** - * @author linyao - * @email 602604991@qq.com - * @created Nov 8, 2019 - * - * 行为存储创建时间和更新时间 - */ - public function behaviors() - { - return [ - [ - 'class' => TimestampBehavior::className(), - 'createdAtAttribute' => 'created_at', - 'updatedAtAttribute' => 'updated_at', - 'value' => function() { - return time(); - }, - ], - ]; - } - - /** - * @param bool $insert - * @return bool - * 自动填入参数 - */ - public function beforeSave($insert) - { - if (!$this->sn) { - $this->sn = time() . rand(1111, 9999); - } - return parent::beforeSave($insert); // TODO: Change the autogenerated stub - } - - public function getCategory() - { - return $this->hasOne(Category::className(), ['id' => 'cat_id']); - } - - public function getShopCategory() - { - return $this->hasOne(ShopCategory::className(), ['id' => 'shop_cat_id']); - } - - public function getImageFile() - { - return $this->hasOne(File::className(), ['id' => 'image']); - } - - public function getBrand() - { - return $this->hasOne(Brand::className(), ['id' => 'brand_id']); - } - - public function getSupplier() - { - return $this->hasOne(Supplier::className(), ['id' => 'supplier_id']); - } -} diff --git a/antgoods123/models/ars/GoodsAttr.php b/antgoods123/models/ars/GoodsAttr.php deleted file mode 100644 index 4cb2495..0000000 --- a/antgoods123/models/ars/GoodsAttr.php +++ /dev/null @@ -1,81 +0,0 @@ - 50], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'goods_id' => '商品id', - 'attr_id' => '属性id', - 'attr_value' => '属性名', - 'is_delete' => '是否删除,1为已删除', - 'created_at' => '创建时间', - 'updated_at' => '更新时间', - ]; - } - - - /** - * @author linyao - * @email 602604991@qq.com - * @created Nov 8, 2019 - * - * 行为存储创建时间和更新时间 - */ - public function behaviors() - { - return [ - [ - 'class' => TimestampBehavior::className(), - 'createdAtAttribute' => 'created_at', - 'updatedAtAttribute' => 'updated_at', - 'value' => function() { - return time(); - }, - ], - ]; - } -} diff --git a/antgoods123/models/ars/GoodsSku.php b/antgoods123/models/ars/GoodsSku.php deleted file mode 100644 index 45e729a..0000000 --- a/antgoods123/models/ars/GoodsSku.php +++ /dev/null @@ -1,102 +0,0 @@ - 50], - [['goods_sn', 'goods_attr'], 'string', 'max' => 60], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'goods_id' => '商品id', - 'goods_code' => '商品条码', - 'goods_sn' => '商品唯一货号', - 'goods_attr' => '属性匹配', - 'sold_count' => '已售数量', - 'stock' => '库存', - 'market_price' => '市场价', - 'price' => '销售价', - 'model_id' => '模型id', - 'is_sale' => '该商品是否开放销售,1为是,0为否', - 'sort_order' => '排序', - 'is_delete' => '是否删除,1为已删除', - 'created_at' => '创建时间', - 'updated_at' => '更新时间', - ]; - } - - - /** - * @author linyao - * @email 602604991@qq.com - * @created Nov 8, 2019 - * - * 行为存储创建时间和更新时间 - */ - public function behaviors() - { - return [ - [ - 'class' => TimestampBehavior::className(), - 'createdAtAttribute' => 'created_at', - 'updatedAtAttribute' => 'updated_at', - 'value' => function() { - return time(); - }, - ], - ]; - } -} diff --git a/antgoods123/models/ars/ShopCategory.php b/antgoods123/models/ars/ShopCategory.php deleted file mode 100644 index 1212ec2..0000000 --- a/antgoods123/models/ars/ShopCategory.php +++ /dev/null @@ -1,122 +0,0 @@ - '显示', - self::IS_SHOW_HIDE => '隐藏' - ]; - - /** - * {@inheritdoc} - */ - public static function tableName() - { - return 'antgoods_shop_category'; - } - - /** - * {@inheritdoc} - */ - public function rules() - { - return [ - [['name'], 'required'], - [['pid', 'goods_count', 'sort_order', 'icon', 'is_show', 'is_delete', 'iconImageId'], 'integer'], - [['filter_attr'], 'safe'], - [['name'], 'string', 'max' => 60], - [['keywords'], 'string', 'max' => 100], - [['desc'], 'string', 'max' => 255], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => '类别名称', - 'pid' => '父级', - 'goods_count' => '商品数量', - 'keywords' => '关键字', - 'desc' => '描述', - 'sort_order' => '排序', - 'icon' => '图标', - 'filter_attr' => '筛选属性', - 'is_show' => '是否显示', - 'is_delete' => '是否删除', - 'created_at' => '创建时间', - 'updated_at' => '更新时间', - ]; - } - - - /** - * @author linyao - * @email 602604991@qq.com - * @created Nov 8, 2019 - * - * 行为存储创建时间和更新时间 - */ - public function behaviors() - { - return [ - [ - 'class' => TimestampBehavior::className(), - 'createdAtAttribute' => 'created_at', - 'updatedAtAttribute' => 'updated_at', - 'value' => function() { - return time(); - }, - ], - ]; - } - - /** - * @return array - * 数据键值对 - */ - public static function modelColumn() - { - return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column(); - } - - public function getIconFile() - { - return $this->hasOne(File::className(), ['id' => 'icon']); - } -} diff --git a/antgoods123/models/ars/Supplier.php b/antgoods123/models/ars/Supplier.php deleted file mode 100644 index 31bc64d..0000000 --- a/antgoods123/models/ars/Supplier.php +++ /dev/null @@ -1,96 +0,0 @@ - 50], - [['phone'], 'string', 'max' => 20], - ['phone', 'filter', 'filter' => 'trim'], - ['phone','match','pattern'=>'/^[1][34578][0-9]{9}$/'], - ['phone', 'unique', 'targetClass' => '\antgoods\models\ars\Supplier', 'message' => '手机号已被使用'], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => '供应商名称', - 'full_name' => '供应商全称', - 'phone' => '手机号码', - 'address' => '地址', - 'is_delete' => '是否删除,1为已删除', - 'created_at' => '创建时间', - 'updated_at' => '更新时间', - ]; - } - - - /** - * @author linyao - * @email 602604991@qq.com - * @created Nov 8, 2019 - * - * 行为存储创建时间和更新时间 - */ - public function behaviors() - { - return [ - [ - 'class' => TimestampBehavior::className(), - 'createdAtAttribute' => 'created_at', - 'updatedAtAttribute' => 'updated_at', - 'value' => function() { - return time(); - }, - ], - ]; - } - - /** - * @return array - * 数据键值对 - */ - public static function modelColumn() - { - return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column(); - } -} diff --git a/antgoods123/models/searchs/AttributeSearch.php b/antgoods123/models/searchs/AttributeSearch.php deleted file mode 100644 index dc97a43..0000000 --- a/antgoods123/models/searchs/AttributeSearch.php +++ /dev/null @@ -1,162 +0,0 @@ - 'blobt\grid\CheckboxColumn', - 'width' => '2%', - 'align' => 'center' - ], - 'id', - 'name', - 'value', - 'sort_order', - ['attribute' => 'cat_id', - 'value' => function ($model){ - return $model->cat_id ? $model->category->name : '无限制'; - }, - ], - [ - 'class' => 'iron\grid\ActionColumn', - 'align' => 'center', - 'config' => [ - [ - 'name' => 'update', - 'icon' => 'pencil', - 'title' => '修改' - ], - [ - 'name' => 'delete', - 'icon' => 'trash', - 'title' => '删除', - 'contents' => '确定删除?' - ] - ], - ], - ]; - } - /** - * @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()->where(['is_delete' => Attribute::IS_DELETE_NO]); - - // 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){ - $query->andFilterWhere(['is_delete' => Attribute::IS_DELETE_NO]); - 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/antgoods123/models/searchs/BrandSearch.php b/antgoods123/models/searchs/BrandSearch.php deleted file mode 100644 index a91ad40..0000000 --- a/antgoods123/models/searchs/BrandSearch.php +++ /dev/null @@ -1,152 +0,0 @@ - 'blobt\grid\CheckboxColumn', - 'width' => '2%', - 'align' => 'center' - ], - 'id', - 'name', - [ - 'class' => 'iron\grid\ActionColumn', - 'align' => 'center', - 'config' => [ - [ - 'name' => 'update', - 'icon' => 'pencil', - 'title' => '修改' - ], - [ - 'name' => 'delete', - 'icon' => 'trash', - 'title' => '删除', - 'contents' => '确定删除?' - ] - ], - ], - ]; - } - /** - * @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()->where(['is_delete' => Brand::IS_DELETE_NO]); - - // 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){ - $query->andFilterWhere(['is_delete' => Brand::IS_DELETE_NO]); - 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/antgoods123/models/searchs/CategorySearch.php b/antgoods123/models/searchs/CategorySearch.php deleted file mode 100644 index 1a0f1a1..0000000 --- a/antgoods123/models/searchs/CategorySearch.php +++ /dev/null @@ -1,172 +0,0 @@ - 'blobt\grid\CheckboxColumn', - 'width' => '2%', - 'align' => 'center' - ], - 'id', - 'name', - ['attribute' => 'icon', - 'contentOptions' => [ - 'align' => 'center', - ], - 'width'=>'10%', - 'format' => 'raw', - 'value' => function ($model) { - return $model->iconFile ? - Html::img(['/'.$model->iconFile->path], ['style' => 'width:80px']) - : '
- = Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?> -
- - = DetailView::widget([ - 'model' => $model, - 'attributes' => [ - 'id', - 'name', - 'value:ntext', - 'type', - 'sort_order', - 'created_at:datetime', - 'updated_at:datetime', - ], - ]) ?> - -- = Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?> -
- - = DetailView::widget([ - 'model' => $model, - 'attributes' => [ - 'id', - 'name', - 'created_at:datetime', - 'updated_at:datetime', - ], - ]) ?> - -- = Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?> -
- - = DetailView::widget([ - 'model' => $model, - 'attributes' => [ - 'id', - 'name', - 'pid', - 'goods_count', - 'sort_order', - 'icon_type', - 'icon', - [ - 'attribute' => 'is_show', - 'value' => function ($model) { - return $model->is_show == \antgoods\models\ars\Category::IS_SHOW_DISPLAY ? '显示':'隐藏'; - } - ], - 'created_at:datetime', - 'updated_at:datetime', - ], - ]) ?> - -- = Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?> -
- - = DetailView::widget([ - 'model' => $model, - 'attributes' => [ - 'id', - 'name', - 'sn', - [ - 'attribute' => 'cat_id', - 'width' => '10%', - 'value' => function ($model) { - return $model->category ? $model->category->name : ''; - }, - ], - [ - 'attribute' => 'shop_cat_id', - 'width' => '10%', - 'value' => function ($model) { - return $model->shopCategory ? $model->shopCategory->name : ''; - }, - ], - [ - 'attribute' => 'brand_id', - 'width' => '10%', - 'value' => function ($model) { - return $model->brand ? $model->brand->name : ''; - }, - ], - 'code', - [ - 'attribute' => 'supplier_id', - 'width' => '10%', - 'value' => function ($model) { - return $model->supplier ? $model->supplier->name : ''; - }, - ], - 'weight', - 'length', - 'width', - 'height', - 'diameter', - 'unit', - [ - 'attribute' => 'stock', - 'width' => '5%', - 'value' => function ($model) { - if ($model->stock == -1) { - return '未开启'; - } else { - return $model->stock; - } - }, - ], - 'market_price', - 'price', - 'brief', - ['attribute' => 'image', - 'format' => 'raw', - 'value' => function ($model) { - return $model->image ? - Html::img(['/'.$model->imageFile->path], ['style' => 'width:80px']) - : '- = Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?> -
- - = DetailView::widget([ - 'model' => $model, - 'attributes' => [ - 'id', - 'name', - 'keywords', - 'desc', - 'sort_order', - ['attribute' => 'icon', - 'width'=>'10%', - 'format' => 'raw', - 'value' => function ($model) { - return $model->iconFile ? - \yii\bootstrap4\Html::img(['/'.$model->iconFile->path], ['style' => 'width:80px']) - : '未设置'; - - } - ], - ['attribute' => 'filter_attr', - 'value' => $attr_str - ], - ['attribute' => 'is_show', - 'width' => '5%', - 'value' => - function ($model) { - return $model->is_show == ShopCategory::IS_SHOW_HIDE ? '隐藏' : '显示'; - }, - ], - 'created_at:datetime', - 'updated_at:datetime', - ], - ]) ?> - -- The above error occurred while the Web server was processing your request. -
-- Please contact us if you think this is a server error. Thank you. -
- -- = Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?> -
- - = DetailView::widget([ - 'model' => $model, - 'attributes' => [ - 'id', - 'name', - 'full_name', - 'phone', - 'address', - 'created_at:datetime', - 'updated_at:datetime', - ], - ]) ?> - -