From 330b527eb2a92144cee7bc93417f214bd289c055 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 09:34:59 +0800 Subject: [PATCH 001/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9console/controllers/I?= =?UTF-8?q?nitController.php=E6=96=87=E4=BB=B6=EF=BC=8C=E5=B0=86clearDb?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E6=94=B9=E4=B8=BA=E5=91=BD=E4=BB=A4=E8=A1=8C?= =?UTF-8?q?=E5=8F=AF=E8=AE=BF=E9=97=AE=E7=9A=84actionClearDb=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- console/controllers/InitController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/console/controllers/InitController.php b/console/controllers/InitController.php index d0ee181..bb51368 100644 --- a/console/controllers/InitController.php +++ b/console/controllers/InitController.php @@ -63,7 +63,7 @@ class InitController extends Controller { * TODO没有完善 * 清空数据库 */ - public function clearDb() { + public function actionClearDb() { Yii::$app->db->createCommand("SET FOREIGN_KEY_CHECKS = 0;")->execute(); $dbname = explode('=', explode(';', Yii::$app->db->dsn)[1])[1]; $sql = "SELECT CONCAT('drop table ',table_name,';') FROM information_schema.`TABLES` WHERE table_schema='{$dbname}';"; From 2ebaef2e3186a6d7d1941da043b9351eb836762c Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 10:09:22 +0800 Subject: [PATCH 002/102] =?UTF-8?q?=E5=88=9B=E5=BB=BAant=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=B9=8B=E4=B8=80=E2=80=94=E2=80=94=E5=95=86?= =?UTF-8?q?=E5=93=81=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/AutoloadExample.php | 14 ++++++++++ vendor/antgoods/goods/README.md | 31 +++++++++++++++++++++++ vendor/antgoods/goods/composer.json | 21 +++++++++++++++ vendor/antgoods/goods/src/Module.php | 28 ++++++++++++++++++++ 4 files changed, 94 insertions(+) create mode 100644 vendor/antgoods/goods/AutoloadExample.php create mode 100644 vendor/antgoods/goods/README.md create mode 100644 vendor/antgoods/goods/composer.json create mode 100755 vendor/antgoods/goods/src/Module.php diff --git a/vendor/antgoods/goods/AutoloadExample.php b/vendor/antgoods/goods/AutoloadExample.php new file mode 100644 index 0000000..1f3b005 --- /dev/null +++ b/vendor/antgoods/goods/AutoloadExample.php @@ -0,0 +1,14 @@ +``` \ No newline at end of file diff --git a/vendor/antgoods/goods/composer.json b/vendor/antgoods/goods/composer.json new file mode 100644 index 0000000..3b16d84 --- /dev/null +++ b/vendor/antgoods/goods/composer.json @@ -0,0 +1,21 @@ +{ + "name": "antgoods/goods", + "description": "ant基础模块之一", + "type": "yii2-extension", + "keywords": ["goods"], + "license": "MIT", + "authors": [ + { + "name": "linyao", + "email": "linyaostalker@gmail.com" + } + ], + "require": { + "yiisoft/yii2": "~2.0.0" + }, + "autoload": { + "psr-4": { + "antgoods\\goods\\": "" + } + } +} diff --git a/vendor/antgoods/goods/src/Module.php b/vendor/antgoods/goods/src/Module.php new file mode 100755 index 0000000..5c2b482 --- /dev/null +++ b/vendor/antgoods/goods/src/Module.php @@ -0,0 +1,28 @@ + Date: Tue, 19 Nov 2019 10:25:59 +0800 Subject: [PATCH 003/102] =?UTF-8?q?=E5=9C=A8vendor/antgoods=E5=88=9B?= =?UTF-8?q?=E5=BB=BAant=E5=95=86=E5=93=81=E6=A8=A1=E5=9D=97=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E5=95=86=E5=93=81=E7=B1=BB=E5=88=AB=E8=A1=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=81=E7=A7=BB=E6=96=87=E4=BB=B6,=E5=9C=A8console/?= =?UTF-8?q?migrate=E5=88=A0=E9=99=A4=E5=89=8D=E7=AB=AF=E5=95=86=E5=93=81?= =?UTF-8?q?=E7=B1=BB=E5=88=AB=E8=A1=A8=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../m191119_021851_create_table_shop_category.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename console/migrations/m191111_080318_create_table_shop_category.php => vendor/antgoods/goods/src/migrations/m191119_021851_create_table_shop_category.php (87%) diff --git a/console/migrations/m191111_080318_create_table_shop_category.php b/vendor/antgoods/goods/src/migrations/m191119_021851_create_table_shop_category.php similarity index 87% rename from console/migrations/m191111_080318_create_table_shop_category.php rename to vendor/antgoods/goods/src/migrations/m191119_021851_create_table_shop_category.php index da2a1a3..eabe634 100644 --- a/console/migrations/m191111_080318_create_table_shop_category.php +++ b/vendor/antgoods/goods/src/migrations/m191119_021851_create_table_shop_category.php @@ -3,9 +3,9 @@ use yii\db\Migration; /** - * Class m191111_080318_create_table_shop_category + * Class m191119_021851_create_table_shop_category */ -class m191111_080318_create_table_shop_category extends Migration +class m191119_021851_create_table_shop_category extends Migration { /** * {@inheritdoc} @@ -13,7 +13,7 @@ class m191111_080318_create_table_shop_category extends Migration public function up() { $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="前端商品类别表"'; - $this->createTable('ats_shop_category', [ + $this->createTable('antgoods_shop_category', [ 'id' => $this->primaryKey(), 'name'=>$this->string(60)->defaultValue(null)->comment('类别名称'), 'pid'=>$this->integer(11)->defaultValue(null)->comment('父级id'), @@ -36,7 +36,7 @@ class m191111_080318_create_table_shop_category extends Migration */ public function down() { - $this->dropTable('kcs_tags_relation_goods'); + $this->dropTable('antgoods_shop_category'); return true; } } From 8665f9e6ce20fb7df0239a894d275581bde86b81 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 10:28:55 +0800 Subject: [PATCH 004/102] =?UTF-8?q?=E5=9C=A8vendor/antgoods=E5=88=9B?= =?UTF-8?q?=E5=BB=BAant=E5=95=86=E5=93=81=E6=A8=A1=E5=9D=97=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E5=95=86=E5=93=81=E7=B1=BB=E5=88=AB=E8=A1=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=81=E7=A7=BB=E6=96=87=E4=BB=B6,=E5=9C=A8console/?= =?UTF-8?q?migrate=E5=88=A0=E9=99=A4=E5=90=8E=E5=8F=B0=E5=95=86=E5=93=81?= =?UTF-8?q?=E7=B1=BB=E5=88=AB=E8=A1=A8=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../m191111_081842_create_table_category.php | 39 ------------------- 1 file changed, 39 deletions(-) delete mode 100644 console/migrations/m191111_081842_create_table_category.php diff --git a/console/migrations/m191111_081842_create_table_category.php b/console/migrations/m191111_081842_create_table_category.php deleted file mode 100644 index e7598bd..0000000 --- a/console/migrations/m191111_081842_create_table_category.php +++ /dev/null @@ -1,39 +0,0 @@ -createTable('ats_category', [ - 'id' => $this->primaryKey(), - 'name'=>$this->string(60)->defaultValue(null)->comment('类别名称'), - 'pid'=>$this->integer(11)->defaultValue(null)->comment('父级id'), - 'goods_count'=>$this->integer(11)->defaultValue(null)->comment('商品数量'), - 'sort_order'=>$this->smallInteger(3)->defaultValue(null)->comment('排序'), - 'icon_type'=>$this->tinyInteger(1)->defaultValue(null)->comment('图标类型'), - 'icon'=>$this->string(64)->defaultValue(null)->comment('图标'), - 'is_show'=>$this->tinyInteger(1)->defaultValue(null)->comment('是否显示,1为不显示'), - 'is_delete'=>$this->tinyInteger(1)->defaultValue(null)->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('ats_category'); - return true; - } -} From f8274e4dfbfc12d3be0dcf177e0451742ad60bb2 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 10:30:33 +0800 Subject: [PATCH 005/102] =?UTF-8?q?=E5=9C=A8vendor/antgoods=E5=88=9B?= =?UTF-8?q?=E5=BB=BAant=E5=95=86=E5=93=81=E6=A8=A1=E5=9D=97=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E8=A1=A8=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB=E6=96=87?= =?UTF-8?q?=E4=BB=B6,=E5=9C=A8console/migrate=E5=88=A0=E9=99=A4=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E8=A1=A8=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../m191119_022641_create_table_category.php | 39 +++++++++++++++++++ .../m191119_022939_create_table_attribute.php | 8 ++-- 2 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 vendor/antgoods/goods/src/migrations/m191119_022641_create_table_category.php rename console/migrations/m191111_082739_create_table_attribute.php => vendor/antgoods/goods/src/migrations/m191119_022939_create_table_attribute.php (82%) diff --git a/vendor/antgoods/goods/src/migrations/m191119_022641_create_table_category.php b/vendor/antgoods/goods/src/migrations/m191119_022641_create_table_category.php new file mode 100644 index 0000000..4ba6c29 --- /dev/null +++ b/vendor/antgoods/goods/src/migrations/m191119_022641_create_table_category.php @@ -0,0 +1,39 @@ +createTable('antgoods_category', [ + 'id' => $this->primaryKey(), + 'name'=>$this->string(60)->defaultValue(null)->comment('类别名称'), + 'pid'=>$this->integer(11)->defaultValue(null)->comment('父级id'), + 'goods_count'=>$this->integer(11)->defaultValue(null)->comment('商品数量'), + 'sort_order'=>$this->smallInteger(3)->defaultValue(null)->comment('排序'), + 'icon_type'=>$this->tinyInteger(1)->defaultValue(null)->comment('图标类型'), + 'icon'=>$this->string(64)->defaultValue(null)->comment('图标'), + 'is_show'=>$this->tinyInteger(1)->defaultValue(null)->comment('是否显示,1为不显示'), + 'is_delete'=>$this->tinyInteger(1)->defaultValue(null)->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/console/migrations/m191111_082739_create_table_attribute.php b/vendor/antgoods/goods/src/migrations/m191119_022939_create_table_attribute.php similarity index 82% rename from console/migrations/m191111_082739_create_table_attribute.php rename to vendor/antgoods/goods/src/migrations/m191119_022939_create_table_attribute.php index d640a25..df38219 100644 --- a/console/migrations/m191111_082739_create_table_attribute.php +++ b/vendor/antgoods/goods/src/migrations/m191119_022939_create_table_attribute.php @@ -3,9 +3,9 @@ use yii\db\Migration; /** - * Class m191111_082739_create_table_attribute + * Class m191119_022939_create_table_attribute */ -class m191111_082739_create_table_attribute extends Migration +class m191119_022939_create_table_attribute extends Migration { /** * {@inheritdoc} @@ -13,7 +13,7 @@ class m191111_082739_create_table_attribute extends Migration public function up() { $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="属性表"'; - $this->createTable('ats_attribute', [ + $this->createTable('antgoods_attribute', [ 'id' => $this->primaryKey(), 'name'=>$this->string(50)->defaultValue(null)->comment('属性名'), 'value'=>$this->text()->comment('属性值'), @@ -30,7 +30,7 @@ class m191111_082739_create_table_attribute extends Migration */ public function down() { - $this->dropTable('ats_attribute'); + $this->dropTable('antgoods_attribute'); return true; } } From 6c9913dc663bd6f3cd6ab12517fe8b11983fd41b Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 10:32:03 +0800 Subject: [PATCH 006/102] =?UTF-8?q?=E5=9C=A8vendor/antgoods=E5=88=9B?= =?UTF-8?q?=E5=BB=BAant=E5=95=86=E5=93=81=E6=A8=A1=E5=9D=97=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=B1=9E=E6=80=A7=E8=A1=A8=E6=95=B0=E6=8D=AE=E8=BF=81?= =?UTF-8?q?=E7=A7=BB=E6=96=87=E4=BB=B6,=E5=9C=A8console/migrate=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=95=86=E5=93=81=E5=B1=9E=E6=80=A7=E8=A1=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=81=E7=A7=BB=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/m191119_023115_create_table_goods_attr.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename console/migrations/m191111_083808_create_table_goods_attr.php => vendor/antgoods/goods/src/migrations/m191119_023115_create_table_goods_attr.php (81%) diff --git a/console/migrations/m191111_083808_create_table_goods_attr.php b/vendor/antgoods/goods/src/migrations/m191119_023115_create_table_goods_attr.php similarity index 81% rename from console/migrations/m191111_083808_create_table_goods_attr.php rename to vendor/antgoods/goods/src/migrations/m191119_023115_create_table_goods_attr.php index 573252f..62e66aa 100644 --- a/console/migrations/m191111_083808_create_table_goods_attr.php +++ b/vendor/antgoods/goods/src/migrations/m191119_023115_create_table_goods_attr.php @@ -3,9 +3,9 @@ use yii\db\Migration; /** - * Class m191111_083808_create_table_goods_attr + * Class m191119_023115_create_table_goods_attr */ -class m191111_083808_create_table_goods_attr extends Migration +class m191119_023115_create_table_goods_attr extends Migration { /** * {@inheritdoc} @@ -13,7 +13,7 @@ class m191111_083808_create_table_goods_attr extends Migration public function up() { $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="商品属性表"'; - $this->createTable('ats_goods_attr', [ + $this->createTable('antgoods_goods_attr', [ 'id' => $this->primaryKey(), 'goods_id'=>$this->integer(11)->defaultValue(null)->comment('商品id'), 'attr_id'=>$this->integer(11)->defaultValue(null)->comment('属性id'), @@ -29,7 +29,7 @@ class m191111_083808_create_table_goods_attr extends Migration */ public function down() { - $this->dropTable('ats_goods_attr'); + $this->dropTable('antgoods_goods_attr'); return true; } } From 815be5bcaa714a412fe5434b8524c694bc4b0851 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 10:41:25 +0800 Subject: [PATCH 007/102] =?UTF-8?q?=E5=9C=A8vendor/antgoods=E5=88=9B?= =?UTF-8?q?=E5=BB=BAant=E5=95=86=E5=93=81=E6=A8=A1=E5=9D=97=E5=93=81?= =?UTF-8?q?=E7=89=8C=E8=A1=A8=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB=E6=96=87?= =?UTF-8?q?=E4=BB=B6,=E5=9C=A8console/migrate=E5=88=A0=E9=99=A4=E5=93=81?= =?UTF-8?q?=E7=89=8C=E8=A1=A8=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/migrations/m191119_024029_create_table_brand.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename console/migrations/m191111_084452_create_table_brand.php => vendor/antgoods/goods/src/migrations/m191119_024029_create_table_brand.php (79%) diff --git a/console/migrations/m191111_084452_create_table_brand.php b/vendor/antgoods/goods/src/migrations/m191119_024029_create_table_brand.php similarity index 79% rename from console/migrations/m191111_084452_create_table_brand.php rename to vendor/antgoods/goods/src/migrations/m191119_024029_create_table_brand.php index 6658ff7..615e9ea 100644 --- a/console/migrations/m191111_084452_create_table_brand.php +++ b/vendor/antgoods/goods/src/migrations/m191119_024029_create_table_brand.php @@ -3,9 +3,9 @@ use yii\db\Migration; /** - * Class m191111_084452_create_table_brand + * Class m191119_024029_create_table_brand */ -class m191111_084452_create_table_brand extends Migration +class m191119_024029_create_table_brand extends Migration { /** * {@inheritdoc} @@ -13,7 +13,7 @@ class m191111_084452_create_table_brand extends Migration public function up() { $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="品牌表"'; - $this->createTable('ats_brand', [ + $this->createTable('antgoods_brand', [ 'id' => $this->primaryKey(), 'name'=>$this->string(50)->defaultValue(null)->comment('品牌名'), 'is_delete'=>$this->tinyInteger(1)->defaultValue(null)->comment('是否删除,1为已删除'), @@ -27,7 +27,7 @@ class m191111_084452_create_table_brand extends Migration */ public function down() { - $this->dropTable('ats_brand'); + $this->dropTable('antgoods_brand'); return true; } } From 10f9a9745ac46dbb0a360d9f141e64cf553dd572 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 10:43:18 +0800 Subject: [PATCH 008/102] =?UTF-8?q?=E5=9C=A8vendor/antgoods=E5=88=9B?= =?UTF-8?q?=E5=BB=BAant=E5=95=86=E5=93=81=E6=A8=A1=E5=9D=97=E5=95=86?= =?UTF-8?q?=E5=93=81=E8=A1=A8=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB=E6=96=87?= =?UTF-8?q?=E4=BB=B6,=E5=9C=A8console/migrate=E5=88=A0=E9=99=A4=E5=95=86?= =?UTF-8?q?=E5=93=81=E8=A1=A8=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/migrations/m191119_024205_create_table_goods.php | 4 ++-- .../antgoods/goods/src}/migrations/sql/goods.sql | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename console/migrations/m191111_095158_create_table_goods.php => vendor/antgoods/goods/src/migrations/m191119_024205_create_table_goods.php (77%) rename {console => vendor/antgoods/goods/src}/migrations/sql/goods.sql (100%) mode change 100644 => 100755 diff --git a/console/migrations/m191111_095158_create_table_goods.php b/vendor/antgoods/goods/src/migrations/m191119_024205_create_table_goods.php similarity index 77% rename from console/migrations/m191111_095158_create_table_goods.php rename to vendor/antgoods/goods/src/migrations/m191119_024205_create_table_goods.php index 5644e70..c3aa5fb 100644 --- a/console/migrations/m191111_095158_create_table_goods.php +++ b/vendor/antgoods/goods/src/migrations/m191119_024205_create_table_goods.php @@ -3,9 +3,9 @@ use yii\db\Migration; /** - * Class m191111_095158_create_table_goods + * Class m191119_024205_create_table_goods */ -class m191111_095158_create_table_goods extends Migration +class m191119_024205_create_table_goods extends Migration { /** * {@inheritdoc} diff --git a/console/migrations/sql/goods.sql b/vendor/antgoods/goods/src/migrations/sql/goods.sql old mode 100644 new mode 100755 similarity index 100% rename from console/migrations/sql/goods.sql rename to vendor/antgoods/goods/src/migrations/sql/goods.sql From dfde8e39fe8a15078da50638469a3c6bd2425957 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 10:46:39 +0800 Subject: [PATCH 009/102] =?UTF-8?q?=E5=9C=A8vendor/antgoods=E5=88=9B?= =?UTF-8?q?=E5=BB=BAant=E5=95=86=E5=93=81=E6=A8=A1=E5=9D=97=E5=95=86?= =?UTF-8?q?=E5=93=81sku=E8=A1=A8=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E6=96=87=E4=BB=B6,=E5=9C=A8console/migrate=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=95=86=E5=93=81sku=E8=A1=A8=E6=95=B0=E6=8D=AE=E8=BF=81?= =?UTF-8?q?=E7=A7=BB=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/migrations/m191119_024205_create_table_goods.php | 2 +- .../migrations/m191119_024345_create_table_goods_sku.php | 6 +++--- vendor/antgoods/goods/src/migrations/sql/goods.sql | 4 ++-- .../antgoods/goods/src}/migrations/sql/goods_sku.sql | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) rename console/migrations/m191111_100540_create_table_goods_sku.php => vendor/antgoods/goods/src/migrations/m191119_024345_create_table_goods_sku.php (66%) rename {console => vendor/antgoods/goods/src}/migrations/sql/goods_sku.sql (89%) mode change 100644 => 100755 diff --git a/vendor/antgoods/goods/src/migrations/m191119_024205_create_table_goods.php b/vendor/antgoods/goods/src/migrations/m191119_024205_create_table_goods.php index c3aa5fb..d16c1e5 100644 --- a/vendor/antgoods/goods/src/migrations/m191119_024205_create_table_goods.php +++ b/vendor/antgoods/goods/src/migrations/m191119_024205_create_table_goods.php @@ -21,7 +21,7 @@ class m191119_024205_create_table_goods extends Migration */ public function down() { - $this->dropTable("ats_goods"); + $this->dropTable("antgoods_goods"); return true; } } diff --git a/console/migrations/m191111_100540_create_table_goods_sku.php b/vendor/antgoods/goods/src/migrations/m191119_024345_create_table_goods_sku.php similarity index 66% rename from console/migrations/m191111_100540_create_table_goods_sku.php rename to vendor/antgoods/goods/src/migrations/m191119_024345_create_table_goods_sku.php index ac7ec13..227b38b 100644 --- a/console/migrations/m191111_100540_create_table_goods_sku.php +++ b/vendor/antgoods/goods/src/migrations/m191119_024345_create_table_goods_sku.php @@ -3,9 +3,9 @@ use yii\db\Migration; /** - * Class m191111_100540_create_table_goods_sku + * Class m191119_024345_create_table_goods_sku */ -class m191111_100540_create_table_goods_sku extends Migration +class m191119_024345_create_table_goods_sku extends Migration { /** * {@inheritdoc} @@ -21,7 +21,7 @@ class m191111_100540_create_table_goods_sku extends Migration */ public function down() { - $this->dropTable("ats_goods_sku"); + $this->dropTable("antgoods_goods_sku"); return true; } } diff --git a/vendor/antgoods/goods/src/migrations/sql/goods.sql b/vendor/antgoods/goods/src/migrations/sql/goods.sql index 186d046..238e7c9 100755 --- a/vendor/antgoods/goods/src/migrations/sql/goods.sql +++ b/vendor/antgoods/goods/src/migrations/sql/goods.sql @@ -1,5 +1,5 @@ -DROP TABLE IF EXISTS `ats_goods`; -CREATE TABLE `ats_goods` ( +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) DEFAULT NULL COMMENT '后台商品类别id', diff --git a/console/migrations/sql/goods_sku.sql b/vendor/antgoods/goods/src/migrations/sql/goods_sku.sql old mode 100644 new mode 100755 similarity index 89% rename from console/migrations/sql/goods_sku.sql rename to vendor/antgoods/goods/src/migrations/sql/goods_sku.sql index 0a5ec6c..478a19f --- a/console/migrations/sql/goods_sku.sql +++ b/vendor/antgoods/goods/src/migrations/sql/goods_sku.sql @@ -1,5 +1,5 @@ -DROP TABLE IF EXISTS `ats_goods_sku`; -CREATE TABLE `ats_goods_sku` ( +DROP TABLE IF EXISTS `antgoods_goods_sku`; +CREATE TABLE `antgoods_goods_sku` ( `id` int(11) NOT NULL AUTO_INCREMENT, `goods_id` int(11) DEFAULT NULL COMMENT '商品id', `goods_code` varchar(50) DEFAULT NULL COMMENT '商品条码', From 39009a64aa9c9f85e014cc7f425e729dba39bff4 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 10:57:20 +0800 Subject: [PATCH 010/102] =?UTF-8?q?=E5=9C=A8vendor/antgoods=E5=88=9B?= =?UTF-8?q?=E5=BB=BAant=E5=95=86=E5=93=81=E6=A8=A1=E5=9D=97=E4=BE=9B?= =?UTF-8?q?=E5=BA=94=E5=95=86=E8=A1=A8=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E6=96=87=E4=BB=B6,=E5=9C=A8console/migrate=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E8=A1=A8=E6=95=B0=E6=8D=AE=E8=BF=81?= =?UTF-8?q?=E7=A7=BB=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/m191119_025607_create_table_supplier.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename console/migrations/m191111_100639_create_table_supplier.php => vendor/antgoods/goods/src/migrations/m191119_025607_create_table_supplier.php (83%) diff --git a/console/migrations/m191111_100639_create_table_supplier.php b/vendor/antgoods/goods/src/migrations/m191119_025607_create_table_supplier.php similarity index 83% rename from console/migrations/m191111_100639_create_table_supplier.php rename to vendor/antgoods/goods/src/migrations/m191119_025607_create_table_supplier.php index e13f46a..60ccef4 100644 --- a/console/migrations/m191111_100639_create_table_supplier.php +++ b/vendor/antgoods/goods/src/migrations/m191119_025607_create_table_supplier.php @@ -3,9 +3,9 @@ use yii\db\Migration; /** - * Class m191111_100639_create_table_supplier + * Class m191119_025607_create_table_supplier */ -class m191111_100639_create_table_supplier extends Migration +class m191119_025607_create_table_supplier extends Migration { /** * {@inheritdoc} @@ -13,7 +13,7 @@ class m191111_100639_create_table_supplier extends Migration public function up() { $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="供应商表"'; - $this->createTable('ats_supplier', [ + $this->createTable('antgoods_supplier', [ 'id' => $this->primaryKey(), 'name'=>$this->string(50)->defaultValue(null)->comment('供应商名称'), 'full_name'=>$this->string(50)->defaultValue(null)->comment('供应商全称'), @@ -30,7 +30,7 @@ class m191111_100639_create_table_supplier extends Migration */ public function down() { - $this->dropTable('ats_supplier'); + $this->dropTable('antgoods_supplier'); return true; } } From 3bc83f3fc8788a7b89bfb6524022395cf8cb3525 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 11:00:16 +0800 Subject: [PATCH 011/102] =?UTF-8?q?=E5=9C=A8vendor/antgoods=E5=88=9B?= =?UTF-8?q?=E5=BB=BAant=E5=95=86=E5=93=81=E6=A8=A1=E5=9D=97=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E5=B1=9E=E6=80=A7=E8=A1=A8=E6=95=B0=E6=8D=AE=E8=BF=81?= =?UTF-8?q?=E7=A7=BB=E6=96=87=E4=BB=B6,=E5=9C=A8console/migrate=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E7=AD=9B=E9=80=89=E5=B1=9E=E6=80=A7=E8=A1=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=81=E7=A7=BB=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../m191119_025843_create_table_filter_attr.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename console/migrations/m191111_100958_create_table_filter_attr.php => vendor/antgoods/goods/src/migrations/m191119_025843_create_table_filter_attr.php (81%) diff --git a/console/migrations/m191111_100958_create_table_filter_attr.php b/vendor/antgoods/goods/src/migrations/m191119_025843_create_table_filter_attr.php similarity index 81% rename from console/migrations/m191111_100958_create_table_filter_attr.php rename to vendor/antgoods/goods/src/migrations/m191119_025843_create_table_filter_attr.php index 357f4dd..5ab3f83 100644 --- a/console/migrations/m191111_100958_create_table_filter_attr.php +++ b/vendor/antgoods/goods/src/migrations/m191119_025843_create_table_filter_attr.php @@ -3,9 +3,9 @@ use yii\db\Migration; /** - * Class m191111_100958_create_table_filter_attr + * Class m191119_025843_create_table_filter_attr */ -class m191111_100958_create_table_filter_attr extends Migration +class m191119_025843_create_table_filter_attr extends Migration { /** * {@inheritdoc} @@ -13,7 +13,7 @@ class m191111_100958_create_table_filter_attr extends Migration public function up() { $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="筛选属性表"'; - $this->createTable('ats_filter_attr', [ + $this->createTable('antgoods_filter_attr', [ 'id' => $this->primaryKey(), 'goods_id'=>$this->integer(11)->defaultValue(null)->comment('商品id'), 'attr_id'=>$this->integer(11)->defaultValue(null)->comment('属性id'), @@ -29,7 +29,7 @@ class m191111_100958_create_table_filter_attr extends Migration */ public function down() { - $this->dropTable('ats_filter_attr'); + $this->dropTable('antgoods_filter_attr'); return true; } } From 0b7ed0fcd3318f8954d78f0c2091e05d2189b9e2 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 11:08:00 +0800 Subject: [PATCH 012/102] =?UTF-8?q?antgoods=E6=A8=A1=E5=9D=97=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0shopcategory=E6=A8=A1=E5=9E=8B=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/models/ars/Category.php | 85 ------------------- .../goods/src}/models/ars/ShopCategory.php | 2 +- 2 files changed, 1 insertion(+), 86 deletions(-) delete mode 100644 common/models/ars/Category.php rename {common => vendor/antgoods/goods/src}/models/ars/ShopCategory.php (98%) mode change 100644 => 100755 diff --git a/common/models/ars/Category.php b/common/models/ars/Category.php deleted file mode 100644 index 3e67792..0000000 --- a/common/models/ars/Category.php +++ /dev/null @@ -1,85 +0,0 @@ - 60], - [['icon'], 'string', 'max' => 64], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => '类别名称', - 'pid' => '父级id', - 'goods_count' => '商品数量', - 'sort_order' => '排序', - 'icon_type' => '图标类型', - 'icon' => '图标', - 'is_show' => '是否显示,1为不显示', - '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/common/models/ars/ShopCategory.php b/vendor/antgoods/goods/src/models/ars/ShopCategory.php old mode 100644 new mode 100755 similarity index 98% rename from common/models/ars/ShopCategory.php rename to vendor/antgoods/goods/src/models/ars/ShopCategory.php index 5df7d3d..aac4022 --- a/common/models/ars/ShopCategory.php +++ b/vendor/antgoods/goods/src/models/ars/ShopCategory.php @@ -1,6 +1,6 @@ Date: Tue, 19 Nov 2019 11:08:22 +0800 Subject: [PATCH 013/102] =?UTF-8?q?antgoods=E6=A8=A1=E5=9D=97=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0category=E6=A8=A1=E5=9E=8B=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods/src/models/ars/Category.php | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100755 vendor/antgoods/goods/src/models/ars/Category.php diff --git a/vendor/antgoods/goods/src/models/ars/Category.php b/vendor/antgoods/goods/src/models/ars/Category.php new file mode 100755 index 0000000..3e67792 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/Category.php @@ -0,0 +1,85 @@ + 60], + [['icon'], 'string', 'max' => 64], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => '类别名称', + 'pid' => '父级id', + 'goods_count' => '商品数量', + 'sort_order' => '排序', + 'icon_type' => '图标类型', + 'icon' => '图标', + 'is_show' => '是否显示,1为不显示', + '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(); + }, + ], + ]; + } +} From 59d6ceeee1b4c7edcaac18440e52969c1d58679c Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 11:08:49 +0800 Subject: [PATCH 014/102] =?UTF-8?q?antgoods=E6=A8=A1=E5=9D=97=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0attribute=E6=A8=A1=E5=9E=8B=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {common => vendor/antgoods/goods/src}/models/ars/Attribute.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {common => vendor/antgoods/goods/src}/models/ars/Attribute.php (100%) mode change 100644 => 100755 diff --git a/common/models/ars/Attribute.php b/vendor/antgoods/goods/src/models/ars/Attribute.php old mode 100644 new mode 100755 similarity index 100% rename from common/models/ars/Attribute.php rename to vendor/antgoods/goods/src/models/ars/Attribute.php From 746f566d13c9503204d0a5dcd9368df390a00fff Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 11:10:14 +0800 Subject: [PATCH 015/102] =?UTF-8?q?antgoods=E6=A8=A1=E5=9D=97=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0goodsattribute=E6=A8=A1=E5=9E=8B=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {common => vendor/antgoods/goods/src}/models/ars/GoodsAttr.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {common => vendor/antgoods/goods/src}/models/ars/GoodsAttr.php (100%) mode change 100644 => 100755 diff --git a/common/models/ars/GoodsAttr.php b/vendor/antgoods/goods/src/models/ars/GoodsAttr.php old mode 100644 new mode 100755 similarity index 100% rename from common/models/ars/GoodsAttr.php rename to vendor/antgoods/goods/src/models/ars/GoodsAttr.php From 0788b1b08de58619a5a11ceb7a0d6467b1549337 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 11:10:35 +0800 Subject: [PATCH 016/102] =?UTF-8?q?antgoods=E6=A8=A1=E5=9D=97=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0brand=E6=A8=A1=E5=9E=8B=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {common => vendor/antgoods/goods/src}/models/ars/Brand.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {common => vendor/antgoods/goods/src}/models/ars/Brand.php (100%) mode change 100644 => 100755 diff --git a/common/models/ars/Brand.php b/vendor/antgoods/goods/src/models/ars/Brand.php old mode 100644 new mode 100755 similarity index 100% rename from common/models/ars/Brand.php rename to vendor/antgoods/goods/src/models/ars/Brand.php From 4eecb8ae4d82a694f7e90e5ab3c4c430ae6b9e55 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 11:10:49 +0800 Subject: [PATCH 017/102] =?UTF-8?q?antgoods=E6=A8=A1=E5=9D=97=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0goods=E6=A8=A1=E5=9E=8B=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {common => vendor/antgoods/goods/src}/models/ars/Goods.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {common => vendor/antgoods/goods/src}/models/ars/Goods.php (100%) mode change 100644 => 100755 diff --git a/common/models/ars/Goods.php b/vendor/antgoods/goods/src/models/ars/Goods.php old mode 100644 new mode 100755 similarity index 100% rename from common/models/ars/Goods.php rename to vendor/antgoods/goods/src/models/ars/Goods.php From 6cb569c102fcaa7a97e047082b2bada9c07d97b5 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 11:11:05 +0800 Subject: [PATCH 018/102] =?UTF-8?q?antgoods=E6=A8=A1=E5=9D=97=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0goodssku=E6=A8=A1=E5=9E=8B=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {common => vendor/antgoods/goods/src}/models/ars/GoodsSku.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {common => vendor/antgoods/goods/src}/models/ars/GoodsSku.php (100%) mode change 100644 => 100755 diff --git a/common/models/ars/GoodsSku.php b/vendor/antgoods/goods/src/models/ars/GoodsSku.php old mode 100644 new mode 100755 similarity index 100% rename from common/models/ars/GoodsSku.php rename to vendor/antgoods/goods/src/models/ars/GoodsSku.php From 98728d184db58bca21514bcacd1a0196a7d3c93f Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 11:11:54 +0800 Subject: [PATCH 019/102] =?UTF-8?q?antgoods=E6=A8=A1=E5=9D=97=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0supplier=E6=A8=A1=E5=9E=8B=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {common => vendor/antgoods/goods/src}/models/ars/Supplier.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {common => vendor/antgoods/goods/src}/models/ars/Supplier.php (100%) mode change 100644 => 100755 diff --git a/common/models/ars/Supplier.php b/vendor/antgoods/goods/src/models/ars/Supplier.php old mode 100644 new mode 100755 similarity index 100% rename from common/models/ars/Supplier.php rename to vendor/antgoods/goods/src/models/ars/Supplier.php From edf328e00b85d5a61d5ad90dbfbcd242cd55203a Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 11:12:17 +0800 Subject: [PATCH 020/102] =?UTF-8?q?antgoods=E6=A8=A1=E5=9D=97=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0filter=5Fattr=E6=A8=A1=E5=9E=8B=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {common => vendor/antgoods/goods/src}/models/ars/FilterAttr.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {common => vendor/antgoods/goods/src}/models/ars/FilterAttr.php (100%) mode change 100644 => 100755 diff --git a/common/models/ars/FilterAttr.php b/vendor/antgoods/goods/src/models/ars/FilterAttr.php old mode 100644 new mode 100755 similarity index 100% rename from common/models/ars/FilterAttr.php rename to vendor/antgoods/goods/src/models/ars/FilterAttr.php From 5ddf6795249a23f6686890798e8f46a1f6c72d2e Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 11:18:45 +0800 Subject: [PATCH 021/102] =?UTF-8?q?antgoods=E6=A8=A1=E5=9D=97=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0goodscontroller.php,=E5=A2=9E=E5=8A=A0goodssearch.php,?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0goods=E7=9A=84views=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B9=EF=BC=8C=E5=9C=A8backend=E5=88=A0=E9=99=A4=E7=9B=B8?= =?UTF-8?q?=E5=BA=94=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../antgoods/goods/src}/controllers/GoodsController.php | 2 +- .../antgoods/goods/src}/models/searchs/GoodsSearch.php | 2 +- {backend => vendor/antgoods/goods/src}/views/goods/_form.php | 0 {backend => vendor/antgoods/goods/src}/views/goods/_search.php | 0 {backend => vendor/antgoods/goods/src}/views/goods/create.php | 0 {backend => vendor/antgoods/goods/src}/views/goods/index.php | 0 {backend => vendor/antgoods/goods/src}/views/goods/update.php | 0 {backend => vendor/antgoods/goods/src}/views/goods/view.php | 0 8 files changed, 2 insertions(+), 2 deletions(-) rename {backend => vendor/antgoods/goods/src}/controllers/GoodsController.php (99%) mode change 100644 => 100755 rename {common => vendor/antgoods/goods/src}/models/searchs/GoodsSearch.php (99%) mode change 100644 => 100755 rename {backend => vendor/antgoods/goods/src}/views/goods/_form.php (100%) rename {backend => vendor/antgoods/goods/src}/views/goods/_search.php (100%) rename {backend => vendor/antgoods/goods/src}/views/goods/create.php (100%) rename {backend => vendor/antgoods/goods/src}/views/goods/index.php (100%) rename {backend => vendor/antgoods/goods/src}/views/goods/update.php (100%) rename {backend => vendor/antgoods/goods/src}/views/goods/view.php (100%) diff --git a/backend/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php old mode 100644 new mode 100755 similarity index 99% rename from backend/controllers/GoodsController.php rename to vendor/antgoods/goods/src/controllers/GoodsController.php index c9024d1..9c7a1cf --- a/backend/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -1,6 +1,6 @@ Date: Tue, 19 Nov 2019 11:24:04 +0800 Subject: [PATCH 022/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9antgoods=E6=A8=A1?= =?UTF-8?q?=E5=9D=97model=E6=96=87=E4=BB=B6=E5=91=BD=E5=90=8D=E7=A9=BA?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/models/ars/Attribute.php | 2 +- vendor/antgoods/goods/src/models/ars/Brand.php | 2 +- vendor/antgoods/goods/src/models/ars/Category.php | 2 +- vendor/antgoods/goods/src/models/ars/FilterAttr.php | 2 +- vendor/antgoods/goods/src/models/ars/Goods.php | 2 +- vendor/antgoods/goods/src/models/ars/GoodsAttr.php | 2 +- vendor/antgoods/goods/src/models/ars/GoodsSku.php | 2 +- vendor/antgoods/goods/src/models/ars/Supplier.php | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/vendor/antgoods/goods/src/models/ars/Attribute.php b/vendor/antgoods/goods/src/models/ars/Attribute.php index 664fb60..a7f1f95 100755 --- a/vendor/antgoods/goods/src/models/ars/Attribute.php +++ b/vendor/antgoods/goods/src/models/ars/Attribute.php @@ -1,6 +1,6 @@ Date: Tue, 19 Nov 2019 11:27:43 +0800 Subject: [PATCH 023/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9backend/views/layouts?= =?UTF-8?q?/sidebar.php=E7=9A=84=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E8=B7=B3=E8=BD=AC=E5=9F=9F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/views/layouts/sidebar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 backend/views/layouts/sidebar.php diff --git a/backend/views/layouts/sidebar.php b/backend/views/layouts/sidebar.php old mode 100644 new mode 100755 index 828322f..1ce632a --- a/backend/views/layouts/sidebar.php +++ b/backend/views/layouts/sidebar.php @@ -22,7 +22,7 @@ use iron\widgets\Menu; ], ['label' => '商品管理', 'url' => '#', 'icon' => 'far fa-archive', 'items' => [ ['label' => '商品分类', 'url' => ['category/index', 'tag' => 'new']], - ['label' => '商品列表', 'url' => ['goods/index']], + ['label' => '商品列表', 'url' => ['antgoods/goods/index']], ['label' => '属性管理', 'url' => ['attribute/index']], ] ], From fd0d4381d48cebe51d36fc41204442e7119fae75 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 11:30:53 +0800 Subject: [PATCH 024/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9antgoods=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=95=86=E5=93=81=E6=8E=A7=E5=88=B6=E5=99=A8=E6=96=87?= =?UTF-8?q?=E4=BB=B6Goods=E6=A8=A1=E5=9E=8B=E5=92=8CGoodsSearch=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/controllers/GoodsController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index 9c7a1cf..7180f54 100755 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -3,8 +3,8 @@ namespace antgoods\goods\controllers; use Yii; -use common\models\ars\Goods; -use common\models\searchs\GoodsSearch; +use antgoods\goods\models\ars\Goods; +use antgoods\goods\models\searchs\GoodsSearch; use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; From cee6abea0ac16db0945bd7a186be62fd0a741851 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 11:33:10 +0800 Subject: [PATCH 025/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9antgoods=E6=A8=A1?= =?UTF-8?q?=E5=9D=97goodssearch.php=E6=96=87=E4=BB=B6goods=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/models/searchs/GoodsSearch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php b/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php index a85130a..84736a0 100755 --- a/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php +++ b/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php @@ -5,7 +5,7 @@ namespace antgoods\goods\models\searchs; use yii\base\Model; use yii\data\ActiveDataProvider; use yii\helpers\ArrayHelper; -use common\models\ars\Goods; +use antgoods\goods\models\ars\Goods; /** * GoodsSearch represents the model behind the search form of `common\models\ars\Goods`. From 54a55c27ece87db8d3b994279cbcc90a31b794b9 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 11:36:10 +0800 Subject: [PATCH 026/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9antgoods=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E6=89=80=E6=9C=89=E6=A8=A1=E5=9E=8B=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=A1=A8=E5=90=8D=E7=9A=84=E8=A1=A8=E5=89=8D?= =?UTF-8?q?=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/models/ars/Attribute.php | 2 +- vendor/antgoods/goods/src/models/ars/Brand.php | 2 +- vendor/antgoods/goods/src/models/ars/Category.php | 2 +- vendor/antgoods/goods/src/models/ars/FilterAttr.php | 2 +- vendor/antgoods/goods/src/models/ars/Goods.php | 2 +- vendor/antgoods/goods/src/models/ars/GoodsAttr.php | 2 +- vendor/antgoods/goods/src/models/ars/GoodsSku.php | 2 +- vendor/antgoods/goods/src/models/ars/ShopCategory.php | 2 +- vendor/antgoods/goods/src/models/ars/Supplier.php | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/vendor/antgoods/goods/src/models/ars/Attribute.php b/vendor/antgoods/goods/src/models/ars/Attribute.php index a7f1f95..7699897 100755 --- a/vendor/antgoods/goods/src/models/ars/Attribute.php +++ b/vendor/antgoods/goods/src/models/ars/Attribute.php @@ -24,7 +24,7 @@ class Attribute extends \yii\db\ActiveRecord */ public static function tableName() { - return 'ats_attribute'; + return 'antgoods_attribute'; } /** diff --git a/vendor/antgoods/goods/src/models/ars/Brand.php b/vendor/antgoods/goods/src/models/ars/Brand.php index 0cff1d8..aab9e05 100755 --- a/vendor/antgoods/goods/src/models/ars/Brand.php +++ b/vendor/antgoods/goods/src/models/ars/Brand.php @@ -21,7 +21,7 @@ class Brand extends \yii\db\ActiveRecord */ public static function tableName() { - return 'ats_brand'; + return 'antgoods_brand'; } /** diff --git a/vendor/antgoods/goods/src/models/ars/Category.php b/vendor/antgoods/goods/src/models/ars/Category.php index 4e5333c..e7e7938 100755 --- a/vendor/antgoods/goods/src/models/ars/Category.php +++ b/vendor/antgoods/goods/src/models/ars/Category.php @@ -27,7 +27,7 @@ class Category extends \yii\db\ActiveRecord */ public static function tableName() { - return 'ats_category'; + return 'antgoods_category'; } /** diff --git a/vendor/antgoods/goods/src/models/ars/FilterAttr.php b/vendor/antgoods/goods/src/models/ars/FilterAttr.php index 4230496..1e377f1 100755 --- a/vendor/antgoods/goods/src/models/ars/FilterAttr.php +++ b/vendor/antgoods/goods/src/models/ars/FilterAttr.php @@ -23,7 +23,7 @@ class FilterAttr extends \yii\db\ActiveRecord */ public static function tableName() { - return 'ats_filter_attr'; + return 'antgoods_filter_attr'; } /** diff --git a/vendor/antgoods/goods/src/models/ars/Goods.php b/vendor/antgoods/goods/src/models/ars/Goods.php index e565c02..f2ecddd 100755 --- a/vendor/antgoods/goods/src/models/ars/Goods.php +++ b/vendor/antgoods/goods/src/models/ars/Goods.php @@ -49,7 +49,7 @@ class Goods extends \yii\db\ActiveRecord */ public static function tableName() { - return 'ats_goods'; + return 'antgoods_goods'; } /** diff --git a/vendor/antgoods/goods/src/models/ars/GoodsAttr.php b/vendor/antgoods/goods/src/models/ars/GoodsAttr.php index c07a133..9f22e23 100755 --- a/vendor/antgoods/goods/src/models/ars/GoodsAttr.php +++ b/vendor/antgoods/goods/src/models/ars/GoodsAttr.php @@ -23,7 +23,7 @@ class GoodsAttr extends \yii\db\ActiveRecord */ public static function tableName() { - return 'ats_goods_attr'; + return 'antgoods_goods_attr'; } /** diff --git a/vendor/antgoods/goods/src/models/ars/GoodsSku.php b/vendor/antgoods/goods/src/models/ars/GoodsSku.php index 5b985fd..ea5b731 100755 --- a/vendor/antgoods/goods/src/models/ars/GoodsSku.php +++ b/vendor/antgoods/goods/src/models/ars/GoodsSku.php @@ -36,7 +36,7 @@ class GoodsSku extends \yii\db\ActiveRecord */ public static function tableName() { - return 'ats_goods_sku'; + return 'antgoods_goods_sku'; } /** diff --git a/vendor/antgoods/goods/src/models/ars/ShopCategory.php b/vendor/antgoods/goods/src/models/ars/ShopCategory.php index aac4022..aef66d6 100755 --- a/vendor/antgoods/goods/src/models/ars/ShopCategory.php +++ b/vendor/antgoods/goods/src/models/ars/ShopCategory.php @@ -30,7 +30,7 @@ class ShopCategory extends \yii\db\ActiveRecord */ public static function tableName() { - return 'ats_shop_category'; + return 'antgoods_shop_category'; } /** diff --git a/vendor/antgoods/goods/src/models/ars/Supplier.php b/vendor/antgoods/goods/src/models/ars/Supplier.php index 2aff034..c4ae6a8 100755 --- a/vendor/antgoods/goods/src/models/ars/Supplier.php +++ b/vendor/antgoods/goods/src/models/ars/Supplier.php @@ -24,7 +24,7 @@ class Supplier extends \yii\db\ActiveRecord */ public static function tableName() { - return 'ats_supplier'; + return 'antgoods_supplier'; } /** From 23062a786db283f7823bac4ab6038d11660a70e7 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 13:57:11 +0800 Subject: [PATCH 027/102] =?UTF-8?q?=E5=A2=9E=E5=8A=A0antgoods=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 5 + .../goods/src/controllers/GoodsController.php | 149 ------------- .../antgoods/goods/src/models/ars/Goods.php | 133 ------------ .../goods/src/models/searchs/GoodsSearch.php | 197 ------------------ .../antgoods/goods/src/views/goods/_form.php | 82 -------- .../goods/src/views/goods/_search.php | 49 ----- .../antgoods/goods/src/views/goods/create.php | 18 -- .../antgoods/goods/src/views/goods/index.php | 28 --- .../antgoods/goods/src/views/goods/update.php | 19 -- .../antgoods/goods/src/views/goods/view.php | 59 ------ 10 files changed, 5 insertions(+), 734 deletions(-) delete mode 100755 vendor/antgoods/goods/src/controllers/GoodsController.php delete mode 100755 vendor/antgoods/goods/src/models/ars/Goods.php delete mode 100755 vendor/antgoods/goods/src/models/searchs/GoodsSearch.php delete mode 100644 vendor/antgoods/goods/src/views/goods/_form.php delete mode 100644 vendor/antgoods/goods/src/views/goods/_search.php delete mode 100644 vendor/antgoods/goods/src/views/goods/create.php delete mode 100644 vendor/antgoods/goods/src/views/goods/index.php delete mode 100644 vendor/antgoods/goods/src/views/goods/update.php delete mode 100644 vendor/antgoods/goods/src/views/goods/view.php diff --git a/composer.json b/composer.json index 83a43bb..8a68eb5 100755 --- a/composer.json +++ b/composer.json @@ -35,5 +35,10 @@ "yiisoft/yii2-debug": "^2.0@dev", "kint-php/kint": "dev-master", "yiisoft/yii2-gii": "^2.0@dev" + }, + "autoload": { + "psr-4": { + "antgoods\\goods\\": "vendor/antgoods/goods/src" + } } } diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php deleted file mode 100755 index 7180f54..0000000 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ /dev/null @@ -1,149 +0,0 @@ - [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['POST'], - ], - ], - ]; - } - - /** - * Lists all Goods models. - * @return mixed - */ - public function actionIndex() - { - $searchModel = new GoodsSearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - 'columns' => $searchModel->columns() - ]); - } - - /** - * Displays a single Goods model. - * @param integer $id - * @return mixed - * @throws NotFoundHttpException if the model cannot be found - */ - public function actionView($id) - { - return $this->render('view', [ - 'model' => $this->findModel($id), - ]); - } - - /** - * Creates a new Goods model. - * If creation is successful, the browser will be redirected to the 'view' page. - * @return mixed - */ - public function actionCreate() - { - $model = new Goods(); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect('index'); - } - - return $this->render('create', [ - 'model' => $model, - ]); - } - - /** - * Updates an existing Goods model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id - * @return mixed - * @throws NotFoundHttpException if the model cannot be found - */ - public function actionUpdate($id) - { - $model = $this->findModel($id); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect('index'); - } - - return $this->render('update', [ - 'model' => $model, - ]); - } - - /** - * Deletes an existing Goods model. - * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id - * @return mixed - * @throws NotFoundHttpException if the model cannot be found - */ - public function actionDelete($id) - { - $this->findModel($id)->delete(); - - return $this->redirect(['index']); - } - - /** - * Finds the Goods model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * @param integer $id - * @return Goods the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($id) - { - if (($model = Goods::findOne($id)) !== null) { - return $model; - } - - throw new NotFoundHttpException('The requested page does not exist.'); - } - /** - * @author iron - * 文件导出 - */ - public function actionExport() - { - $searchModel = new GoodsSearch(); - $params = Yii::$app->request->queryParams; - if ($params['page-type'] == 'all') { - $dataProvider = $searchModel->allData($params); - } else { - $dataProvider = $searchModel->search($params); - } - \iron\widget\Excel::export([ - 'models' => $dataProvider->getModels(), - 'format' => 'Xlsx', - 'asAttachment' => true, - 'fileName' =>'Goods'. "-" .date('Y-m-d H/i/s', time()), - 'columns' => $searchModel->columns() - ]); - } -} diff --git a/vendor/antgoods/goods/src/models/ars/Goods.php b/vendor/antgoods/goods/src/models/ars/Goods.php deleted file mode 100755 index f2ecddd..0000000 --- a/vendor/antgoods/goods/src/models/ars/Goods.php +++ /dev/null @@ -1,133 +0,0 @@ - 120], - [['sn'], 'string', 'max' => 60], - [['code'], 'string', 'max' => 50], - [['unit'], 'string', 'max' => 16], - [['brief'], 'string', 'max' => 255], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'pid' => '父级id', - 'cat_id' => '后台商品类别id', - 'brand_id' => '品牌id', - 'shop_cat_id' => '前端商品类别id', - 'name' => '商品名称', - 'sn' => '商品唯一货号', - 'code' => '商品货码', - 'supplier_id' => '供应商id', - 'weight' => '重量', - 'length' => '长度', - 'width' => '宽度', - 'height' => '高度', - 'diameter' => '直径', - 'unit' => '单位', - 'sold_count' => '已售数量', - 'limit_count' => '限购数量', - 'stock' => '库存', - 'stock_warn' => '库存警告', - 'market_price' => '市场价', - 'price' => '销售价', - 'brief' => '简介', - 'description' => '详细介绍', - 'image' => '图片id', - 'model_id' => '模型id', - 'is_sale' => '该商品是否开放销售,1为是,0为否', - '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(); - }, - ], - ]; - } -} diff --git a/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php b/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php deleted file mode 100755 index 84736a0..0000000 --- a/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php +++ /dev/null @@ -1,197 +0,0 @@ - 'blobt\grid\CheckboxColumn', - 'width' => '2%', - 'align' => 'center' - ], - 'id', - 'pid', - 'cat_id', - 'brand_id', - 'shop_cat_id', - //'name', - //'sn', - //'code', - //'supplier_id', - //'weight', - //'length', - //'width', - //'height', - //'diameter', - //'unit', - //'sold_count', - //'limit_count', - //'stock', - //'stock_warn', - //'market_price', - //'price', - //'brief', - //'description', - //'image', - //'model_id', - //'is_sale', - //'sort_order', - //'bouns_points', - //'experience_points', - //'is_delete', - //'express_template', - //'created_at', - //'updated_at', - [ - 'class' => 'iron\grid\ActionColumn', - 'align' => 'center', - ], - ]; - } - /** - * @param $params - * @return ActiveDataProvider - * 不分页的所有数据 - */ - public function allData($params) - { - $query = Goods::find(); - $dataProvider = new ActiveDataProvider([ - 'query' => $query, - 'pagination' => false, - 'sort' => false - ]); - $this->load($params); - return $this->filter($query, $dataProvider); - } - - /** - * Creates data provider instance with search query applied - * - * @param array $params - * - * @return ActiveDataProvider - */ - public function search($params) - { - $query = Goods::find(); - - // add conditions that should always apply here - - $dataProvider = new ActiveDataProvider([ - 'query' => $query, - 'pagination' => [ - 'pageSizeLimit' => [1, 200] - ], - 'sort' => [ - 'defaultOrder' => [ - 'id' => SORT_DESC, - ] - ], - ]); - - $this->load($params); - return $this->filter($query, $dataProvider); - } - /** - * @param $query - * @param $dataProvider - * @return ActiveDataProvider - * 条件筛选 - */ - private function filter($query, $dataProvider){ - if (!$this->validate()) { - // uncomment the following line if you do not want to return any records when validation fails - // $query->where('0=1'); - return $dataProvider; - } - - // grid filtering conditions - $query->andFilterWhere([ - 'id' => $this->id, - 'pid' => $this->pid, - 'cat_id' => $this->cat_id, - 'brand_id' => $this->brand_id, - 'shop_cat_id' => $this->shop_cat_id, - 'supplier_id' => $this->supplier_id, - 'weight' => $this->weight, - 'length' => $this->length, - 'width' => $this->width, - 'height' => $this->height, - 'diameter' => $this->diameter, - 'sold_count' => $this->sold_count, - 'limit_count' => $this->limit_count, - 'stock' => $this->stock, - 'stock_warn' => $this->stock_warn, - 'market_price' => $this->market_price, - 'price' => $this->price, - 'image' => $this->image, - 'model_id' => $this->model_id, - 'is_sale' => $this->is_sale, - 'sort_order' => $this->sort_order, - 'bouns_points' => $this->bouns_points, - 'experience_points' => $this->experience_points, - 'is_delete' => $this->is_delete, - 'express_template' => $this->express_template, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, - ]); - - $query->andFilterWhere(['like', 'name', $this->name]) - ->andFilterWhere(['like', 'sn', $this->sn]) - ->andFilterWhere(['like', 'code', $this->code]) - ->andFilterWhere(['like', 'unit', $this->unit]) - ->andFilterWhere(['like', 'brief', $this->brief]) - ->andFilterWhere(['like', 'description', $this->description]); - if ($this->created_at_range) { - $arr = explode(' ~ ', $this->created_at_range); - $start = strtotime($arr[0]); - $end = strtotime($arr[1]) + 3600 * 24; - $query->andFilterWhere(['between', 'created_at', $start, $end]); - } - return $dataProvider; - } -} diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php deleted file mode 100644 index 149e969..0000000 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ /dev/null @@ -1,82 +0,0 @@ - - -
- - - - field($model, 'pid')->textInput() ?> - - field($model, 'cat_id')->textInput() ?> - - field($model, 'brand_id')->textInput() ?> - - field($model, 'shop_cat_id')->textInput() ?> - - field($model, 'name')->textInput(['maxlength' => true]) ?> - - field($model, 'sn')->textInput(['maxlength' => true]) ?> - - field($model, 'code')->textInput(['maxlength' => true]) ?> - - field($model, 'supplier_id')->textInput() ?> - - field($model, 'weight')->textInput() ?> - - field($model, 'length')->textInput() ?> - - field($model, 'width')->textInput() ?> - - field($model, 'height')->textInput() ?> - - field($model, 'diameter')->textInput() ?> - - field($model, 'unit')->textInput(['maxlength' => true]) ?> - - field($model, 'sold_count')->textInput() ?> - - field($model, 'limit_count')->textInput() ?> - - field($model, 'stock')->textInput() ?> - - field($model, 'stock_warn')->textInput() ?> - - field($model, 'market_price')->textInput() ?> - - field($model, 'price')->textInput() ?> - - field($model, 'brief')->textInput(['maxlength' => true]) ?> - - field($model, 'description')->textarea(['rows' => 6]) ?> - - field($model, 'image')->textInput() ?> - - field($model, 'model_id')->textInput() ?> - - field($model, 'is_sale')->textInput() ?> - - field($model, 'sort_order')->textInput() ?> - - field($model, 'bouns_points')->textInput() ?> - - field($model, 'experience_points')->textInput() ?> - - field($model, 'is_delete')->textInput() ?> - - field($model, 'express_template')->textInput() ?> - -
- 'btn btn-success']) ?> - 'btn btn-info']) ?> -
- - - -
diff --git a/vendor/antgoods/goods/src/views/goods/_search.php b/vendor/antgoods/goods/src/views/goods/_search.php deleted file mode 100644 index 9a86777..0000000 --- a/vendor/antgoods/goods/src/views/goods/_search.php +++ /dev/null @@ -1,49 +0,0 @@ - - - ['index'], - 'method' => 'get', - 'validateOnType' => true, - ]); -?> -
-
- field($model, 'id', [ - "template" => "{input}{error}", - "inputOptions" => [ - "placeholder" => "检索ID", - "class" => "form-control", - ], - "errorOptions" => [ - "class" => "error-tips" - ] - ]) - ?> -
-
- field($model, "created_at_range", [ - "template" => "{input}{error}", - "inputOptions" => [ - "placeholder" => "创建时间", - ], - "errorOptions" => [ - "class" => "error-tips" - ] - ])->widget(DateRangePicker::className()); - ?> -
-
- ', ['class' => 'btn btn-default']) ?> - ', ['class' => 'btn btn-default']) ?> -
-
- \ No newline at end of file diff --git a/vendor/antgoods/goods/src/views/goods/create.php b/vendor/antgoods/goods/src/views/goods/create.php deleted file mode 100644 index d32b1b8..0000000 --- a/vendor/antgoods/goods/src/views/goods/create.php +++ /dev/null @@ -1,18 +0,0 @@ -title = '创建 Goods'; -$this->params['breadcrumbs'][] = ['label' => 'Goods', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -?> -
- - render('_form', [ - 'model' => $model, - ]) ?> - -
diff --git a/vendor/antgoods/goods/src/views/goods/index.php b/vendor/antgoods/goods/src/views/goods/index.php deleted file mode 100644 index 82c38b2..0000000 --- a/vendor/antgoods/goods/src/views/goods/index.php +++ /dev/null @@ -1,28 +0,0 @@ -title = 'Goods'; -$this->params['breadcrumbs'][] = $this->title; -?> -
-
- $dataProvider, - 'filter' => $this->render("_search", ['model' => $searchModel]), - 'batch' => [ - [ - "label" => "删除", - "url" => "goods/deletes" - ], - ], - 'columns' => $columns - ]); - ?> -
-
\ No newline at end of file diff --git a/vendor/antgoods/goods/src/views/goods/update.php b/vendor/antgoods/goods/src/views/goods/update.php deleted file mode 100644 index afaf45f..0000000 --- a/vendor/antgoods/goods/src/views/goods/update.php +++ /dev/null @@ -1,19 +0,0 @@ -title = '编辑 Goods: ' . $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Goods', 'url' => ['index']]; -$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; -$this->params['breadcrumbs'][] = 'Update '; -?> -
- - render('_form', [ - 'model' => $model, - ]) ?> - -
diff --git a/vendor/antgoods/goods/src/views/goods/view.php b/vendor/antgoods/goods/src/views/goods/view.php deleted file mode 100644 index e2a57f2..0000000 --- a/vendor/antgoods/goods/src/views/goods/view.php +++ /dev/null @@ -1,59 +0,0 @@ -title = $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Goods', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -\yii\web\YiiAsset::register($this); -?> -
- -

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

- - $model, - 'attributes' => [ - 'id', - 'pid', - 'cat_id', - 'brand_id', - 'shop_cat_id', - 'name', - 'sn', - 'code', - 'supplier_id', - 'weight', - 'length', - 'width', - 'height', - 'diameter', - 'unit', - 'sold_count', - 'limit_count', - 'stock', - 'stock_warn', - 'market_price', - 'price', - 'brief', - 'description:ntext', - 'image', - 'model_id', - 'is_sale', - 'sort_order', - 'bouns_points', - 'experience_points', - 'is_delete', - 'express_template', - 'created_at', - 'updated_at', - ], - ]) ?> - -
From eb5c46218cfdb599c9c44ff1d07b1052866e252e Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 13:59:13 +0800 Subject: [PATCH 028/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9backend=E7=9A=84?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E7=94=9F=E6=88=90=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- environments/skeleton/backend/config/main-local.php | 8 ++++---- environments/skeleton/backend/config/params-local.php | 0 2 files changed, 4 insertions(+), 4 deletions(-) mode change 100644 => 100755 environments/skeleton/backend/config/main-local.php mode change 100644 => 100755 environments/skeleton/backend/config/params-local.php diff --git a/environments/skeleton/backend/config/main-local.php b/environments/skeleton/backend/config/main-local.php old mode 100644 new mode 100755 index ddff7d3..51a12b2 --- a/environments/skeleton/backend/config/main-local.php +++ b/environments/skeleton/backend/config/main-local.php @@ -22,16 +22,16 @@ if (!YII_ENV_TEST) { 'allowedIPs' => ['127.0.0.1'], 'generators' => [ 'crud' => [ - 'class' => 'blobt\generators\crud\Generator', + 'class' => 'iron\generators\crud\Generator', 'templates' => [ 'blobtCrud' => '@blobt/generators/crud/default', - 'linyaoCrud' => '@linyao/generators/crud/default', + 'ironCrud' => '@iron/generators/crud/default', ] ], 'model' => [ - 'class' => 'linyao\generators\model\Generator', + 'class' => 'iron\generators\model\Generator', 'templates' => [ - 'linyaoModel' => '@linyao/generators/model/default', + 'ironModel' => '@iron/generators/model/default', ] ] ], diff --git a/environments/skeleton/backend/config/params-local.php b/environments/skeleton/backend/config/params-local.php old mode 100644 new mode 100755 From 8ba1b9474ee1e3d491be98e4a3afed7e84cd2cca Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 14:57:26 +0800 Subject: [PATCH 029/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/models/ars/Address.php | 86 ------------- common/models/ars/AfterSale.php | 78 ------------ common/models/ars/Area.php | 50 -------- common/models/ars/Cart.php | 82 ------------ common/models/ars/City.php | 50 -------- common/models/ars/Collection.php | 71 ----------- common/models/ars/Comment.php | 78 ------------ common/models/ars/Delivery.php | 84 ------------- common/models/ars/ExpressTemplate.php | 93 -------------- common/models/ars/File.php | 85 ------------- common/models/ars/Order.php | 119 ------------------ common/models/ars/OrderGoods.php | 84 ------------- common/models/ars/PaymentLog.php | 84 ------------- common/models/ars/Province.php | 48 ------- common/models/ars/RefundLog.php | 70 ----------- common/models/ars/SearchHistory.php | 78 ------------ common/models/ars/TakingSite.php | 82 ------------ common/models/ars/TemFile.php | 79 ------------ console/migrations/m130524_201442_init.php | 0 .../migrations/m140506_102106_rbac_init.php | 0 ...c_add_index_on_auth_assignment_user_id.php | 0 ...38_rbac_updates_indexes_without_prefix.php | 0 ...erification_token_column_to_user_table.php | 0 .../m190802_072830_add_category.php | 0 .../m191111_101658_create_table_area.php | 0 .../m191111_102644_create_table_province.php | 0 .../m191111_102730_create_table_city.php | 0 .../m191111_102925_create_table_cart.php | 8 +- .../m191111_112559_create_table_address.php | 8 +- ...m191111_113455_create_table_after_sale.php | 6 +- ...112_005106_create_table_search_history.php | 2 +- ...m191112_005545_create_table_collection.php | 4 +- .../m191112_005702_create_table_comment.php | 2 +- .../m191112_010421_create_table_order.php | 2 +- ...191112_011517_create_table_order_goods.php | 4 +- ...191112_012449_create_table_taking_site.php | 2 +- ...2_014508_create_table_express_template.php | 2 +- .../m191112_015939_create_table_delivery.php | 2 +- ...191112_020830_create_table_payment_log.php | 0 ...m191112_021528_create_table_refund_log.php | 0 .../m191112_022131_create_table_file.php | 0 .../m191112_022532_create_table_tem_file.php | 0 console/migrations/schema-mysql.sql | 0 console/migrations/sql/add_category.sql | 0 console/migrations/sql/area.sql | 0 console/migrations/sql/city.sql | 0 console/migrations/sql/province.sql | 0 ...1119_021851_create_table_shop_category.php | 6 +- .../m191119_022641_create_table_category.php | 10 +- .../m191119_022939_create_table_attribute.php | 4 +- ...m191119_023115_create_table_goods_attr.php | 6 +- .../m191119_024029_create_table_brand.php | 2 +- .../m191119_025607_create_table_supplier.php | 8 +- ...191119_025843_create_table_filter_attr.php | 6 +- .../goods/src/migrations/sql/goods.sql | 10 +- .../goods/src/migrations/sql/goods_sku.sql | 6 +- .../goods/src/models/ars/Attribute.php | 79 ------------ .../antgoods/goods/src/models/ars/Brand.php | 72 ----------- .../goods/src/models/ars/Category.php | 85 ------------- .../goods/src/models/ars/FilterAttr.php | 76 ----------- .../goods/src/models/ars/GoodsAttr.php | 76 ----------- .../goods/src/models/ars/GoodsSku.php | 103 --------------- .../goods/src/models/ars/ShopCategory.php | 94 -------------- .../goods/src/models/ars/Supplier.php | 79 ------------ 64 files changed, 50 insertions(+), 2115 deletions(-) delete mode 100644 common/models/ars/Address.php delete mode 100644 common/models/ars/AfterSale.php delete mode 100644 common/models/ars/Area.php delete mode 100644 common/models/ars/Cart.php delete mode 100644 common/models/ars/City.php delete mode 100644 common/models/ars/Collection.php delete mode 100644 common/models/ars/Comment.php delete mode 100644 common/models/ars/Delivery.php delete mode 100644 common/models/ars/ExpressTemplate.php delete mode 100644 common/models/ars/File.php delete mode 100644 common/models/ars/Order.php delete mode 100644 common/models/ars/OrderGoods.php delete mode 100644 common/models/ars/PaymentLog.php delete mode 100644 common/models/ars/Province.php delete mode 100644 common/models/ars/RefundLog.php delete mode 100644 common/models/ars/SearchHistory.php delete mode 100644 common/models/ars/TakingSite.php delete mode 100644 common/models/ars/TemFile.php mode change 100644 => 100755 console/migrations/m130524_201442_init.php mode change 100644 => 100755 console/migrations/m140506_102106_rbac_init.php mode change 100644 => 100755 console/migrations/m170907_052038_rbac_add_index_on_auth_assignment_user_id.php mode change 100644 => 100755 console/migrations/m180523_151638_rbac_updates_indexes_without_prefix.php mode change 100644 => 100755 console/migrations/m190124_110200_add_verification_token_column_to_user_table.php mode change 100644 => 100755 console/migrations/m190802_072830_add_category.php mode change 100644 => 100755 console/migrations/m191111_101658_create_table_area.php mode change 100644 => 100755 console/migrations/m191111_102644_create_table_province.php mode change 100644 => 100755 console/migrations/m191111_102730_create_table_city.php mode change 100644 => 100755 console/migrations/m191111_102925_create_table_cart.php mode change 100644 => 100755 console/migrations/m191111_112559_create_table_address.php mode change 100644 => 100755 console/migrations/m191111_113455_create_table_after_sale.php mode change 100644 => 100755 console/migrations/m191112_005106_create_table_search_history.php mode change 100644 => 100755 console/migrations/m191112_005545_create_table_collection.php mode change 100644 => 100755 console/migrations/m191112_005702_create_table_comment.php mode change 100644 => 100755 console/migrations/m191112_010421_create_table_order.php mode change 100644 => 100755 console/migrations/m191112_011517_create_table_order_goods.php mode change 100644 => 100755 console/migrations/m191112_012449_create_table_taking_site.php mode change 100644 => 100755 console/migrations/m191112_014508_create_table_express_template.php mode change 100644 => 100755 console/migrations/m191112_015939_create_table_delivery.php mode change 100644 => 100755 console/migrations/m191112_020830_create_table_payment_log.php mode change 100644 => 100755 console/migrations/m191112_021528_create_table_refund_log.php mode change 100644 => 100755 console/migrations/m191112_022131_create_table_file.php mode change 100644 => 100755 console/migrations/m191112_022532_create_table_tem_file.php mode change 100644 => 100755 console/migrations/schema-mysql.sql mode change 100644 => 100755 console/migrations/sql/add_category.sql mode change 100644 => 100755 console/migrations/sql/area.sql mode change 100644 => 100755 console/migrations/sql/city.sql mode change 100644 => 100755 console/migrations/sql/province.sql delete mode 100755 vendor/antgoods/goods/src/models/ars/Attribute.php delete mode 100755 vendor/antgoods/goods/src/models/ars/Brand.php delete mode 100755 vendor/antgoods/goods/src/models/ars/Category.php delete mode 100755 vendor/antgoods/goods/src/models/ars/FilterAttr.php delete mode 100755 vendor/antgoods/goods/src/models/ars/GoodsAttr.php delete mode 100755 vendor/antgoods/goods/src/models/ars/GoodsSku.php delete mode 100755 vendor/antgoods/goods/src/models/ars/ShopCategory.php delete mode 100755 vendor/antgoods/goods/src/models/ars/Supplier.php diff --git a/common/models/ars/Address.php b/common/models/ars/Address.php deleted file mode 100644 index b7b9ad9..0000000 --- a/common/models/ars/Address.php +++ /dev/null @@ -1,86 +0,0 @@ - 20], - [['province', 'city', 'area'], 'string', 'max' => 10], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'user_id' => '用户id', - 'consignee' => '收件人', - 'phone' => '电话', - 'province' => '省份', - 'city' => '城市', - 'area' => '区域', - 'address' => '详细地址', - 'status' => '状态,0-默认值 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/common/models/ars/AfterSale.php b/common/models/ars/AfterSale.php deleted file mode 100644 index 4f0cced..0000000 --- a/common/models/ars/AfterSale.php +++ /dev/null @@ -1,78 +0,0 @@ - 64], - [['take_shipping_sn', 'send_shipping_sn'], 'string', 'max' => 50], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'operator_id' => '操作者', - 'user_id' => '用户id', - 'wx_refund_id' => '微信退款单号', - 'after_sale_sn' => '售后单号', - 'order_goods_id' => '订单商品id', - 'count' => '退换货的商品数量', - 'amount' => '退货时实际退的金额', - 'type' => '类型', - 'reason' => '退换货理由', - 'description' => '描述', - 'take_shipping_sn' => '用户发货物流单号', - 'send_shipping_sn' => '换货商家发货的物流单号', - 'remarks' => '店家备注', - 'applyed_at' => '申请时间', - 'dealed_at' => '处理时间', - 'finished_at' => '完成时间', - ]; - } - -} diff --git a/common/models/ars/Area.php b/common/models/ars/Area.php deleted file mode 100644 index e42ee4f..0000000 --- a/common/models/ars/Area.php +++ /dev/null @@ -1,50 +0,0 @@ - 32], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => 'name', - 'area_id' => 'area_id', - 'city_id' => 'city_id', - ]; - } - -} diff --git a/common/models/ars/Cart.php b/common/models/ars/Cart.php deleted file mode 100644 index 3af30be..0000000 --- a/common/models/ars/Cart.php +++ /dev/null @@ -1,82 +0,0 @@ - 120], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'user_id' => '用户id', - 'goods_id' => '商品id', - 'goods_name' => '商品名称', - 'goods_img' => '商品图片', - 'goods_price' => '商品售价', - 'sku_id' => '商品sku的id', - 'goods_count' => '商品数量', - '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/common/models/ars/City.php b/common/models/ars/City.php deleted file mode 100644 index 3b4096f..0000000 --- a/common/models/ars/City.php +++ /dev/null @@ -1,50 +0,0 @@ - 32], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'city_id' => 'city_id', - 'name' => 'name', - 'province_id' => 'province_id', - ]; - } - -} diff --git a/common/models/ars/Collection.php b/common/models/ars/Collection.php deleted file mode 100644 index 69937f3..0000000 --- a/common/models/ars/Collection.php +++ /dev/null @@ -1,71 +0,0 @@ - 'id', - 'user_id' => '用户id', - 'goods_id' => '商品id', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/Comment.php b/common/models/ars/Comment.php deleted file mode 100644 index 2fe43aa..0000000 --- a/common/models/ars/Comment.php +++ /dev/null @@ -1,78 +0,0 @@ - 'id', - 'user_id' => '用户id', - 'order_goods_id' => '订单详情商品id', - 'star' => '星级', - 'content' => '评论内容', - 'status' => '状态:1为显示,0为不显示', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/Delivery.php b/common/models/ars/Delivery.php deleted file mode 100644 index e9760bd..0000000 --- a/common/models/ars/Delivery.php +++ /dev/null @@ -1,84 +0,0 @@ - 50], - [['shipping_id'], 'string', 'max' => 10], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'order_id' => '订单id', - 'shipping_name' => '货流名称', - 'shipping_id' => '运货单位', - 'type' => '类型', - 'goods' => '商品', - 'status' => '状态', - 'decription' => '描述', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/ExpressTemplate.php b/common/models/ars/ExpressTemplate.php deleted file mode 100644 index d91b966..0000000 --- a/common/models/ars/ExpressTemplate.php +++ /dev/null @@ -1,93 +0,0 @@ - 255], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => '名称', - 'province' => '省份', - 'city' => '城市', - 'area' => '区域', - 'billing_type' => '账单类型', - 'extra_weight_type' => '续重重量类型', - 'exemption_type' => '包邮类型', - 'basic_price' => '基本运费', - 'extra_price' => '续重运费', - 'exemption_amount' => '包邮金额', - 'support_taking' => '是否支持自提,1为不支持', - 'taking_site' => '自提地点', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/File.php b/common/models/ars/File.php deleted file mode 100644 index c58b34e..0000000 --- a/common/models/ars/File.php +++ /dev/null @@ -1,85 +0,0 @@ - 255], - [['alias'], 'string', 'max' => 50], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'pid' => '父级id', - 'name' => '名称', - 'type' => '类型', - 'own_type' => '拥有者类型', - 'own_id' => '拥有者id', - 'alias' => '别名', - 'path' => '地址', - 'is_delete' => '是否删除,1为已删除', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/Order.php b/common/models/ars/Order.php deleted file mode 100644 index c74f2b0..0000000 --- a/common/models/ars/Order.php +++ /dev/null @@ -1,119 +0,0 @@ - 64], - [['consignee', 'phone'], 'string', 'max' => 20], - [['province', 'city', 'area'], 'string', 'max' => 10], - [['payment_sn'], 'string', 'max' => 120], - [['remarks'], 'string', 'max' => 255], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'user_id' => '用户id', - 'order_sn' => '订单号', - 'invoice_id' => '发票单号', - 'status' => '状态', - 'type' => '类型', - 'goods_count' => '商品数量', - 'goods_amount' => '商品金额', - 'shipping_amount' => '物流金额', - 'shipping_type' => '物流类型', - 'consignee' => '收件人', - 'phone' => '手机号码', - 'province' => '省份', - 'city' => '城市', - 'area' => '区域', - 'taking_site' => '自提点', - 'pay_type' => '支付方式', - 'pay_at' => '支付时间', - 'payment_sn' => '付款单号', - 'payment_amount' => '支付金额', - 'receivables' => '应收款', - 'remarks' => '备注', - 'discount_amount' => '折扣金额', - 'discount_decription' => '折扣说明', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/OrderGoods.php b/common/models/ars/OrderGoods.php deleted file mode 100644 index f98ceea..0000000 --- a/common/models/ars/OrderGoods.php +++ /dev/null @@ -1,84 +0,0 @@ - 120], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'order_id' => '订单id', - 'goods_id' => '商品id', - 'goods_img' => '商品图片', - 'goods_name' => '商品名称', - 'goods_count' => '商品数量', - 'sku_value' => '商品sku', - 'price' => '销售价', - 'market_price' => '市场价', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/PaymentLog.php b/common/models/ars/PaymentLog.php deleted file mode 100644 index ad85810..0000000 --- a/common/models/ars/PaymentLog.php +++ /dev/null @@ -1,84 +0,0 @@ - 64], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'order_id' => '订单id', - 'wx_refund_id' => '微信退款单号', - 'mch_id' => '商户号', - 'order_amount' => '订单金额', - 'payment_amount' => '支付金额', - 'type' => '类型', - 'status' => '状态', - 'refund_account' => '退款账户', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/Province.php b/common/models/ars/Province.php deleted file mode 100644 index 26506c4..0000000 --- a/common/models/ars/Province.php +++ /dev/null @@ -1,48 +0,0 @@ - 16], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => 'name', - 'province_id' => 'province_id', - ]; - } - -} diff --git a/common/models/ars/RefundLog.php b/common/models/ars/RefundLog.php deleted file mode 100644 index 9f281b8..0000000 --- a/common/models/ars/RefundLog.php +++ /dev/null @@ -1,70 +0,0 @@ - 64], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'order_id' => '订单id', - 'wx_refund_id' => '微信退款单号', - 'reason' => '理由', - 'order_amount' => '订单金额', - 'refund_amount' => '退款金额', - 'refunded_amount' => '已退款金额', - 'type' => '类型', - 'status' => '状态', - 'refund_account' => '退款账户', - 'operator_id' => '操作者', - 'applyed_at' => '申请时间', - 'confirmed_at' => '确认时间', - 'finished_at' => '完成时间', - ]; - } - -} diff --git a/common/models/ars/SearchHistory.php b/common/models/ars/SearchHistory.php deleted file mode 100644 index 6be7b5f..0000000 --- a/common/models/ars/SearchHistory.php +++ /dev/null @@ -1,78 +0,0 @@ - 255], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'user_id' => '用户id', - 'keyword' => '关键字', - 'count' => '次数', - 'status' => '状态', - 'type' => '类型', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/TakingSite.php b/common/models/ars/TakingSite.php deleted file mode 100644 index f147e62..0000000 --- a/common/models/ars/TakingSite.php +++ /dev/null @@ -1,82 +0,0 @@ - 120], - [['province', 'city', 'area'], 'string', 'max' => 10], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => '名称', - 'province' => '省份', - 'city' => '城市', - 'area' => '区域', - 'address' => '地址', - 'is_default' => '是否为默认,1为默认', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/TemFile.php b/common/models/ars/TemFile.php deleted file mode 100644 index df9bab0..0000000 --- a/common/models/ars/TemFile.php +++ /dev/null @@ -1,79 +0,0 @@ - 255], - [['alias'], 'string', 'max' => 50], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'user_id' => '父级id', - 'name' => '名称', - 'type' => '类型', - 'alias' => '别名', - 'path' => '地址', - 'updated_at' => '更新时间', - 'created_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/console/migrations/m130524_201442_init.php b/console/migrations/m130524_201442_init.php old mode 100644 new mode 100755 diff --git a/console/migrations/m140506_102106_rbac_init.php b/console/migrations/m140506_102106_rbac_init.php old mode 100644 new mode 100755 diff --git a/console/migrations/m170907_052038_rbac_add_index_on_auth_assignment_user_id.php b/console/migrations/m170907_052038_rbac_add_index_on_auth_assignment_user_id.php old mode 100644 new mode 100755 diff --git a/console/migrations/m180523_151638_rbac_updates_indexes_without_prefix.php b/console/migrations/m180523_151638_rbac_updates_indexes_without_prefix.php old mode 100644 new mode 100755 diff --git a/console/migrations/m190124_110200_add_verification_token_column_to_user_table.php b/console/migrations/m190124_110200_add_verification_token_column_to_user_table.php old mode 100644 new mode 100755 diff --git a/console/migrations/m190802_072830_add_category.php b/console/migrations/m190802_072830_add_category.php old mode 100644 new mode 100755 diff --git a/console/migrations/m191111_101658_create_table_area.php b/console/migrations/m191111_101658_create_table_area.php old mode 100644 new mode 100755 diff --git a/console/migrations/m191111_102644_create_table_province.php b/console/migrations/m191111_102644_create_table_province.php old mode 100644 new mode 100755 diff --git a/console/migrations/m191111_102730_create_table_city.php b/console/migrations/m191111_102730_create_table_city.php old mode 100644 new mode 100755 diff --git a/console/migrations/m191111_102925_create_table_cart.php b/console/migrations/m191111_102925_create_table_cart.php old mode 100644 new mode 100755 index 5c81c47..bea2e27 --- a/console/migrations/m191111_102925_create_table_cart.php +++ b/console/migrations/m191111_102925_create_table_cart.php @@ -15,12 +15,12 @@ class m191111_102925_create_table_cart extends Migration $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="购物车表"'; $this->createTable('ats_cart', [ 'id' => $this->primaryKey(), - 'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'), - 'goods_id'=>$this->integer(11)->defaultValue(null)->comment('商品id'), - 'goods_name'=>$this->string(120)->defaultValue(null)->comment('商品名称'), + 'user_id'=>$this->integer(11)->notNull()->comment('用户id'), + 'goods_id'=>$this->integer(11)->notNull()->comment('商品id'), + 'goods_name'=>$this->string(120)->notNull()->comment('商品名称'), 'goods_img'=>$this->integer(11)->defaultValue(null)->comment('商品图片'), 'goods_price'=>$this->integer(20)->defaultValue(null)->comment('商品售价'), - 'sku_id'=>$this->integer(11)->defaultValue(null)->comment('商品sku的id'), + 'sku_id'=>$this->integer(11)->notNull()->comment('商品sku的id'), 'goods_count'=>$this->integer(11)->defaultValue(null)->comment('商品数量'), 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), diff --git a/console/migrations/m191111_112559_create_table_address.php b/console/migrations/m191111_112559_create_table_address.php old mode 100644 new mode 100755 index 2882b5c..ab94279 --- a/console/migrations/m191111_112559_create_table_address.php +++ b/console/migrations/m191111_112559_create_table_address.php @@ -15,13 +15,13 @@ class m191111_112559_create_table_address extends Migration $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="地址表"'; $this->createTable('ats_address', [ 'id' => $this->primaryKey(), - 'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'), - 'consignee'=>$this->string(20)->defaultValue(null)->comment('收件人'), - 'phone'=>$this->string(20)->defaultValue(null)->comment('电话'), + 'user_id'=>$this->integer(11)->notNull()->comment('用户id'), + 'consignee'=>$this->string(20)->notNull()->comment('收件人'), + 'phone'=>$this->string(20)->notNull()->comment('电话'), 'province'=>$this->string(10)->defaultValue(null)->comment('省份'), 'city'=>$this->string(10)->defaultValue(null)->comment('城市'), 'area'=>$this->string(10)->defaultValue(null)->comment('区域'), - 'address'=>$this->text()->comment('详细地址'), + 'address'=>$this->text()->notNull()->comment('详细地址'), 'status'=>$this->tinyInteger(1)->defaultValue(0)->comment('状态,0-默认值 1-默认地址'), 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), diff --git a/console/migrations/m191111_113455_create_table_after_sale.php b/console/migrations/m191111_113455_create_table_after_sale.php old mode 100644 new mode 100755 index fde56b1..56a71ae --- a/console/migrations/m191111_113455_create_table_after_sale.php +++ b/console/migrations/m191111_113455_create_table_after_sale.php @@ -15,13 +15,13 @@ class m191111_113455_create_table_after_sale extends Migration $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="售后表"'; $this->createTable('ats_after_sale', [ 'id' => $this->primaryKey(), - 'operator_id'=>$this->integer(11)->defaultValue(null)->comment('操作者'), - 'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'), + 'operator_id'=>$this->integer(11)->notNull()->comment('操作者'), + 'user_id'=>$this->integer(11)->notNull()->comment('用户id'), 'wx_refund_id'=>$this->string(64)->defaultValue(null)->comment('微信退款单号'), 'after_sale_sn'=>$this->string(64)->defaultValue(null)->comment('售后单号'), 'order_goods_id'=>$this->integer(11)->defaultValue(null)->comment('订单商品id'), 'count'=>$this->integer(11)->defaultValue(null)->comment('退换货的商品数量'), - 'amount'=>$this->integer(20)->defaultValue(null)->comment('退货时实际退的金额'), + 'amount'=>$this->integer(20)->notNull()->comment('退货时实际退的金额'), 'type'=>$this->tinyInteger(1)->defaultValue(0)->comment('类型'), 'reason'=>$this->smallInteger(2)->defaultValue(0)->comment('退换货理由'), 'description'=>$this->text()->comment('描述'), diff --git a/console/migrations/m191112_005106_create_table_search_history.php b/console/migrations/m191112_005106_create_table_search_history.php old mode 100644 new mode 100755 index e54e8ba..54736ec --- a/console/migrations/m191112_005106_create_table_search_history.php +++ b/console/migrations/m191112_005106_create_table_search_history.php @@ -15,7 +15,7 @@ class m191112_005106_create_table_search_history extends Migration $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="搜索记录表"'; $this->createTable('ats_search_history', [ 'id' => $this->primaryKey(), - 'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'), + 'user_id'=>$this->integer(11)->notNull()->comment('用户id'), 'keyword'=>$this->string(255)->defaultValue(null)->comment('关键字'), 'count'=>$this->integer(10)->defaultValue(null)->comment('次数'), 'status'=>$this->tinyInteger(1)->defaultValue(0)->comment('状态'), diff --git a/console/migrations/m191112_005545_create_table_collection.php b/console/migrations/m191112_005545_create_table_collection.php old mode 100644 new mode 100755 index 13492eb..e4fb1e7 --- a/console/migrations/m191112_005545_create_table_collection.php +++ b/console/migrations/m191112_005545_create_table_collection.php @@ -15,8 +15,8 @@ class m191112_005545_create_table_collection extends Migration $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="收藏表"'; $this->createTable('ats_collection', [ 'id' => $this->primaryKey(), - 'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'), - 'goods_id'=>$this->integer(11)->defaultValue(null)->comment('商品id'), + 'user_id'=>$this->integer(11)->notNull()->comment('用户id'), + 'goods_id'=>$this->integer(11)->notNull()->comment('商品id'), 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), ],$tableOptions); diff --git a/console/migrations/m191112_005702_create_table_comment.php b/console/migrations/m191112_005702_create_table_comment.php old mode 100644 new mode 100755 index f3a1ddd..1fa7e2b --- a/console/migrations/m191112_005702_create_table_comment.php +++ b/console/migrations/m191112_005702_create_table_comment.php @@ -15,7 +15,7 @@ class m191112_005702_create_table_comment extends Migration $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="评论记录表"'; $this->createTable('ats_comment', [ 'id' => $this->primaryKey(), - 'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'), + 'user_id'=>$this->integer(11)->notNull()->comment('用户id'), 'order_goods_id'=>$this->integer(11)->defaultValue(null)->comment('订单详情商品id'), 'star'=>$this->integer(11)->defaultValue(null)->comment('星级'), 'content'=>$this->text()->comment('评论内容'), diff --git a/console/migrations/m191112_010421_create_table_order.php b/console/migrations/m191112_010421_create_table_order.php old mode 100644 new mode 100755 index dfd6a01..6bcfb06 --- a/console/migrations/m191112_010421_create_table_order.php +++ b/console/migrations/m191112_010421_create_table_order.php @@ -15,7 +15,7 @@ class m191112_010421_create_table_order extends Migration $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="订单表"'; $this->createTable('ats_order', [ 'id' => $this->primaryKey(), - 'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'), + 'user_id'=>$this->integer(11)->notNull()->comment('用户id'), 'order_sn'=>$this->string(64)->defaultValue(null)->comment('订单号'), 'invoice_id'=>$this->string(64)->defaultValue(null)->comment('发票单号'), 'status'=>$this->tinyInteger(2)->defaultValue(0)->comment('状态'), diff --git a/console/migrations/m191112_011517_create_table_order_goods.php b/console/migrations/m191112_011517_create_table_order_goods.php old mode 100644 new mode 100755 index 52974d1..3340d25 --- a/console/migrations/m191112_011517_create_table_order_goods.php +++ b/console/migrations/m191112_011517_create_table_order_goods.php @@ -15,8 +15,8 @@ class m191112_011517_create_table_order_goods extends Migration $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="订单商品表"'; $this->createTable('ats_order_goods', [ 'id' => $this->primaryKey(), - 'order_id'=>$this->integer(11)->defaultValue(null)->comment('订单id'), - 'goods_id'=>$this->integer(11)->defaultValue(null)->comment('商品id'), + 'order_id'=>$this->integer(11)->notNull()->comment('订单id'), + 'goods_id'=>$this->integer(11)->notNull()->comment('商品id'), 'goods_img'=>$this->integer(11)->defaultValue(null)->comment('商品图片'), 'goods_name'=>$this->string(120)->defaultValue(null)->comment('商品名称'), 'goods_count'=>$this->integer(11)->defaultValue(null)->comment('商品数量'), diff --git a/console/migrations/m191112_012449_create_table_taking_site.php b/console/migrations/m191112_012449_create_table_taking_site.php old mode 100644 new mode 100755 index a9bc8e8..a03c9a6 --- a/console/migrations/m191112_012449_create_table_taking_site.php +++ b/console/migrations/m191112_012449_create_table_taking_site.php @@ -15,7 +15,7 @@ class m191112_012449_create_table_taking_site extends Migration $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="自提地点表"'; $this->createTable('ats_taking_site', [ 'id' => $this->primaryKey(), - 'name'=>$this->string(120)->defaultValue(null)->comment('名称'), + 'name'=>$this->string(120)->notNull()->comment('名称'), 'province'=>$this->string(10)->defaultValue(null)->comment('省份'), 'city'=>$this->string(10)->defaultValue(null)->comment('城市'), 'area'=>$this->string(10)->defaultValue(null)->comment('区域'), diff --git a/console/migrations/m191112_014508_create_table_express_template.php b/console/migrations/m191112_014508_create_table_express_template.php old mode 100644 new mode 100755 index 83a1165..4b788a5 --- a/console/migrations/m191112_014508_create_table_express_template.php +++ b/console/migrations/m191112_014508_create_table_express_template.php @@ -15,7 +15,7 @@ class m191112_014508_create_table_express_template extends Migration $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="配送情况设置表"'; $this->createTable('ats_express_template', [ 'id' => $this->primaryKey(), - 'name'=>$this->string(255)->defaultValue(null)->comment('名称'), + 'name'=>$this->string(255)->notNull()->comment('名称'), 'province'=>$this->text()->comment('省份'), 'city'=>$this->text()->comment('城市'), 'area'=>$this->text()->comment('区域'), diff --git a/console/migrations/m191112_015939_create_table_delivery.php b/console/migrations/m191112_015939_create_table_delivery.php old mode 100644 new mode 100755 index 92cd994..c90f0a1 --- a/console/migrations/m191112_015939_create_table_delivery.php +++ b/console/migrations/m191112_015939_create_table_delivery.php @@ -17,7 +17,7 @@ class m191112_015939_create_table_delivery extends Migration 'id' => $this->primaryKey(), 'order_id'=>$this->integer(11)->defaultValue(null)->comment('订单id'), 'shipping_name'=>$this->string(50)->defaultValue(null)->comment('货流名称'), - 'shipping_id'=>$this->string(10)->defaultValue(null)->comment('运货单位'), + 'shipping_id'=>$this->string(10)->notNull()->comment('运货单位'), 'type'=>$this->tinyInteger(1)->defaultValue(0)->comment('类型'), 'goods'=>$this->text()->comment('商品'), 'status'=>$this->tinyInteger(1)->defaultValue(0)->comment('状态'), diff --git a/console/migrations/m191112_020830_create_table_payment_log.php b/console/migrations/m191112_020830_create_table_payment_log.php old mode 100644 new mode 100755 diff --git a/console/migrations/m191112_021528_create_table_refund_log.php b/console/migrations/m191112_021528_create_table_refund_log.php old mode 100644 new mode 100755 diff --git a/console/migrations/m191112_022131_create_table_file.php b/console/migrations/m191112_022131_create_table_file.php old mode 100644 new mode 100755 diff --git a/console/migrations/m191112_022532_create_table_tem_file.php b/console/migrations/m191112_022532_create_table_tem_file.php old mode 100644 new mode 100755 diff --git a/console/migrations/schema-mysql.sql b/console/migrations/schema-mysql.sql old mode 100644 new mode 100755 diff --git a/console/migrations/sql/add_category.sql b/console/migrations/sql/add_category.sql old mode 100644 new mode 100755 diff --git a/console/migrations/sql/area.sql b/console/migrations/sql/area.sql old mode 100644 new mode 100755 diff --git a/console/migrations/sql/city.sql b/console/migrations/sql/city.sql old mode 100644 new mode 100755 diff --git a/console/migrations/sql/province.sql b/console/migrations/sql/province.sql old mode 100644 new mode 100755 diff --git a/vendor/antgoods/goods/src/migrations/m191119_021851_create_table_shop_category.php b/vendor/antgoods/goods/src/migrations/m191119_021851_create_table_shop_category.php index eabe634..35f536e 100644 --- a/vendor/antgoods/goods/src/migrations/m191119_021851_create_table_shop_category.php +++ b/vendor/antgoods/goods/src/migrations/m191119_021851_create_table_shop_category.php @@ -15,12 +15,12 @@ class m191119_021851_create_table_shop_category extends Migration $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="前端商品类别表"'; $this->createTable('antgoods_shop_category', [ 'id' => $this->primaryKey(), - 'name'=>$this->string(60)->defaultValue(null)->comment('类别名称'), + 'name'=>$this->string(60)->notNull()->comment('类别名称'), 'pid'=>$this->integer(11)->defaultValue(null)->comment('父级id'), - 'goods_count'=>$this->integer(11)->defaultValue(null)->comment('商品数量'), + '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(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('筛选属性'), diff --git a/vendor/antgoods/goods/src/migrations/m191119_022641_create_table_category.php b/vendor/antgoods/goods/src/migrations/m191119_022641_create_table_category.php index 4ba6c29..60dd21e 100644 --- a/vendor/antgoods/goods/src/migrations/m191119_022641_create_table_category.php +++ b/vendor/antgoods/goods/src/migrations/m191119_022641_create_table_category.php @@ -15,14 +15,14 @@ class m191119_022641_create_table_category extends Migration $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="后台商品类别表"'; $this->createTable('antgoods_category', [ 'id' => $this->primaryKey(), - 'name'=>$this->string(60)->defaultValue(null)->comment('类别名称'), + 'name'=>$this->string(60)->notNull()->comment('类别名称'), 'pid'=>$this->integer(11)->defaultValue(null)->comment('父级id'), - 'goods_count'=>$this->integer(11)->defaultValue(null)->comment('商品数量'), - 'sort_order'=>$this->smallInteger(3)->defaultValue(null)->comment('排序'), + '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(null)->comment('是否显示,1为不显示'), - 'is_delete'=>$this->tinyInteger(1)->defaultValue(null)->comment('是否删除,1为已删除'), + '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); diff --git a/vendor/antgoods/goods/src/migrations/m191119_022939_create_table_attribute.php b/vendor/antgoods/goods/src/migrations/m191119_022939_create_table_attribute.php index df38219..cb2cad2 100644 --- a/vendor/antgoods/goods/src/migrations/m191119_022939_create_table_attribute.php +++ b/vendor/antgoods/goods/src/migrations/m191119_022939_create_table_attribute.php @@ -15,8 +15,8 @@ class m191119_022939_create_table_attribute extends Migration $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="属性表"'; $this->createTable('antgoods_attribute', [ 'id' => $this->primaryKey(), - 'name'=>$this->string(50)->defaultValue(null)->comment('属性名'), - 'value'=>$this->text()->comment('属性值'), + '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(null)->comment('是否删除,1为已删除'), diff --git a/vendor/antgoods/goods/src/migrations/m191119_023115_create_table_goods_attr.php b/vendor/antgoods/goods/src/migrations/m191119_023115_create_table_goods_attr.php index 62e66aa..4f33089 100644 --- a/vendor/antgoods/goods/src/migrations/m191119_023115_create_table_goods_attr.php +++ b/vendor/antgoods/goods/src/migrations/m191119_023115_create_table_goods_attr.php @@ -15,9 +15,9 @@ class m191119_023115_create_table_goods_attr extends Migration $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="商品属性表"'; $this->createTable('antgoods_goods_attr', [ 'id' => $this->primaryKey(), - 'goods_id'=>$this->integer(11)->defaultValue(null)->comment('商品id'), - 'attr_id'=>$this->integer(11)->defaultValue(null)->comment('属性id'), - 'attr_value'=>$this->string(50)->defaultValue(null)->comment('属性名'), + '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(null)->comment('是否删除,1为已删除'), 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), diff --git a/vendor/antgoods/goods/src/migrations/m191119_024029_create_table_brand.php b/vendor/antgoods/goods/src/migrations/m191119_024029_create_table_brand.php index 615e9ea..f1d46ad 100644 --- a/vendor/antgoods/goods/src/migrations/m191119_024029_create_table_brand.php +++ b/vendor/antgoods/goods/src/migrations/m191119_024029_create_table_brand.php @@ -15,7 +15,7 @@ class m191119_024029_create_table_brand extends Migration $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="品牌表"'; $this->createTable('antgoods_brand', [ 'id' => $this->primaryKey(), - 'name'=>$this->string(50)->defaultValue(null)->comment('品牌名'), + 'name'=>$this->string(50)->notNull()->comment('品牌名'), 'is_delete'=>$this->tinyInteger(1)->defaultValue(null)->comment('是否删除,1为已删除'), 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), diff --git a/vendor/antgoods/goods/src/migrations/m191119_025607_create_table_supplier.php b/vendor/antgoods/goods/src/migrations/m191119_025607_create_table_supplier.php index 60ccef4..c7d8f6c 100644 --- a/vendor/antgoods/goods/src/migrations/m191119_025607_create_table_supplier.php +++ b/vendor/antgoods/goods/src/migrations/m191119_025607_create_table_supplier.php @@ -15,10 +15,10 @@ class m191119_025607_create_table_supplier extends Migration $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="供应商表"'; $this->createTable('antgoods_supplier', [ 'id' => $this->primaryKey(), - 'name'=>$this->string(50)->defaultValue(null)->comment('供应商名称'), - 'full_name'=>$this->string(50)->defaultValue(null)->comment('供应商全称'), - 'phone'=>$this->string(20)->defaultValue(null)->comment('手机号码'), - 'address'=>$this->string(50)->defaultValue(null)->comment('地址'), + '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('更新时间'), diff --git a/vendor/antgoods/goods/src/migrations/m191119_025843_create_table_filter_attr.php b/vendor/antgoods/goods/src/migrations/m191119_025843_create_table_filter_attr.php index 5ab3f83..0409292 100644 --- a/vendor/antgoods/goods/src/migrations/m191119_025843_create_table_filter_attr.php +++ b/vendor/antgoods/goods/src/migrations/m191119_025843_create_table_filter_attr.php @@ -15,9 +15,9 @@ class m191119_025843_create_table_filter_attr extends Migration $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="筛选属性表"'; $this->createTable('antgoods_filter_attr', [ 'id' => $this->primaryKey(), - 'goods_id'=>$this->integer(11)->defaultValue(null)->comment('商品id'), - 'attr_id'=>$this->integer(11)->defaultValue(null)->comment('属性id'), - 'attr_value'=>$this->string(50)->defaultValue(null)->comment('属性值'), + '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('更新时间'), diff --git a/vendor/antgoods/goods/src/migrations/sql/goods.sql b/vendor/antgoods/goods/src/migrations/sql/goods.sql index 238e7c9..f744a0b 100755 --- a/vendor/antgoods/goods/src/migrations/sql/goods.sql +++ b/vendor/antgoods/goods/src/migrations/sql/goods.sql @@ -2,11 +2,11 @@ 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) DEFAULT NULL COMMENT '后台商品类别id', - `brand_id` int(11) DEFAULT NULL COMMENT '品牌id', - `shop_cat_id` int(11) DEFAULT NULL COMMENT '前端商品类别id', - `name` varchar(120) DEFAULT NULL COMMENT '商品名称', - `sn` varchar(60) DEFAULT NULL COMMENT '商品唯一货号', + `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) NOT NULL COMMENT '商品唯一货号', `code` varchar(50) DEFAULT NULL COMMENT '商品货码', `supplier_id` int(11) DEFAULT NULL COMMENT '供应商id', `weight` mediumint(8) DEFAULT NULL COMMENT '重量', diff --git a/vendor/antgoods/goods/src/migrations/sql/goods_sku.sql b/vendor/antgoods/goods/src/migrations/sql/goods_sku.sql index 478a19f..a599a39 100755 --- a/vendor/antgoods/goods/src/migrations/sql/goods_sku.sql +++ b/vendor/antgoods/goods/src/migrations/sql/goods_sku.sql @@ -1,9 +1,9 @@ DROP TABLE IF EXISTS `antgoods_goods_sku`; CREATE TABLE `antgoods_goods_sku` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `goods_id` int(11) DEFAULT NULL COMMENT '商品id', + `goods_id` int(11) NOT NULL COMMENT '商品id', `goods_code` varchar(50) DEFAULT NULL COMMENT '商品条码', - `goods_sn` varchar(60) 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 '长度', @@ -16,7 +16,7 @@ CREATE TABLE `antgoods_goods_sku` ( `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 NULL COMMENT '排序', + `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 '更新时间', diff --git a/vendor/antgoods/goods/src/models/ars/Attribute.php b/vendor/antgoods/goods/src/models/ars/Attribute.php deleted file mode 100755 index 7699897..0000000 --- a/vendor/antgoods/goods/src/models/ars/Attribute.php +++ /dev/null @@ -1,79 +0,0 @@ - 50], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => '属性名', - 'value' => '属性值', - 'type' => '类型', - '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/vendor/antgoods/goods/src/models/ars/Brand.php b/vendor/antgoods/goods/src/models/ars/Brand.php deleted file mode 100755 index aab9e05..0000000 --- a/vendor/antgoods/goods/src/models/ars/Brand.php +++ /dev/null @@ -1,72 +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(); - }, - ], - ]; - } -} diff --git a/vendor/antgoods/goods/src/models/ars/Category.php b/vendor/antgoods/goods/src/models/ars/Category.php deleted file mode 100755 index e7e7938..0000000 --- a/vendor/antgoods/goods/src/models/ars/Category.php +++ /dev/null @@ -1,85 +0,0 @@ - 60], - [['icon'], 'string', 'max' => 64], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => '类别名称', - 'pid' => '父级id', - 'goods_count' => '商品数量', - 'sort_order' => '排序', - 'icon_type' => '图标类型', - 'icon' => '图标', - 'is_show' => '是否显示,1为不显示', - '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/vendor/antgoods/goods/src/models/ars/FilterAttr.php b/vendor/antgoods/goods/src/models/ars/FilterAttr.php deleted file mode 100755 index 1e377f1..0000000 --- a/vendor/antgoods/goods/src/models/ars/FilterAttr.php +++ /dev/null @@ -1,76 +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/vendor/antgoods/goods/src/models/ars/GoodsAttr.php b/vendor/antgoods/goods/src/models/ars/GoodsAttr.php deleted file mode 100755 index 9f22e23..0000000 --- a/vendor/antgoods/goods/src/models/ars/GoodsAttr.php +++ /dev/null @@ -1,76 +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/vendor/antgoods/goods/src/models/ars/GoodsSku.php b/vendor/antgoods/goods/src/models/ars/GoodsSku.php deleted file mode 100755 index ea5b731..0000000 --- a/vendor/antgoods/goods/src/models/ars/GoodsSku.php +++ /dev/null @@ -1,103 +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' => '属性匹配', - 'weight' => '重量', - 'length' => '长度', - 'width' => '宽度', - 'height' => '高度', - 'diameter' => '直径', - '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/vendor/antgoods/goods/src/models/ars/ShopCategory.php b/vendor/antgoods/goods/src/models/ars/ShopCategory.php deleted file mode 100755 index aef66d6..0000000 --- a/vendor/antgoods/goods/src/models/ars/ShopCategory.php +++ /dev/null @@ -1,94 +0,0 @@ - 60], - [['keywords'], 'string', 'max' => 100], - [['desc'], 'string', 'max' => 255], - [['icon'], 'string', 'max' => 64], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => '类别名称', - 'pid' => '父级id', - 'goods_count' => '商品数量', - 'keywords' => '关键字', - 'desc' => '描述', - 'sort_order' => '排序', - 'icon_type' => '图标类型', - 'icon' => '图标', - 'filter_attr' => '筛选属性', - 'is_show' => '是否显示,1为不显示', - '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/vendor/antgoods/goods/src/models/ars/Supplier.php b/vendor/antgoods/goods/src/models/ars/Supplier.php deleted file mode 100755 index c4ae6a8..0000000 --- a/vendor/antgoods/goods/src/models/ars/Supplier.php +++ /dev/null @@ -1,79 +0,0 @@ - 50], - [['phone'], 'string', 'max' => 20], - ]; - } - - /** - * {@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(); - }, - ], - ]; - } -} From e0fa34b9c55617900960e6456d037b6f634277c4 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 14:58:44 +0800 Subject: [PATCH 030/102] =?UTF-8?q?=E5=9B=A0=E4=BF=AE=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E5=AD=97=E6=AE=B5=EF=BC=8C=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E7=94=9F=E6=88=90=E6=89=80=E6=9C=89model=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/models/ars/Address.php | 88 ++++++++++++ common/models/ars/AfterSale.php | 80 +++++++++++ common/models/ars/Area.php | 51 +++++++ common/models/ars/Cart.php | 84 +++++++++++ common/models/ars/City.php | 51 +++++++ common/models/ars/Collection.php | 73 ++++++++++ common/models/ars/Comment.php | 80 +++++++++++ common/models/ars/Config.php | 0 common/models/ars/Delivery.php | 86 +++++++++++ common/models/ars/ExpressTemplate.php | 95 ++++++++++++ common/models/ars/File.php | 86 +++++++++++ common/models/ars/Order.php | 121 ++++++++++++++++ common/models/ars/OrderGoods.php | 86 +++++++++++ common/models/ars/PaymentLog.php | 85 +++++++++++ common/models/ars/Province.php | 49 +++++++ common/models/ars/RefundLog.php | 71 +++++++++ common/models/ars/SearchHistory.php | 80 +++++++++++ common/models/ars/TakingSite.php | 84 +++++++++++ common/models/ars/TemFile.php | 80 +++++++++++ .../goods/src/models/ars/Attribute.php | 81 +++++++++++ .../antgoods/goods/src/models/ars/Brand.php | 74 ++++++++++ .../goods/src/models/ars/Category.php | 87 +++++++++++ .../goods/src/models/ars/FilterAttr.php | 78 ++++++++++ .../antgoods/goods/src/models/ars/Goods.php | 135 ++++++++++++++++++ .../goods/src/models/ars/GoodsAttr.php | 78 ++++++++++ .../goods/src/models/ars/GoodsSku.php | 105 ++++++++++++++ .../goods/src/models/ars/ShopCategory.php | 96 +++++++++++++ .../goods/src/models/ars/Supplier.php | 81 +++++++++++ 28 files changed, 2245 insertions(+) create mode 100644 common/models/ars/Address.php create mode 100644 common/models/ars/AfterSale.php create mode 100644 common/models/ars/Area.php create mode 100644 common/models/ars/Cart.php create mode 100644 common/models/ars/City.php create mode 100644 common/models/ars/Collection.php create mode 100644 common/models/ars/Comment.php mode change 100644 => 100755 common/models/ars/Config.php create mode 100644 common/models/ars/Delivery.php create mode 100644 common/models/ars/ExpressTemplate.php create mode 100644 common/models/ars/File.php create mode 100644 common/models/ars/Order.php create mode 100644 common/models/ars/OrderGoods.php create mode 100644 common/models/ars/PaymentLog.php create mode 100644 common/models/ars/Province.php create mode 100644 common/models/ars/RefundLog.php create mode 100644 common/models/ars/SearchHistory.php create mode 100644 common/models/ars/TakingSite.php create mode 100644 common/models/ars/TemFile.php create mode 100644 vendor/antgoods/goods/src/models/ars/Attribute.php create mode 100644 vendor/antgoods/goods/src/models/ars/Brand.php create mode 100644 vendor/antgoods/goods/src/models/ars/Category.php create mode 100644 vendor/antgoods/goods/src/models/ars/FilterAttr.php create mode 100644 vendor/antgoods/goods/src/models/ars/Goods.php create mode 100644 vendor/antgoods/goods/src/models/ars/GoodsAttr.php create mode 100644 vendor/antgoods/goods/src/models/ars/GoodsSku.php create mode 100644 vendor/antgoods/goods/src/models/ars/ShopCategory.php create mode 100644 vendor/antgoods/goods/src/models/ars/Supplier.php diff --git a/common/models/ars/Address.php b/common/models/ars/Address.php new file mode 100644 index 0000000..aec13fb --- /dev/null +++ b/common/models/ars/Address.php @@ -0,0 +1,88 @@ + 20], + [['province', 'city', 'area'], 'string', 'max' => 10], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'user_id' => '用户id', + 'consignee' => '收件人', + 'phone' => '电话', + 'province' => '省份', + 'city' => '城市', + 'area' => '区域', + 'address' => '详细地址', + 'status' => '状态,0-默认值 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/common/models/ars/AfterSale.php b/common/models/ars/AfterSale.php new file mode 100644 index 0000000..4cf35b1 --- /dev/null +++ b/common/models/ars/AfterSale.php @@ -0,0 +1,80 @@ + 64], + [['take_shipping_sn', 'send_shipping_sn'], 'string', 'max' => 50], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'operator_id' => '操作者', + 'user_id' => '用户id', + 'wx_refund_id' => '微信退款单号', + 'after_sale_sn' => '售后单号', + 'order_goods_id' => '订单商品id', + 'count' => '退换货的商品数量', + 'amount' => '退货时实际退的金额', + 'type' => '类型', + 'reason' => '退换货理由', + 'description' => '描述', + 'take_shipping_sn' => '用户发货物流单号', + 'send_shipping_sn' => '换货商家发货的物流单号', + 'remarks' => '店家备注', + 'applyed_at' => '申请时间', + 'dealed_at' => '处理时间', + 'finished_at' => '完成时间', + ]; + } + + +} diff --git a/common/models/ars/Area.php b/common/models/ars/Area.php new file mode 100644 index 0000000..254681b --- /dev/null +++ b/common/models/ars/Area.php @@ -0,0 +1,51 @@ + 32], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => 'name', + 'area_id' => 'area_id', + 'city_id' => 'city_id', + ]; + } + + +} diff --git a/common/models/ars/Cart.php b/common/models/ars/Cart.php new file mode 100644 index 0000000..ef6477f --- /dev/null +++ b/common/models/ars/Cart.php @@ -0,0 +1,84 @@ + 120], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'user_id' => '用户id', + 'goods_id' => '商品id', + 'goods_name' => '商品名称', + 'goods_img' => '商品图片', + 'goods_price' => '商品售价', + 'sku_id' => '商品sku的id', + 'goods_count' => '商品数量', + '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/common/models/ars/City.php b/common/models/ars/City.php new file mode 100644 index 0000000..ae87412 --- /dev/null +++ b/common/models/ars/City.php @@ -0,0 +1,51 @@ + 32], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'city_id' => 'city_id', + 'name' => 'name', + 'province_id' => 'province_id', + ]; + } + + +} diff --git a/common/models/ars/Collection.php b/common/models/ars/Collection.php new file mode 100644 index 0000000..2a1a771 --- /dev/null +++ b/common/models/ars/Collection.php @@ -0,0 +1,73 @@ + 'id', + 'user_id' => '用户id', + 'goods_id' => '商品id', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/Comment.php b/common/models/ars/Comment.php new file mode 100644 index 0000000..2701ecf --- /dev/null +++ b/common/models/ars/Comment.php @@ -0,0 +1,80 @@ + 'id', + 'user_id' => '用户id', + 'order_goods_id' => '订单详情商品id', + 'star' => '星级', + 'content' => '评论内容', + 'status' => '状态:1为显示,0为不显示', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/Config.php b/common/models/ars/Config.php old mode 100644 new mode 100755 diff --git a/common/models/ars/Delivery.php b/common/models/ars/Delivery.php new file mode 100644 index 0000000..85d1d0e --- /dev/null +++ b/common/models/ars/Delivery.php @@ -0,0 +1,86 @@ + 50], + [['shipping_id'], 'string', 'max' => 10], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'order_id' => '订单id', + 'shipping_name' => '货流名称', + 'shipping_id' => '运货单位', + 'type' => '类型', + 'goods' => '商品', + 'status' => '状态', + 'decription' => '描述', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/ExpressTemplate.php b/common/models/ars/ExpressTemplate.php new file mode 100644 index 0000000..e3e6b81 --- /dev/null +++ b/common/models/ars/ExpressTemplate.php @@ -0,0 +1,95 @@ + 255], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => '名称', + 'province' => '省份', + 'city' => '城市', + 'area' => '区域', + 'billing_type' => '账单类型', + 'extra_weight_type' => '续重重量类型', + 'exemption_type' => '包邮类型', + 'basic_price' => '基本运费', + 'extra_price' => '续重运费', + 'exemption_amount' => '包邮金额', + 'support_taking' => '是否支持自提,1为不支持', + 'taking_site' => '自提地点', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/File.php b/common/models/ars/File.php new file mode 100644 index 0000000..fc1be27 --- /dev/null +++ b/common/models/ars/File.php @@ -0,0 +1,86 @@ + 255], + [['alias'], 'string', 'max' => 50], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'pid' => '父级id', + 'name' => '名称', + 'type' => '类型', + 'own_type' => '拥有者类型', + 'own_id' => '拥有者id', + 'alias' => '别名', + 'path' => '地址', + 'is_delete' => '是否删除,1为已删除', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/Order.php b/common/models/ars/Order.php new file mode 100644 index 0000000..6f03a52 --- /dev/null +++ b/common/models/ars/Order.php @@ -0,0 +1,121 @@ + 64], + [['consignee', 'phone'], 'string', 'max' => 20], + [['province', 'city', 'area'], 'string', 'max' => 10], + [['payment_sn'], 'string', 'max' => 120], + [['remarks'], 'string', 'max' => 255], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'user_id' => '用户id', + 'order_sn' => '订单号', + 'invoice_id' => '发票单号', + 'status' => '状态', + 'type' => '类型', + 'goods_count' => '商品数量', + 'goods_amount' => '商品金额', + 'shipping_amount' => '物流金额', + 'shipping_type' => '物流类型', + 'consignee' => '收件人', + 'phone' => '手机号码', + 'province' => '省份', + 'city' => '城市', + 'area' => '区域', + 'taking_site' => '自提点', + 'pay_type' => '支付方式', + 'pay_at' => '支付时间', + 'payment_sn' => '付款单号', + 'payment_amount' => '支付金额', + 'receivables' => '应收款', + 'remarks' => '备注', + 'discount_amount' => '折扣金额', + 'discount_decription' => '折扣说明', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/OrderGoods.php b/common/models/ars/OrderGoods.php new file mode 100644 index 0000000..fa4d65d --- /dev/null +++ b/common/models/ars/OrderGoods.php @@ -0,0 +1,86 @@ + 120], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'order_id' => '订单id', + 'goods_id' => '商品id', + 'goods_img' => '商品图片', + 'goods_name' => '商品名称', + 'goods_count' => '商品数量', + 'sku_value' => '商品sku', + 'price' => '销售价', + 'market_price' => '市场价', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/PaymentLog.php b/common/models/ars/PaymentLog.php new file mode 100644 index 0000000..9055f33 --- /dev/null +++ b/common/models/ars/PaymentLog.php @@ -0,0 +1,85 @@ + 64], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'order_id' => '订单id', + 'wx_refund_id' => '微信退款单号', + 'mch_id' => '商户号', + 'order_amount' => '订单金额', + 'payment_amount' => '支付金额', + 'type' => '类型', + 'status' => '状态', + 'refund_account' => '退款账户', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/Province.php b/common/models/ars/Province.php new file mode 100644 index 0000000..b03ffe6 --- /dev/null +++ b/common/models/ars/Province.php @@ -0,0 +1,49 @@ + 16], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => 'name', + 'province_id' => 'province_id', + ]; + } + + +} diff --git a/common/models/ars/RefundLog.php b/common/models/ars/RefundLog.php new file mode 100644 index 0000000..33ed965 --- /dev/null +++ b/common/models/ars/RefundLog.php @@ -0,0 +1,71 @@ + 64], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'order_id' => '订单id', + 'wx_refund_id' => '微信退款单号', + 'reason' => '理由', + 'order_amount' => '订单金额', + 'refund_amount' => '退款金额', + 'refunded_amount' => '已退款金额', + 'type' => '类型', + 'status' => '状态', + 'refund_account' => '退款账户', + 'operator_id' => '操作者', + 'applyed_at' => '申请时间', + 'confirmed_at' => '确认时间', + 'finished_at' => '完成时间', + ]; + } + + +} diff --git a/common/models/ars/SearchHistory.php b/common/models/ars/SearchHistory.php new file mode 100644 index 0000000..17fc86c --- /dev/null +++ b/common/models/ars/SearchHistory.php @@ -0,0 +1,80 @@ + 255], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'user_id' => '用户id', + 'keyword' => '关键字', + 'count' => '次数', + 'status' => '状态', + 'type' => '类型', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/TakingSite.php b/common/models/ars/TakingSite.php new file mode 100644 index 0000000..cbd36bd --- /dev/null +++ b/common/models/ars/TakingSite.php @@ -0,0 +1,84 @@ + 120], + [['province', 'city', 'area'], 'string', 'max' => 10], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => '名称', + 'province' => '省份', + 'city' => '城市', + 'area' => '区域', + 'address' => '地址', + 'is_default' => '是否为默认,1为默认', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/TemFile.php b/common/models/ars/TemFile.php new file mode 100644 index 0000000..52c228d --- /dev/null +++ b/common/models/ars/TemFile.php @@ -0,0 +1,80 @@ + 255], + [['alias'], 'string', 'max' => 50], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'user_id' => '父级id', + 'name' => '名称', + 'type' => '类型', + 'alias' => '别名', + 'path' => '地址', + 'updated_at' => '更新时间', + 'created_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/vendor/antgoods/goods/src/models/ars/Attribute.php b/vendor/antgoods/goods/src/models/ars/Attribute.php new file mode 100644 index 0000000..c68e652 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/Attribute.php @@ -0,0 +1,81 @@ + 50], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => '属性名', + 'value' => '属性值', + 'type' => '类型', + '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/vendor/antgoods/goods/src/models/ars/Brand.php b/vendor/antgoods/goods/src/models/ars/Brand.php new file mode 100644 index 0000000..a225e59 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/Brand.php @@ -0,0 +1,74 @@ + 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(); + }, + ], + ]; + } +} diff --git a/vendor/antgoods/goods/src/models/ars/Category.php b/vendor/antgoods/goods/src/models/ars/Category.php new file mode 100644 index 0000000..9fe01df --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/Category.php @@ -0,0 +1,87 @@ + 60], + [['icon'], 'string', 'max' => 64], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => '类别名称', + 'pid' => '父级id', + 'goods_count' => '商品数量', + 'sort_order' => '排序', + 'icon_type' => '图标类型', + 'icon' => '图标', + 'is_show' => '是否显示,1为不显示', + '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/vendor/antgoods/goods/src/models/ars/FilterAttr.php b/vendor/antgoods/goods/src/models/ars/FilterAttr.php new file mode 100644 index 0000000..2036d55 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/FilterAttr.php @@ -0,0 +1,78 @@ + 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/vendor/antgoods/goods/src/models/ars/Goods.php b/vendor/antgoods/goods/src/models/ars/Goods.php new file mode 100644 index 0000000..841efc8 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/Goods.php @@ -0,0 +1,135 @@ + 120], + [['sn'], 'string', 'max' => 60], + [['code'], 'string', 'max' => 50], + [['unit'], 'string', 'max' => 16], + [['brief'], 'string', 'max' => 255], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'pid' => '父级id', + 'cat_id' => '后台商品类别id', + 'brand_id' => '品牌id', + 'shop_cat_id' => '前端商品类别id', + 'name' => '商品名称', + 'sn' => '商品唯一货号', + 'code' => '商品货码', + 'supplier_id' => '供应商id', + 'weight' => '重量', + 'length' => '长度', + 'width' => '宽度', + 'height' => '高度', + 'diameter' => '直径', + 'unit' => '单位', + 'sold_count' => '已售数量', + 'limit_count' => '限购数量', + 'stock' => '库存', + 'stock_warn' => '库存警告', + 'market_price' => '市场价', + 'price' => '销售价', + 'brief' => '简介', + 'description' => '详细介绍', + 'image' => '图片id', + 'model_id' => '模型id', + 'is_sale' => '该商品是否开放销售,1为是,0为否', + '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(); + }, + ], + ]; + } +} diff --git a/vendor/antgoods/goods/src/models/ars/GoodsAttr.php b/vendor/antgoods/goods/src/models/ars/GoodsAttr.php new file mode 100644 index 0000000..b888e46 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/GoodsAttr.php @@ -0,0 +1,78 @@ + 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/vendor/antgoods/goods/src/models/ars/GoodsSku.php b/vendor/antgoods/goods/src/models/ars/GoodsSku.php new file mode 100644 index 0000000..7e4644a --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/GoodsSku.php @@ -0,0 +1,105 @@ + 50], + [['goods_sn', 'goods_attr'], 'string', 'max' => 60], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'goods_id' => '商品id', + 'goods_code' => '商品条码', + 'goods_sn' => '商品唯一货号', + 'goods_attr' => '属性匹配', + 'weight' => '重量', + 'length' => '长度', + 'width' => '宽度', + 'height' => '高度', + 'diameter' => '直径', + '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/vendor/antgoods/goods/src/models/ars/ShopCategory.php b/vendor/antgoods/goods/src/models/ars/ShopCategory.php new file mode 100644 index 0000000..2ffb20c --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/ShopCategory.php @@ -0,0 +1,96 @@ + 60], + [['keywords'], 'string', 'max' => 100], + [['desc'], 'string', 'max' => 255], + [['icon'], 'string', 'max' => 64], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => '类别名称', + 'pid' => '父级id', + 'goods_count' => '商品数量', + 'keywords' => '关键字', + 'desc' => '描述', + 'sort_order' => '排序', + 'icon_type' => '图标类型', + 'icon' => '图标', + 'filter_attr' => '筛选属性', + 'is_show' => '是否显示,1为不显示', + '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/vendor/antgoods/goods/src/models/ars/Supplier.php b/vendor/antgoods/goods/src/models/ars/Supplier.php new file mode 100644 index 0000000..73d51f6 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/Supplier.php @@ -0,0 +1,81 @@ + 50], + [['phone'], 'string', 'max' => 20], + ]; + } + + /** + * {@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(); + }, + ], + ]; + } +} From d5075878c22c2d9aa4ebf9997dd7baea26fb07f7 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 15:03:56 +0800 Subject: [PATCH 031/102] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=9B=A0=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=9F=E6=88=90=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/controllers/AttributeController.php | 0 backend/controllers/BrandController.php | 0 backend/controllers/CategoryController.php | 149 ---------------- backend/controllers/ConfigController.php | 0 backend/controllers/OrderController.php | 0 .../controllers/ShopCategoryController.php | 149 ---------------- backend/controllers/SiteController.php | 0 backend/controllers/SupplierController.php | 0 backend/views/attribute/_form.php | 0 backend/views/attribute/_search.php | 0 backend/views/attribute/create.php | 0 backend/views/attribute/index.php | 0 backend/views/attribute/update.php | 0 backend/views/attribute/view.php | 0 backend/views/brand/_form.php | 0 backend/views/brand/_search.php | 0 backend/views/brand/create.php | 0 backend/views/brand/index.php | 0 backend/views/brand/update.php | 0 backend/views/brand/view.php | 0 backend/views/category/_form.php | 38 ----- backend/views/category/_search.php | 49 ------ backend/views/category/create.php | 18 -- backend/views/category/index.php | 28 --- backend/views/category/test.php | 98 ----------- backend/views/category/update.php | 19 --- backend/views/category/view.php | 37 ---- backend/views/config/index.php | 0 backend/views/layouts/base.php | 0 backend/views/layouts/breadcrumb.php | 0 backend/views/layouts/footer.php | 0 backend/views/layouts/header.php | 0 backend/views/layouts/main.php | 0 backend/views/layouts/sidebar.php | 2 - backend/views/order/_form.php | 0 backend/views/order/_search.php | 0 backend/views/order/create.php | 0 backend/views/order/index.php | 0 backend/views/order/update.php | 0 backend/views/order/view.php | 0 backend/views/shop-category/_form.php | 44 ----- backend/views/shop-category/_search.php | 49 ------ backend/views/shop-category/create.php | 18 -- backend/views/shop-category/index.php | 28 --- backend/views/shop-category/update.php | 19 --- backend/views/shop-category/view.php | 40 ----- backend/views/site/error.php | 0 backend/views/site/index.php | 0 backend/views/site/login.php | 0 backend/views/site/test.php | 0 backend/views/supplier/_form.php | 0 backend/views/supplier/_search.php | 0 backend/views/supplier/create.php | 0 backend/views/supplier/index.php | 0 backend/views/supplier/update.php | 0 backend/views/supplier/view.php | 0 common/models/searchs/AttributeSearch.php | 147 ---------------- common/models/searchs/BrandSearch.php | 0 common/models/searchs/CategorySearch.php | 153 ----------------- common/models/searchs/OrderSearch.php | 0 common/models/searchs/ShopCategorySearch.php | 159 ------------------ common/models/searchs/SupplierSearch.php | 0 62 files changed, 1244 deletions(-) mode change 100644 => 100755 backend/controllers/AttributeController.php mode change 100644 => 100755 backend/controllers/BrandController.php delete mode 100644 backend/controllers/CategoryController.php mode change 100644 => 100755 backend/controllers/ConfigController.php mode change 100644 => 100755 backend/controllers/OrderController.php delete mode 100644 backend/controllers/ShopCategoryController.php mode change 100644 => 100755 backend/controllers/SiteController.php mode change 100644 => 100755 backend/controllers/SupplierController.php mode change 100644 => 100755 backend/views/attribute/_form.php mode change 100644 => 100755 backend/views/attribute/_search.php mode change 100644 => 100755 backend/views/attribute/create.php mode change 100644 => 100755 backend/views/attribute/index.php mode change 100644 => 100755 backend/views/attribute/update.php mode change 100644 => 100755 backend/views/attribute/view.php mode change 100644 => 100755 backend/views/brand/_form.php mode change 100644 => 100755 backend/views/brand/_search.php mode change 100644 => 100755 backend/views/brand/create.php mode change 100644 => 100755 backend/views/brand/index.php mode change 100644 => 100755 backend/views/brand/update.php mode change 100644 => 100755 backend/views/brand/view.php delete mode 100644 backend/views/category/_form.php delete mode 100644 backend/views/category/_search.php delete mode 100644 backend/views/category/create.php delete mode 100644 backend/views/category/index.php delete mode 100644 backend/views/category/test.php delete mode 100644 backend/views/category/update.php delete mode 100644 backend/views/category/view.php mode change 100644 => 100755 backend/views/config/index.php mode change 100644 => 100755 backend/views/layouts/base.php mode change 100644 => 100755 backend/views/layouts/breadcrumb.php mode change 100644 => 100755 backend/views/layouts/footer.php mode change 100644 => 100755 backend/views/layouts/header.php mode change 100644 => 100755 backend/views/layouts/main.php mode change 100644 => 100755 backend/views/order/_form.php mode change 100644 => 100755 backend/views/order/_search.php mode change 100644 => 100755 backend/views/order/create.php mode change 100644 => 100755 backend/views/order/index.php mode change 100644 => 100755 backend/views/order/update.php mode change 100644 => 100755 backend/views/order/view.php delete mode 100644 backend/views/shop-category/_form.php delete mode 100644 backend/views/shop-category/_search.php delete mode 100644 backend/views/shop-category/create.php delete mode 100644 backend/views/shop-category/index.php delete mode 100644 backend/views/shop-category/update.php delete mode 100644 backend/views/shop-category/view.php mode change 100644 => 100755 backend/views/site/error.php mode change 100644 => 100755 backend/views/site/index.php mode change 100644 => 100755 backend/views/site/login.php mode change 100644 => 100755 backend/views/site/test.php mode change 100644 => 100755 backend/views/supplier/_form.php mode change 100644 => 100755 backend/views/supplier/_search.php mode change 100644 => 100755 backend/views/supplier/create.php mode change 100644 => 100755 backend/views/supplier/index.php mode change 100644 => 100755 backend/views/supplier/update.php mode change 100644 => 100755 backend/views/supplier/view.php delete mode 100644 common/models/searchs/AttributeSearch.php mode change 100644 => 100755 common/models/searchs/BrandSearch.php delete mode 100644 common/models/searchs/CategorySearch.php mode change 100644 => 100755 common/models/searchs/OrderSearch.php delete mode 100644 common/models/searchs/ShopCategorySearch.php mode change 100644 => 100755 common/models/searchs/SupplierSearch.php diff --git a/backend/controllers/AttributeController.php b/backend/controllers/AttributeController.php old mode 100644 new mode 100755 diff --git a/backend/controllers/BrandController.php b/backend/controllers/BrandController.php old mode 100644 new mode 100755 diff --git a/backend/controllers/CategoryController.php b/backend/controllers/CategoryController.php deleted file mode 100644 index 4be79f8..0000000 --- a/backend/controllers/CategoryController.php +++ /dev/null @@ -1,149 +0,0 @@ - [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['POST'], - ], - ], - ]; - } - - /** - * Lists all Category models. - * @return mixed - */ - public function actionIndex() - { - $searchModel = new CategorySearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - 'columns' => $searchModel->columns() - ]); - } - - /** - * Displays a single Category model. - * @param integer $id - * @return mixed - * @throws NotFoundHttpException if the model cannot be found - */ - public function actionView($id) - { - return $this->render('view', [ - 'model' => $this->findModel($id), - ]); - } - - /** - * Creates a new Category model. - * If creation is successful, the browser will be redirected to the 'view' page. - * @return mixed - */ - public function actionCreate() - { - $model = new Category(); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect('index'); - } - - return $this->render('create', [ - 'model' => $model, - ]); - } - - /** - * Updates an existing Category model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id - * @return mixed - * @throws NotFoundHttpException if the model cannot be found - */ - public function actionUpdate($id) - { - $model = $this->findModel($id); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect('index'); - } - - return $this->render('update', [ - 'model' => $model, - ]); - } - - /** - * Deletes an existing Category model. - * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id - * @return mixed - * @throws NotFoundHttpException if the model cannot be found - */ - public function actionDelete($id) - { - $this->findModel($id)->delete(); - - return $this->redirect(['index']); - } - - /** - * Finds the Category model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * @param integer $id - * @return Category the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($id) - { - if (($model = Category::findOne($id)) !== null) { - return $model; - } - - throw new NotFoundHttpException('The requested page does not exist.'); - } - /** - * @author iron - * 文件导出 - */ - public function actionExport() - { - $searchModel = new CategorySearch(); - $params = Yii::$app->request->queryParams; - if ($params['page-type'] == 'all') { - $dataProvider = $searchModel->allData($params); - } else { - $dataProvider = $searchModel->search($params); - } - \iron\widget\Excel::export([ - 'models' => $dataProvider->getModels(), - 'format' => 'Xlsx', - 'asAttachment' => true, - 'fileName' =>'Categories'. "-" .date('Y-m-d H/i/s', time()), - 'columns' => $searchModel->columns() - ]); - } -} diff --git a/backend/controllers/ConfigController.php b/backend/controllers/ConfigController.php old mode 100644 new mode 100755 diff --git a/backend/controllers/OrderController.php b/backend/controllers/OrderController.php old mode 100644 new mode 100755 diff --git a/backend/controllers/ShopCategoryController.php b/backend/controllers/ShopCategoryController.php deleted file mode 100644 index ad4e43e..0000000 --- a/backend/controllers/ShopCategoryController.php +++ /dev/null @@ -1,149 +0,0 @@ - [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['POST'], - ], - ], - ]; - } - - /** - * Lists all ShopCategory models. - * @return mixed - */ - public function actionIndex() - { - $searchModel = new ShopCategorySearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - 'columns' => $searchModel->columns() - ]); - } - - /** - * Displays a single ShopCategory model. - * @param integer $id - * @return mixed - * @throws NotFoundHttpException if the model cannot be found - */ - public function actionView($id) - { - return $this->render('view', [ - 'model' => $this->findModel($id), - ]); - } - - /** - * Creates a new ShopCategory model. - * If creation is successful, the browser will be redirected to the 'view' page. - * @return mixed - */ - public function actionCreate() - { - $model = new ShopCategory(); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect('index'); - } - - return $this->render('create', [ - 'model' => $model, - ]); - } - - /** - * Updates an existing ShopCategory model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id - * @return mixed - * @throws NotFoundHttpException if the model cannot be found - */ - public function actionUpdate($id) - { - $model = $this->findModel($id); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect('index'); - } - - return $this->render('update', [ - 'model' => $model, - ]); - } - - /** - * Deletes an existing ShopCategory model. - * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id - * @return mixed - * @throws NotFoundHttpException if the model cannot be found - */ - public function actionDelete($id) - { - $this->findModel($id)->delete(); - - return $this->redirect(['index']); - } - - /** - * Finds the ShopCategory model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * @param integer $id - * @return ShopCategory the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($id) - { - if (($model = ShopCategory::findOne($id)) !== null) { - return $model; - } - - throw new NotFoundHttpException('The requested page does not exist.'); - } - /** - * @author iron - * 文件导出 - */ - public function actionExport() - { - $searchModel = new ShopCategorySearch(); - $params = Yii::$app->request->queryParams; - if ($params['page-type'] == 'all') { - $dataProvider = $searchModel->allData($params); - } else { - $dataProvider = $searchModel->search($params); - } - \iron\widget\Excel::export([ - 'models' => $dataProvider->getModels(), - 'format' => 'Xlsx', - 'asAttachment' => true, - 'fileName' =>'Shop Categories'. "-" .date('Y-m-d H/i/s', time()), - 'columns' => $searchModel->columns() - ]); - } -} diff --git a/backend/controllers/SiteController.php b/backend/controllers/SiteController.php old mode 100644 new mode 100755 diff --git a/backend/controllers/SupplierController.php b/backend/controllers/SupplierController.php old mode 100644 new mode 100755 diff --git a/backend/views/attribute/_form.php b/backend/views/attribute/_form.php old mode 100644 new mode 100755 diff --git a/backend/views/attribute/_search.php b/backend/views/attribute/_search.php old mode 100644 new mode 100755 diff --git a/backend/views/attribute/create.php b/backend/views/attribute/create.php old mode 100644 new mode 100755 diff --git a/backend/views/attribute/index.php b/backend/views/attribute/index.php old mode 100644 new mode 100755 diff --git a/backend/views/attribute/update.php b/backend/views/attribute/update.php old mode 100644 new mode 100755 diff --git a/backend/views/attribute/view.php b/backend/views/attribute/view.php old mode 100644 new mode 100755 diff --git a/backend/views/brand/_form.php b/backend/views/brand/_form.php old mode 100644 new mode 100755 diff --git a/backend/views/brand/_search.php b/backend/views/brand/_search.php old mode 100644 new mode 100755 diff --git a/backend/views/brand/create.php b/backend/views/brand/create.php old mode 100644 new mode 100755 diff --git a/backend/views/brand/index.php b/backend/views/brand/index.php old mode 100644 new mode 100755 diff --git a/backend/views/brand/update.php b/backend/views/brand/update.php old mode 100644 new mode 100755 diff --git a/backend/views/brand/view.php b/backend/views/brand/view.php old mode 100644 new mode 100755 diff --git a/backend/views/category/_form.php b/backend/views/category/_form.php deleted file mode 100644 index 1ce3540..0000000 --- a/backend/views/category/_form.php +++ /dev/null @@ -1,38 +0,0 @@ - - -
- - - - field($model, 'name')->textInput(['maxlength' => true]) ?> - - field($model, 'pid')->textInput() ?> - - field($model, 'goods_count')->textInput() ?> - - field($model, 'sort_order')->textInput() ?> - - field($model, 'icon_type')->textInput() ?> - - field($model, 'icon')->textInput(['maxlength' => true]) ?> - - field($model, 'is_show')->textInput() ?> - - field($model, 'is_delete')->textInput() ?> - -
- 'btn btn-success']) ?> - 'btn btn-info']) ?> -
- - - -
diff --git a/backend/views/category/_search.php b/backend/views/category/_search.php deleted file mode 100644 index d43cb1d..0000000 --- a/backend/views/category/_search.php +++ /dev/null @@ -1,49 +0,0 @@ - - - ['index'], - 'method' => 'get', - 'validateOnType' => true, - ]); -?> -
-
- field($model, 'id', [ - "template" => "{input}{error}", - "inputOptions" => [ - "placeholder" => "检索ID", - "class" => "form-control", - ], - "errorOptions" => [ - "class" => "error-tips" - ] - ]) - ?> -
-
- field($model, "created_at_range", [ - "template" => "{input}{error}", - "inputOptions" => [ - "placeholder" => "创建时间", - ], - "errorOptions" => [ - "class" => "error-tips" - ] - ])->widget(DateRangePicker::className()); - ?> -
-
- ', ['class' => 'btn btn-default']) ?> - ', ['class' => 'btn btn-default']) ?> -
-
- \ No newline at end of file diff --git a/backend/views/category/create.php b/backend/views/category/create.php deleted file mode 100644 index 932a778..0000000 --- a/backend/views/category/create.php +++ /dev/null @@ -1,18 +0,0 @@ -title = '创建 Category'; -$this->params['breadcrumbs'][] = ['label' => 'Categories', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -?> -
- - render('_form', [ - 'model' => $model, - ]) ?> - -
diff --git a/backend/views/category/index.php b/backend/views/category/index.php deleted file mode 100644 index 9c6da0b..0000000 --- a/backend/views/category/index.php +++ /dev/null @@ -1,28 +0,0 @@ -title = 'Categories'; -$this->params['breadcrumbs'][] = $this->title; -?> -
-
- $dataProvider, - 'filter' => $this->render("_search", ['model' => $searchModel]), - 'batch' => [ - [ - "label" => "删除", - "url" => "category/deletes" - ], - ], - 'columns' => $columns - ]); - ?> -
-
\ No newline at end of file diff --git a/backend/views/category/test.php b/backend/views/category/test.php deleted file mode 100644 index a2ec90b..0000000 --- a/backend/views/category/test.php +++ /dev/null @@ -1,98 +0,0 @@ - - -
- - - -
- -
-
-
Upload -
- -
-
- Drag & Drop Files
-
-
-
- - diff --git a/backend/views/category/update.php b/backend/views/category/update.php deleted file mode 100644 index f492c7b..0000000 --- a/backend/views/category/update.php +++ /dev/null @@ -1,19 +0,0 @@ -title = '编辑 Category: ' . $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Categories', 'url' => ['index']]; -$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; -$this->params['breadcrumbs'][] = 'Update '; -?> -
- - render('_form', [ - 'model' => $model, - ]) ?> - -
diff --git a/backend/views/category/view.php b/backend/views/category/view.php deleted file mode 100644 index 403a436..0000000 --- a/backend/views/category/view.php +++ /dev/null @@ -1,37 +0,0 @@ -title = $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Categories', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -\yii\web\YiiAsset::register($this); -?> -
- -

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

- - $model, - 'attributes' => [ - 'id', - 'name', - 'pid', - 'goods_count', - 'sort_order', - 'icon_type', - 'icon', - 'is_show', - 'is_delete', - 'created_at', - 'updated_at', - ], - ]) ?> - -
diff --git a/backend/views/config/index.php b/backend/views/config/index.php old mode 100644 new mode 100755 diff --git a/backend/views/layouts/base.php b/backend/views/layouts/base.php old mode 100644 new mode 100755 diff --git a/backend/views/layouts/breadcrumb.php b/backend/views/layouts/breadcrumb.php old mode 100644 new mode 100755 diff --git a/backend/views/layouts/footer.php b/backend/views/layouts/footer.php old mode 100644 new mode 100755 diff --git a/backend/views/layouts/header.php b/backend/views/layouts/header.php old mode 100644 new mode 100755 diff --git a/backend/views/layouts/main.php b/backend/views/layouts/main.php old mode 100644 new mode 100755 diff --git a/backend/views/layouts/sidebar.php b/backend/views/layouts/sidebar.php index 1ce632a..0277d3d 100755 --- a/backend/views/layouts/sidebar.php +++ b/backend/views/layouts/sidebar.php @@ -21,9 +21,7 @@ use iron\widgets\Menu; ] ], ['label' => '商品管理', 'url' => '#', 'icon' => 'far fa-archive', 'items' => [ - ['label' => '商品分类', 'url' => ['category/index', 'tag' => 'new']], ['label' => '商品列表', 'url' => ['antgoods/goods/index']], - ['label' => '属性管理', 'url' => ['attribute/index']], ] ], ['label' => '订单管理', 'url' => '#', 'icon' => 'far fa-list-alt', 'items' => [ diff --git a/backend/views/order/_form.php b/backend/views/order/_form.php old mode 100644 new mode 100755 diff --git a/backend/views/order/_search.php b/backend/views/order/_search.php old mode 100644 new mode 100755 diff --git a/backend/views/order/create.php b/backend/views/order/create.php old mode 100644 new mode 100755 diff --git a/backend/views/order/index.php b/backend/views/order/index.php old mode 100644 new mode 100755 diff --git a/backend/views/order/update.php b/backend/views/order/update.php old mode 100644 new mode 100755 diff --git a/backend/views/order/view.php b/backend/views/order/view.php old mode 100644 new mode 100755 diff --git a/backend/views/shop-category/_form.php b/backend/views/shop-category/_form.php deleted file mode 100644 index 5f0949f..0000000 --- a/backend/views/shop-category/_form.php +++ /dev/null @@ -1,44 +0,0 @@ - - -
- - - - field($model, 'name')->textInput(['maxlength' => true]) ?> - - field($model, 'pid')->textInput() ?> - - field($model, 'goods_count')->textInput() ?> - - field($model, 'keywords')->textInput(['maxlength' => true]) ?> - - field($model, 'desc')->textInput(['maxlength' => true]) ?> - - field($model, 'sort_order')->textInput() ?> - - field($model, 'icon_type')->textInput() ?> - - field($model, 'icon')->textInput(['maxlength' => true]) ?> - - field($model, 'filter_attr')->textarea(['rows' => 6]) ?> - - field($model, 'is_show')->textInput() ?> - - field($model, 'is_delete')->textInput() ?> - -
- 'btn btn-success']) ?> - 'btn btn-info']) ?> -
- - - -
diff --git a/backend/views/shop-category/_search.php b/backend/views/shop-category/_search.php deleted file mode 100644 index 1e839e6..0000000 --- a/backend/views/shop-category/_search.php +++ /dev/null @@ -1,49 +0,0 @@ - - - ['index'], - 'method' => 'get', - 'validateOnType' => true, - ]); -?> -
-
- field($model, 'id', [ - "template" => "{input}{error}", - "inputOptions" => [ - "placeholder" => "检索ID", - "class" => "form-control", - ], - "errorOptions" => [ - "class" => "error-tips" - ] - ]) - ?> -
-
- field($model, "created_at_range", [ - "template" => "{input}{error}", - "inputOptions" => [ - "placeholder" => "创建时间", - ], - "errorOptions" => [ - "class" => "error-tips" - ] - ])->widget(DateRangePicker::className()); - ?> -
-
- ', ['class' => 'btn btn-default']) ?> - ', ['class' => 'btn btn-default']) ?> -
-
- \ No newline at end of file diff --git a/backend/views/shop-category/create.php b/backend/views/shop-category/create.php deleted file mode 100644 index 2fe2348..0000000 --- a/backend/views/shop-category/create.php +++ /dev/null @@ -1,18 +0,0 @@ -title = '创建 Shop Category'; -$this->params['breadcrumbs'][] = ['label' => 'Shop Categories', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -?> -
- - render('_form', [ - 'model' => $model, - ]) ?> - -
diff --git a/backend/views/shop-category/index.php b/backend/views/shop-category/index.php deleted file mode 100644 index e1a7446..0000000 --- a/backend/views/shop-category/index.php +++ /dev/null @@ -1,28 +0,0 @@ -title = 'Shop Categories'; -$this->params['breadcrumbs'][] = $this->title; -?> -
-
- $dataProvider, - 'filter' => $this->render("_search", ['model' => $searchModel]), - 'batch' => [ - [ - "label" => "删除", - "url" => "shop-category/deletes" - ], - ], - 'columns' => $columns - ]); - ?> -
-
\ No newline at end of file diff --git a/backend/views/shop-category/update.php b/backend/views/shop-category/update.php deleted file mode 100644 index 93e68c8..0000000 --- a/backend/views/shop-category/update.php +++ /dev/null @@ -1,19 +0,0 @@ -title = '编辑 Shop Category: ' . $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Shop Categories', 'url' => ['index']]; -$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; -$this->params['breadcrumbs'][] = 'Update '; -?> -
- - render('_form', [ - 'model' => $model, - ]) ?> - -
diff --git a/backend/views/shop-category/view.php b/backend/views/shop-category/view.php deleted file mode 100644 index b94aaa9..0000000 --- a/backend/views/shop-category/view.php +++ /dev/null @@ -1,40 +0,0 @@ -title = $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Shop Categories', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -\yii\web\YiiAsset::register($this); -?> -
- -

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

- - $model, - 'attributes' => [ - 'id', - 'name', - 'pid', - 'goods_count', - 'keywords', - 'desc', - 'sort_order', - 'icon_type', - 'icon', - 'filter_attr:ntext', - 'is_show', - 'is_delete', - 'created_at', - 'updated_at', - ], - ]) ?> - -
diff --git a/backend/views/site/error.php b/backend/views/site/error.php old mode 100644 new mode 100755 diff --git a/backend/views/site/index.php b/backend/views/site/index.php old mode 100644 new mode 100755 diff --git a/backend/views/site/login.php b/backend/views/site/login.php old mode 100644 new mode 100755 diff --git a/backend/views/site/test.php b/backend/views/site/test.php old mode 100644 new mode 100755 diff --git a/backend/views/supplier/_form.php b/backend/views/supplier/_form.php old mode 100644 new mode 100755 diff --git a/backend/views/supplier/_search.php b/backend/views/supplier/_search.php old mode 100644 new mode 100755 diff --git a/backend/views/supplier/create.php b/backend/views/supplier/create.php old mode 100644 new mode 100755 diff --git a/backend/views/supplier/index.php b/backend/views/supplier/index.php old mode 100644 new mode 100755 diff --git a/backend/views/supplier/update.php b/backend/views/supplier/update.php old mode 100644 new mode 100755 diff --git a/backend/views/supplier/view.php b/backend/views/supplier/view.php old mode 100644 new mode 100755 diff --git a/common/models/searchs/AttributeSearch.php b/common/models/searchs/AttributeSearch.php deleted file mode 100644 index bb725fe..0000000 --- a/common/models/searchs/AttributeSearch.php +++ /dev/null @@ -1,147 +0,0 @@ - 'blobt\grid\CheckboxColumn', - 'width' => '2%', - 'align' => 'center' - ], - 'id', - 'name', - 'value', - 'type', - 'sort_order', - //'is_delete', - //'created_at', - //'updated_at', - [ - 'class' => 'iron\grid\ActionColumn', - 'align' => 'center', - ], - ]; - } - /** - * @param $params - * @return ActiveDataProvider - * 不分页的所有数据 - */ - public function allData($params) - { - $query = Attribute::find(); - $dataProvider = new ActiveDataProvider([ - 'query' => $query, - 'pagination' => false, - 'sort' => false - ]); - $this->load($params); - return $this->filter($query, $dataProvider); - } - - /** - * Creates data provider instance with search query applied - * - * @param array $params - * - * @return ActiveDataProvider - */ - public function search($params) - { - $query = Attribute::find(); - - // add conditions that should always apply here - - $dataProvider = new ActiveDataProvider([ - 'query' => $query, - 'pagination' => [ - 'pageSizeLimit' => [1, 200] - ], - 'sort' => [ - 'defaultOrder' => [ - 'id' => SORT_DESC, - ] - ], - ]); - - $this->load($params); - return $this->filter($query, $dataProvider); - } - /** - * @param $query - * @param $dataProvider - * @return ActiveDataProvider - * 条件筛选 - */ - private function filter($query, $dataProvider){ - if (!$this->validate()) { - // uncomment the following line if you do not want to return any records when validation fails - // $query->where('0=1'); - return $dataProvider; - } - - // grid filtering conditions - $query->andFilterWhere([ - 'id' => $this->id, - 'type' => $this->type, - 'sort_order' => $this->sort_order, - 'is_delete' => $this->is_delete, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, - ]); - - $query->andFilterWhere(['like', 'name', $this->name]) - ->andFilterWhere(['like', 'value', $this->value]); - if ($this->created_at_range) { - $arr = explode(' ~ ', $this->created_at_range); - $start = strtotime($arr[0]); - $end = strtotime($arr[1]) + 3600 * 24; - $query->andFilterWhere(['between', 'created_at', $start, $end]); - } - return $dataProvider; - } -} diff --git a/common/models/searchs/BrandSearch.php b/common/models/searchs/BrandSearch.php old mode 100644 new mode 100755 diff --git a/common/models/searchs/CategorySearch.php b/common/models/searchs/CategorySearch.php deleted file mode 100644 index 2693c7f..0000000 --- a/common/models/searchs/CategorySearch.php +++ /dev/null @@ -1,153 +0,0 @@ - 'blobt\grid\CheckboxColumn', - 'width' => '2%', - 'align' => 'center' - ], - 'id', - 'name', - 'pid', - 'goods_count', - 'sort_order', - //'icon_type', - //'icon', - //'is_show', - //'is_delete', - //'created_at', - //'updated_at', - [ - 'class' => 'iron\grid\ActionColumn', - 'align' => 'center', - ], - ]; - } - /** - * @param $params - * @return ActiveDataProvider - * 不分页的所有数据 - */ - public function allData($params) - { - $query = Category::find(); - $dataProvider = new ActiveDataProvider([ - 'query' => $query, - 'pagination' => false, - 'sort' => false - ]); - $this->load($params); - return $this->filter($query, $dataProvider); - } - - /** - * Creates data provider instance with search query applied - * - * @param array $params - * - * @return ActiveDataProvider - */ - public function search($params) - { - $query = Category::find(); - - // add conditions that should always apply here - - $dataProvider = new ActiveDataProvider([ - 'query' => $query, - 'pagination' => [ - 'pageSizeLimit' => [1, 200] - ], - 'sort' => [ - 'defaultOrder' => [ - 'id' => SORT_DESC, - ] - ], - ]); - - $this->load($params); - return $this->filter($query, $dataProvider); - } - /** - * @param $query - * @param $dataProvider - * @return ActiveDataProvider - * 条件筛选 - */ - private function filter($query, $dataProvider){ - if (!$this->validate()) { - // uncomment the following line if you do not want to return any records when validation fails - // $query->where('0=1'); - return $dataProvider; - } - - // grid filtering conditions - $query->andFilterWhere([ - 'id' => $this->id, - 'pid' => $this->pid, - 'goods_count' => $this->goods_count, - 'sort_order' => $this->sort_order, - 'icon_type' => $this->icon_type, - 'is_show' => $this->is_show, - 'is_delete' => $this->is_delete, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, - ]); - - $query->andFilterWhere(['like', 'name', $this->name]) - ->andFilterWhere(['like', 'icon', $this->icon]); - if ($this->created_at_range) { - $arr = explode(' ~ ', $this->created_at_range); - $start = strtotime($arr[0]); - $end = strtotime($arr[1]) + 3600 * 24; - $query->andFilterWhere(['between', 'created_at', $start, $end]); - } - return $dataProvider; - } -} diff --git a/common/models/searchs/OrderSearch.php b/common/models/searchs/OrderSearch.php old mode 100644 new mode 100755 diff --git a/common/models/searchs/ShopCategorySearch.php b/common/models/searchs/ShopCategorySearch.php deleted file mode 100644 index 8704080..0000000 --- a/common/models/searchs/ShopCategorySearch.php +++ /dev/null @@ -1,159 +0,0 @@ - 'blobt\grid\CheckboxColumn', - 'width' => '2%', - 'align' => 'center' - ], - 'id', - 'name', - 'pid', - 'goods_count', - 'keywords', - //'desc', - //'sort_order', - //'icon_type', - //'icon', - //'filter_attr', - //'is_show', - //'is_delete', - //'created_at', - //'updated_at', - [ - 'class' => 'iron\grid\ActionColumn', - 'align' => 'center', - ], - ]; - } - /** - * @param $params - * @return ActiveDataProvider - * 不分页的所有数据 - */ - public function allData($params) - { - $query = ShopCategory::find(); - $dataProvider = new ActiveDataProvider([ - 'query' => $query, - 'pagination' => false, - 'sort' => false - ]); - $this->load($params); - return $this->filter($query, $dataProvider); - } - - /** - * Creates data provider instance with search query applied - * - * @param array $params - * - * @return ActiveDataProvider - */ - public function search($params) - { - $query = ShopCategory::find(); - - // add conditions that should always apply here - - $dataProvider = new ActiveDataProvider([ - 'query' => $query, - 'pagination' => [ - 'pageSizeLimit' => [1, 200] - ], - 'sort' => [ - 'defaultOrder' => [ - 'id' => SORT_DESC, - ] - ], - ]); - - $this->load($params); - return $this->filter($query, $dataProvider); - } - /** - * @param $query - * @param $dataProvider - * @return ActiveDataProvider - * 条件筛选 - */ - private function filter($query, $dataProvider){ - if (!$this->validate()) { - // uncomment the following line if you do not want to return any records when validation fails - // $query->where('0=1'); - return $dataProvider; - } - - // grid filtering conditions - $query->andFilterWhere([ - 'id' => $this->id, - 'pid' => $this->pid, - 'goods_count' => $this->goods_count, - 'sort_order' => $this->sort_order, - 'icon_type' => $this->icon_type, - 'is_show' => $this->is_show, - 'is_delete' => $this->is_delete, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, - ]); - - $query->andFilterWhere(['like', 'name', $this->name]) - ->andFilterWhere(['like', 'keywords', $this->keywords]) - ->andFilterWhere(['like', 'desc', $this->desc]) - ->andFilterWhere(['like', 'icon', $this->icon]) - ->andFilterWhere(['like', 'filter_attr', $this->filter_attr]); - if ($this->created_at_range) { - $arr = explode(' ~ ', $this->created_at_range); - $start = strtotime($arr[0]); - $end = strtotime($arr[1]) + 3600 * 24; - $query->andFilterWhere(['between', 'created_at', $start, $end]); - } - return $dataProvider; - } -} diff --git a/common/models/searchs/SupplierSearch.php b/common/models/searchs/SupplierSearch.php old mode 100644 new mode 100755 From 9aca28f7cce7d73e69f82eea6d51741cfc069570 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 15:28:40 +0800 Subject: [PATCH 032/102] =?UTF-8?q?=E6=9B=B4=E6=8D=A2model=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E7=94=9F=E6=88=90model=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/models/ars/Address.php | 88 ------------ common/models/ars/AfterSale.php | 80 ----------- common/models/ars/Area.php | 51 ------- common/models/ars/Cart.php | 84 ----------- common/models/ars/City.php | 51 ------- common/models/ars/Collection.php | 73 ---------- common/models/ars/Comment.php | 80 ----------- common/models/ars/Delivery.php | 86 ----------- common/models/ars/ExpressTemplate.php | 95 ------------ common/models/ars/File.php | 86 ----------- common/models/ars/Order.php | 121 ---------------- common/models/ars/OrderGoods.php | 86 ----------- common/models/ars/PaymentLog.php | 85 ----------- common/models/ars/Province.php | 49 ------- common/models/ars/RefundLog.php | 71 --------- common/models/ars/SearchHistory.php | 80 ----------- common/models/ars/TakingSite.php | 84 ----------- common/models/ars/TemFile.php | 80 ----------- .../goods/src/models/ars/Attribute.php | 81 ----------- .../antgoods/goods/src/models/ars/Brand.php | 74 ---------- .../goods/src/models/ars/Category.php | 87 ----------- .../goods/src/models/ars/FilterAttr.php | 78 ---------- .../antgoods/goods/src/models/ars/Goods.php | 135 ------------------ .../goods/src/models/ars/GoodsAttr.php | 78 ---------- .../goods/src/models/ars/GoodsSku.php | 105 -------------- .../goods/src/models/ars/ShopCategory.php | 96 ------------- .../goods/src/models/ars/Supplier.php | 81 ----------- 27 files changed, 2245 deletions(-) delete mode 100644 common/models/ars/Address.php delete mode 100644 common/models/ars/AfterSale.php delete mode 100644 common/models/ars/Area.php delete mode 100644 common/models/ars/Cart.php delete mode 100644 common/models/ars/City.php delete mode 100644 common/models/ars/Collection.php delete mode 100644 common/models/ars/Comment.php delete mode 100644 common/models/ars/Delivery.php delete mode 100644 common/models/ars/ExpressTemplate.php delete mode 100644 common/models/ars/File.php delete mode 100644 common/models/ars/Order.php delete mode 100644 common/models/ars/OrderGoods.php delete mode 100644 common/models/ars/PaymentLog.php delete mode 100644 common/models/ars/Province.php delete mode 100644 common/models/ars/RefundLog.php delete mode 100644 common/models/ars/SearchHistory.php delete mode 100644 common/models/ars/TakingSite.php delete mode 100644 common/models/ars/TemFile.php delete mode 100644 vendor/antgoods/goods/src/models/ars/Attribute.php delete mode 100644 vendor/antgoods/goods/src/models/ars/Brand.php delete mode 100644 vendor/antgoods/goods/src/models/ars/Category.php delete mode 100644 vendor/antgoods/goods/src/models/ars/FilterAttr.php delete mode 100644 vendor/antgoods/goods/src/models/ars/Goods.php delete mode 100644 vendor/antgoods/goods/src/models/ars/GoodsAttr.php delete mode 100644 vendor/antgoods/goods/src/models/ars/GoodsSku.php delete mode 100644 vendor/antgoods/goods/src/models/ars/ShopCategory.php delete mode 100644 vendor/antgoods/goods/src/models/ars/Supplier.php diff --git a/common/models/ars/Address.php b/common/models/ars/Address.php deleted file mode 100644 index aec13fb..0000000 --- a/common/models/ars/Address.php +++ /dev/null @@ -1,88 +0,0 @@ - 20], - [['province', 'city', 'area'], 'string', 'max' => 10], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'user_id' => '用户id', - 'consignee' => '收件人', - 'phone' => '电话', - 'province' => '省份', - 'city' => '城市', - 'area' => '区域', - 'address' => '详细地址', - 'status' => '状态,0-默认值 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/common/models/ars/AfterSale.php b/common/models/ars/AfterSale.php deleted file mode 100644 index 4cf35b1..0000000 --- a/common/models/ars/AfterSale.php +++ /dev/null @@ -1,80 +0,0 @@ - 64], - [['take_shipping_sn', 'send_shipping_sn'], 'string', 'max' => 50], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'operator_id' => '操作者', - 'user_id' => '用户id', - 'wx_refund_id' => '微信退款单号', - 'after_sale_sn' => '售后单号', - 'order_goods_id' => '订单商品id', - 'count' => '退换货的商品数量', - 'amount' => '退货时实际退的金额', - 'type' => '类型', - 'reason' => '退换货理由', - 'description' => '描述', - 'take_shipping_sn' => '用户发货物流单号', - 'send_shipping_sn' => '换货商家发货的物流单号', - 'remarks' => '店家备注', - 'applyed_at' => '申请时间', - 'dealed_at' => '处理时间', - 'finished_at' => '完成时间', - ]; - } - - -} diff --git a/common/models/ars/Area.php b/common/models/ars/Area.php deleted file mode 100644 index 254681b..0000000 --- a/common/models/ars/Area.php +++ /dev/null @@ -1,51 +0,0 @@ - 32], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => 'name', - 'area_id' => 'area_id', - 'city_id' => 'city_id', - ]; - } - - -} diff --git a/common/models/ars/Cart.php b/common/models/ars/Cart.php deleted file mode 100644 index ef6477f..0000000 --- a/common/models/ars/Cart.php +++ /dev/null @@ -1,84 +0,0 @@ - 120], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'user_id' => '用户id', - 'goods_id' => '商品id', - 'goods_name' => '商品名称', - 'goods_img' => '商品图片', - 'goods_price' => '商品售价', - 'sku_id' => '商品sku的id', - 'goods_count' => '商品数量', - '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/common/models/ars/City.php b/common/models/ars/City.php deleted file mode 100644 index ae87412..0000000 --- a/common/models/ars/City.php +++ /dev/null @@ -1,51 +0,0 @@ - 32], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'city_id' => 'city_id', - 'name' => 'name', - 'province_id' => 'province_id', - ]; - } - - -} diff --git a/common/models/ars/Collection.php b/common/models/ars/Collection.php deleted file mode 100644 index 2a1a771..0000000 --- a/common/models/ars/Collection.php +++ /dev/null @@ -1,73 +0,0 @@ - 'id', - 'user_id' => '用户id', - 'goods_id' => '商品id', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/Comment.php b/common/models/ars/Comment.php deleted file mode 100644 index 2701ecf..0000000 --- a/common/models/ars/Comment.php +++ /dev/null @@ -1,80 +0,0 @@ - 'id', - 'user_id' => '用户id', - 'order_goods_id' => '订单详情商品id', - 'star' => '星级', - 'content' => '评论内容', - 'status' => '状态:1为显示,0为不显示', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/Delivery.php b/common/models/ars/Delivery.php deleted file mode 100644 index 85d1d0e..0000000 --- a/common/models/ars/Delivery.php +++ /dev/null @@ -1,86 +0,0 @@ - 50], - [['shipping_id'], 'string', 'max' => 10], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'order_id' => '订单id', - 'shipping_name' => '货流名称', - 'shipping_id' => '运货单位', - 'type' => '类型', - 'goods' => '商品', - 'status' => '状态', - 'decription' => '描述', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/ExpressTemplate.php b/common/models/ars/ExpressTemplate.php deleted file mode 100644 index e3e6b81..0000000 --- a/common/models/ars/ExpressTemplate.php +++ /dev/null @@ -1,95 +0,0 @@ - 255], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => '名称', - 'province' => '省份', - 'city' => '城市', - 'area' => '区域', - 'billing_type' => '账单类型', - 'extra_weight_type' => '续重重量类型', - 'exemption_type' => '包邮类型', - 'basic_price' => '基本运费', - 'extra_price' => '续重运费', - 'exemption_amount' => '包邮金额', - 'support_taking' => '是否支持自提,1为不支持', - 'taking_site' => '自提地点', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/File.php b/common/models/ars/File.php deleted file mode 100644 index fc1be27..0000000 --- a/common/models/ars/File.php +++ /dev/null @@ -1,86 +0,0 @@ - 255], - [['alias'], 'string', 'max' => 50], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'pid' => '父级id', - 'name' => '名称', - 'type' => '类型', - 'own_type' => '拥有者类型', - 'own_id' => '拥有者id', - 'alias' => '别名', - 'path' => '地址', - 'is_delete' => '是否删除,1为已删除', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/Order.php b/common/models/ars/Order.php deleted file mode 100644 index 6f03a52..0000000 --- a/common/models/ars/Order.php +++ /dev/null @@ -1,121 +0,0 @@ - 64], - [['consignee', 'phone'], 'string', 'max' => 20], - [['province', 'city', 'area'], 'string', 'max' => 10], - [['payment_sn'], 'string', 'max' => 120], - [['remarks'], 'string', 'max' => 255], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'user_id' => '用户id', - 'order_sn' => '订单号', - 'invoice_id' => '发票单号', - 'status' => '状态', - 'type' => '类型', - 'goods_count' => '商品数量', - 'goods_amount' => '商品金额', - 'shipping_amount' => '物流金额', - 'shipping_type' => '物流类型', - 'consignee' => '收件人', - 'phone' => '手机号码', - 'province' => '省份', - 'city' => '城市', - 'area' => '区域', - 'taking_site' => '自提点', - 'pay_type' => '支付方式', - 'pay_at' => '支付时间', - 'payment_sn' => '付款单号', - 'payment_amount' => '支付金额', - 'receivables' => '应收款', - 'remarks' => '备注', - 'discount_amount' => '折扣金额', - 'discount_decription' => '折扣说明', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/OrderGoods.php b/common/models/ars/OrderGoods.php deleted file mode 100644 index fa4d65d..0000000 --- a/common/models/ars/OrderGoods.php +++ /dev/null @@ -1,86 +0,0 @@ - 120], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'order_id' => '订单id', - 'goods_id' => '商品id', - 'goods_img' => '商品图片', - 'goods_name' => '商品名称', - 'goods_count' => '商品数量', - 'sku_value' => '商品sku', - 'price' => '销售价', - 'market_price' => '市场价', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/PaymentLog.php b/common/models/ars/PaymentLog.php deleted file mode 100644 index 9055f33..0000000 --- a/common/models/ars/PaymentLog.php +++ /dev/null @@ -1,85 +0,0 @@ - 64], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'order_id' => '订单id', - 'wx_refund_id' => '微信退款单号', - 'mch_id' => '商户号', - 'order_amount' => '订单金额', - 'payment_amount' => '支付金额', - 'type' => '类型', - 'status' => '状态', - 'refund_account' => '退款账户', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/Province.php b/common/models/ars/Province.php deleted file mode 100644 index b03ffe6..0000000 --- a/common/models/ars/Province.php +++ /dev/null @@ -1,49 +0,0 @@ - 16], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => 'name', - 'province_id' => 'province_id', - ]; - } - - -} diff --git a/common/models/ars/RefundLog.php b/common/models/ars/RefundLog.php deleted file mode 100644 index 33ed965..0000000 --- a/common/models/ars/RefundLog.php +++ /dev/null @@ -1,71 +0,0 @@ - 64], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'order_id' => '订单id', - 'wx_refund_id' => '微信退款单号', - 'reason' => '理由', - 'order_amount' => '订单金额', - 'refund_amount' => '退款金额', - 'refunded_amount' => '已退款金额', - 'type' => '类型', - 'status' => '状态', - 'refund_account' => '退款账户', - 'operator_id' => '操作者', - 'applyed_at' => '申请时间', - 'confirmed_at' => '确认时间', - 'finished_at' => '完成时间', - ]; - } - - -} diff --git a/common/models/ars/SearchHistory.php b/common/models/ars/SearchHistory.php deleted file mode 100644 index 17fc86c..0000000 --- a/common/models/ars/SearchHistory.php +++ /dev/null @@ -1,80 +0,0 @@ - 255], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'user_id' => '用户id', - 'keyword' => '关键字', - 'count' => '次数', - 'status' => '状态', - 'type' => '类型', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/TakingSite.php b/common/models/ars/TakingSite.php deleted file mode 100644 index cbd36bd..0000000 --- a/common/models/ars/TakingSite.php +++ /dev/null @@ -1,84 +0,0 @@ - 120], - [['province', 'city', 'area'], 'string', 'max' => 10], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => '名称', - 'province' => '省份', - 'city' => '城市', - 'area' => '区域', - 'address' => '地址', - 'is_default' => '是否为默认,1为默认', - 'updated_at' => '更新时间', - 'created_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/common/models/ars/TemFile.php b/common/models/ars/TemFile.php deleted file mode 100644 index 52c228d..0000000 --- a/common/models/ars/TemFile.php +++ /dev/null @@ -1,80 +0,0 @@ - 255], - [['alias'], 'string', 'max' => 50], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'user_id' => '父级id', - 'name' => '名称', - 'type' => '类型', - 'alias' => '别名', - 'path' => '地址', - 'updated_at' => '更新时间', - 'created_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/vendor/antgoods/goods/src/models/ars/Attribute.php b/vendor/antgoods/goods/src/models/ars/Attribute.php deleted file mode 100644 index c68e652..0000000 --- a/vendor/antgoods/goods/src/models/ars/Attribute.php +++ /dev/null @@ -1,81 +0,0 @@ - 50], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => '属性名', - 'value' => '属性值', - 'type' => '类型', - '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/vendor/antgoods/goods/src/models/ars/Brand.php b/vendor/antgoods/goods/src/models/ars/Brand.php deleted file mode 100644 index a225e59..0000000 --- a/vendor/antgoods/goods/src/models/ars/Brand.php +++ /dev/null @@ -1,74 +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(); - }, - ], - ]; - } -} diff --git a/vendor/antgoods/goods/src/models/ars/Category.php b/vendor/antgoods/goods/src/models/ars/Category.php deleted file mode 100644 index 9fe01df..0000000 --- a/vendor/antgoods/goods/src/models/ars/Category.php +++ /dev/null @@ -1,87 +0,0 @@ - 60], - [['icon'], 'string', 'max' => 64], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => '类别名称', - 'pid' => '父级id', - 'goods_count' => '商品数量', - 'sort_order' => '排序', - 'icon_type' => '图标类型', - 'icon' => '图标', - 'is_show' => '是否显示,1为不显示', - '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/vendor/antgoods/goods/src/models/ars/FilterAttr.php b/vendor/antgoods/goods/src/models/ars/FilterAttr.php deleted file mode 100644 index 2036d55..0000000 --- a/vendor/antgoods/goods/src/models/ars/FilterAttr.php +++ /dev/null @@ -1,78 +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/vendor/antgoods/goods/src/models/ars/Goods.php b/vendor/antgoods/goods/src/models/ars/Goods.php deleted file mode 100644 index 841efc8..0000000 --- a/vendor/antgoods/goods/src/models/ars/Goods.php +++ /dev/null @@ -1,135 +0,0 @@ - 120], - [['sn'], 'string', 'max' => 60], - [['code'], 'string', 'max' => 50], - [['unit'], 'string', 'max' => 16], - [['brief'], 'string', 'max' => 255], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'pid' => '父级id', - 'cat_id' => '后台商品类别id', - 'brand_id' => '品牌id', - 'shop_cat_id' => '前端商品类别id', - 'name' => '商品名称', - 'sn' => '商品唯一货号', - 'code' => '商品货码', - 'supplier_id' => '供应商id', - 'weight' => '重量', - 'length' => '长度', - 'width' => '宽度', - 'height' => '高度', - 'diameter' => '直径', - 'unit' => '单位', - 'sold_count' => '已售数量', - 'limit_count' => '限购数量', - 'stock' => '库存', - 'stock_warn' => '库存警告', - 'market_price' => '市场价', - 'price' => '销售价', - 'brief' => '简介', - 'description' => '详细介绍', - 'image' => '图片id', - 'model_id' => '模型id', - 'is_sale' => '该商品是否开放销售,1为是,0为否', - '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(); - }, - ], - ]; - } -} diff --git a/vendor/antgoods/goods/src/models/ars/GoodsAttr.php b/vendor/antgoods/goods/src/models/ars/GoodsAttr.php deleted file mode 100644 index b888e46..0000000 --- a/vendor/antgoods/goods/src/models/ars/GoodsAttr.php +++ /dev/null @@ -1,78 +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/vendor/antgoods/goods/src/models/ars/GoodsSku.php b/vendor/antgoods/goods/src/models/ars/GoodsSku.php deleted file mode 100644 index 7e4644a..0000000 --- a/vendor/antgoods/goods/src/models/ars/GoodsSku.php +++ /dev/null @@ -1,105 +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' => '属性匹配', - 'weight' => '重量', - 'length' => '长度', - 'width' => '宽度', - 'height' => '高度', - 'diameter' => '直径', - '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/vendor/antgoods/goods/src/models/ars/ShopCategory.php b/vendor/antgoods/goods/src/models/ars/ShopCategory.php deleted file mode 100644 index 2ffb20c..0000000 --- a/vendor/antgoods/goods/src/models/ars/ShopCategory.php +++ /dev/null @@ -1,96 +0,0 @@ - 60], - [['keywords'], 'string', 'max' => 100], - [['desc'], 'string', 'max' => 255], - [['icon'], 'string', 'max' => 64], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => '类别名称', - 'pid' => '父级id', - 'goods_count' => '商品数量', - 'keywords' => '关键字', - 'desc' => '描述', - 'sort_order' => '排序', - 'icon_type' => '图标类型', - 'icon' => '图标', - 'filter_attr' => '筛选属性', - 'is_show' => '是否显示,1为不显示', - '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/vendor/antgoods/goods/src/models/ars/Supplier.php b/vendor/antgoods/goods/src/models/ars/Supplier.php deleted file mode 100644 index 73d51f6..0000000 --- a/vendor/antgoods/goods/src/models/ars/Supplier.php +++ /dev/null @@ -1,81 +0,0 @@ - 50], - [['phone'], 'string', 'max' => 20], - ]; - } - - /** - * {@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(); - }, - ], - ]; - } -} From b675ebbe8d0c45db8fd6e7976c2b1a173b662a2a Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 15:34:57 +0800 Subject: [PATCH 033/102] =?UTF-8?q?antgoods=E5=A2=9E=E5=8A=A0goods?= =?UTF-8?q?=E7=9A=84crud=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/config/main.php | 6 +- common/models/ars/Address.php | 88 ++++++++ common/models/ars/AfterSale.php | 80 +++++++ common/models/ars/Area.php | 51 +++++ common/models/ars/Cart.php | 84 ++++++++ common/models/ars/City.php | 51 +++++ common/models/ars/Collection.php | 73 +++++++ common/models/ars/Comment.php | 80 +++++++ common/models/ars/Delivery.php | 86 ++++++++ common/models/ars/ExpressTemplate.php | 95 +++++++++ common/models/ars/File.php | 86 ++++++++ common/models/ars/Order.php | 121 +++++++++++ common/models/ars/OrderGoods.php | 86 ++++++++ common/models/ars/PaymentLog.php | 85 ++++++++ common/models/ars/Province.php | 49 +++++ common/models/ars/RefundLog.php | 71 +++++++ common/models/ars/SearchHistory.php | 80 +++++++ common/models/ars/TakingSite.php | 84 ++++++++ common/models/ars/TemFile.php | 80 +++++++ .../goods/src/controllers/GoodsController.php | 149 +++++++++++++ .../goods/src/models/ars/Attribute.php | 81 +++++++ .../antgoods/goods/src/models/ars/Brand.php | 74 +++++++ .../goods/src/models/ars/Category.php | 87 ++++++++ .../goods/src/models/ars/FilterAttr.php | 78 +++++++ .../antgoods/goods/src/models/ars/Goods.php | 135 ++++++++++++ .../goods/src/models/ars/GoodsAttr.php | 78 +++++++ .../goods/src/models/ars/GoodsSku.php | 105 ++++++++++ .../goods/src/models/ars/ShopCategory.php | 96 +++++++++ .../goods/src/models/ars/Supplier.php | 81 +++++++ .../goods/src/models/searchs/GoodsSearch.php | 197 ++++++++++++++++++ .../antgoods/goods/src/views/goods/_form.php | 82 ++++++++ .../goods/src/views/goods/_search.php | 49 +++++ .../antgoods/goods/src/views/goods/create.php | 18 ++ .../antgoods/goods/src/views/goods/index.php | 28 +++ .../antgoods/goods/src/views/goods/update.php | 19 ++ .../antgoods/goods/src/views/goods/view.php | 59 ++++++ 36 files changed, 2851 insertions(+), 1 deletion(-) create mode 100644 common/models/ars/Address.php create mode 100644 common/models/ars/AfterSale.php create mode 100644 common/models/ars/Area.php create mode 100644 common/models/ars/Cart.php create mode 100644 common/models/ars/City.php create mode 100644 common/models/ars/Collection.php create mode 100644 common/models/ars/Comment.php create mode 100644 common/models/ars/Delivery.php create mode 100644 common/models/ars/ExpressTemplate.php create mode 100644 common/models/ars/File.php create mode 100644 common/models/ars/Order.php create mode 100644 common/models/ars/OrderGoods.php create mode 100644 common/models/ars/PaymentLog.php create mode 100644 common/models/ars/Province.php create mode 100644 common/models/ars/RefundLog.php create mode 100644 common/models/ars/SearchHistory.php create mode 100644 common/models/ars/TakingSite.php create mode 100644 common/models/ars/TemFile.php create mode 100644 vendor/antgoods/goods/src/controllers/GoodsController.php create mode 100644 vendor/antgoods/goods/src/models/ars/Attribute.php create mode 100644 vendor/antgoods/goods/src/models/ars/Brand.php create mode 100644 vendor/antgoods/goods/src/models/ars/Category.php create mode 100644 vendor/antgoods/goods/src/models/ars/FilterAttr.php create mode 100644 vendor/antgoods/goods/src/models/ars/Goods.php create mode 100644 vendor/antgoods/goods/src/models/ars/GoodsAttr.php create mode 100644 vendor/antgoods/goods/src/models/ars/GoodsSku.php create mode 100644 vendor/antgoods/goods/src/models/ars/ShopCategory.php create mode 100644 vendor/antgoods/goods/src/models/ars/Supplier.php create mode 100644 vendor/antgoods/goods/src/models/searchs/GoodsSearch.php create mode 100644 vendor/antgoods/goods/src/views/goods/_form.php create mode 100644 vendor/antgoods/goods/src/views/goods/_search.php create mode 100644 vendor/antgoods/goods/src/views/goods/create.php create mode 100644 vendor/antgoods/goods/src/views/goods/index.php create mode 100644 vendor/antgoods/goods/src/views/goods/update.php create mode 100644 vendor/antgoods/goods/src/views/goods/view.php diff --git a/backend/config/main.php b/backend/config/main.php index 272465d..ec8c2c0 100644 --- a/backend/config/main.php +++ b/backend/config/main.php @@ -9,7 +9,11 @@ return [ 'basePath' => dirname(__DIR__), 'controllerNamespace' => 'backend\controllers', 'bootstrap' => ['log'], - 'modules' => [], + 'modules' => [ + 'antgoods' => [ + 'class' => 'antgoods\goods\Module', + ], + ], 'components' => [ 'request' => [ 'csrfParam' => '_csrf-backend', diff --git a/common/models/ars/Address.php b/common/models/ars/Address.php new file mode 100644 index 0000000..aec13fb --- /dev/null +++ b/common/models/ars/Address.php @@ -0,0 +1,88 @@ + 20], + [['province', 'city', 'area'], 'string', 'max' => 10], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'user_id' => '用户id', + 'consignee' => '收件人', + 'phone' => '电话', + 'province' => '省份', + 'city' => '城市', + 'area' => '区域', + 'address' => '详细地址', + 'status' => '状态,0-默认值 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/common/models/ars/AfterSale.php b/common/models/ars/AfterSale.php new file mode 100644 index 0000000..4cf35b1 --- /dev/null +++ b/common/models/ars/AfterSale.php @@ -0,0 +1,80 @@ + 64], + [['take_shipping_sn', 'send_shipping_sn'], 'string', 'max' => 50], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'operator_id' => '操作者', + 'user_id' => '用户id', + 'wx_refund_id' => '微信退款单号', + 'after_sale_sn' => '售后单号', + 'order_goods_id' => '订单商品id', + 'count' => '退换货的商品数量', + 'amount' => '退货时实际退的金额', + 'type' => '类型', + 'reason' => '退换货理由', + 'description' => '描述', + 'take_shipping_sn' => '用户发货物流单号', + 'send_shipping_sn' => '换货商家发货的物流单号', + 'remarks' => '店家备注', + 'applyed_at' => '申请时间', + 'dealed_at' => '处理时间', + 'finished_at' => '完成时间', + ]; + } + + +} diff --git a/common/models/ars/Area.php b/common/models/ars/Area.php new file mode 100644 index 0000000..254681b --- /dev/null +++ b/common/models/ars/Area.php @@ -0,0 +1,51 @@ + 32], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => 'name', + 'area_id' => 'area_id', + 'city_id' => 'city_id', + ]; + } + + +} diff --git a/common/models/ars/Cart.php b/common/models/ars/Cart.php new file mode 100644 index 0000000..ef6477f --- /dev/null +++ b/common/models/ars/Cart.php @@ -0,0 +1,84 @@ + 120], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'user_id' => '用户id', + 'goods_id' => '商品id', + 'goods_name' => '商品名称', + 'goods_img' => '商品图片', + 'goods_price' => '商品售价', + 'sku_id' => '商品sku的id', + 'goods_count' => '商品数量', + '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/common/models/ars/City.php b/common/models/ars/City.php new file mode 100644 index 0000000..ae87412 --- /dev/null +++ b/common/models/ars/City.php @@ -0,0 +1,51 @@ + 32], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'city_id' => 'city_id', + 'name' => 'name', + 'province_id' => 'province_id', + ]; + } + + +} diff --git a/common/models/ars/Collection.php b/common/models/ars/Collection.php new file mode 100644 index 0000000..2a1a771 --- /dev/null +++ b/common/models/ars/Collection.php @@ -0,0 +1,73 @@ + 'id', + 'user_id' => '用户id', + 'goods_id' => '商品id', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/Comment.php b/common/models/ars/Comment.php new file mode 100644 index 0000000..2701ecf --- /dev/null +++ b/common/models/ars/Comment.php @@ -0,0 +1,80 @@ + 'id', + 'user_id' => '用户id', + 'order_goods_id' => '订单详情商品id', + 'star' => '星级', + 'content' => '评论内容', + 'status' => '状态:1为显示,0为不显示', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/Delivery.php b/common/models/ars/Delivery.php new file mode 100644 index 0000000..85d1d0e --- /dev/null +++ b/common/models/ars/Delivery.php @@ -0,0 +1,86 @@ + 50], + [['shipping_id'], 'string', 'max' => 10], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'order_id' => '订单id', + 'shipping_name' => '货流名称', + 'shipping_id' => '运货单位', + 'type' => '类型', + 'goods' => '商品', + 'status' => '状态', + 'decription' => '描述', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/ExpressTemplate.php b/common/models/ars/ExpressTemplate.php new file mode 100644 index 0000000..e3e6b81 --- /dev/null +++ b/common/models/ars/ExpressTemplate.php @@ -0,0 +1,95 @@ + 255], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => '名称', + 'province' => '省份', + 'city' => '城市', + 'area' => '区域', + 'billing_type' => '账单类型', + 'extra_weight_type' => '续重重量类型', + 'exemption_type' => '包邮类型', + 'basic_price' => '基本运费', + 'extra_price' => '续重运费', + 'exemption_amount' => '包邮金额', + 'support_taking' => '是否支持自提,1为不支持', + 'taking_site' => '自提地点', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/File.php b/common/models/ars/File.php new file mode 100644 index 0000000..fc1be27 --- /dev/null +++ b/common/models/ars/File.php @@ -0,0 +1,86 @@ + 255], + [['alias'], 'string', 'max' => 50], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'pid' => '父级id', + 'name' => '名称', + 'type' => '类型', + 'own_type' => '拥有者类型', + 'own_id' => '拥有者id', + 'alias' => '别名', + 'path' => '地址', + 'is_delete' => '是否删除,1为已删除', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/Order.php b/common/models/ars/Order.php new file mode 100644 index 0000000..6f03a52 --- /dev/null +++ b/common/models/ars/Order.php @@ -0,0 +1,121 @@ + 64], + [['consignee', 'phone'], 'string', 'max' => 20], + [['province', 'city', 'area'], 'string', 'max' => 10], + [['payment_sn'], 'string', 'max' => 120], + [['remarks'], 'string', 'max' => 255], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'user_id' => '用户id', + 'order_sn' => '订单号', + 'invoice_id' => '发票单号', + 'status' => '状态', + 'type' => '类型', + 'goods_count' => '商品数量', + 'goods_amount' => '商品金额', + 'shipping_amount' => '物流金额', + 'shipping_type' => '物流类型', + 'consignee' => '收件人', + 'phone' => '手机号码', + 'province' => '省份', + 'city' => '城市', + 'area' => '区域', + 'taking_site' => '自提点', + 'pay_type' => '支付方式', + 'pay_at' => '支付时间', + 'payment_sn' => '付款单号', + 'payment_amount' => '支付金额', + 'receivables' => '应收款', + 'remarks' => '备注', + 'discount_amount' => '折扣金额', + 'discount_decription' => '折扣说明', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/OrderGoods.php b/common/models/ars/OrderGoods.php new file mode 100644 index 0000000..fa4d65d --- /dev/null +++ b/common/models/ars/OrderGoods.php @@ -0,0 +1,86 @@ + 120], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'order_id' => '订单id', + 'goods_id' => '商品id', + 'goods_img' => '商品图片', + 'goods_name' => '商品名称', + 'goods_count' => '商品数量', + 'sku_value' => '商品sku', + 'price' => '销售价', + 'market_price' => '市场价', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/PaymentLog.php b/common/models/ars/PaymentLog.php new file mode 100644 index 0000000..9055f33 --- /dev/null +++ b/common/models/ars/PaymentLog.php @@ -0,0 +1,85 @@ + 64], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'order_id' => '订单id', + 'wx_refund_id' => '微信退款单号', + 'mch_id' => '商户号', + 'order_amount' => '订单金额', + 'payment_amount' => '支付金额', + 'type' => '类型', + 'status' => '状态', + 'refund_account' => '退款账户', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/Province.php b/common/models/ars/Province.php new file mode 100644 index 0000000..b03ffe6 --- /dev/null +++ b/common/models/ars/Province.php @@ -0,0 +1,49 @@ + 16], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => 'name', + 'province_id' => 'province_id', + ]; + } + + +} diff --git a/common/models/ars/RefundLog.php b/common/models/ars/RefundLog.php new file mode 100644 index 0000000..33ed965 --- /dev/null +++ b/common/models/ars/RefundLog.php @@ -0,0 +1,71 @@ + 64], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'order_id' => '订单id', + 'wx_refund_id' => '微信退款单号', + 'reason' => '理由', + 'order_amount' => '订单金额', + 'refund_amount' => '退款金额', + 'refunded_amount' => '已退款金额', + 'type' => '类型', + 'status' => '状态', + 'refund_account' => '退款账户', + 'operator_id' => '操作者', + 'applyed_at' => '申请时间', + 'confirmed_at' => '确认时间', + 'finished_at' => '完成时间', + ]; + } + + +} diff --git a/common/models/ars/SearchHistory.php b/common/models/ars/SearchHistory.php new file mode 100644 index 0000000..17fc86c --- /dev/null +++ b/common/models/ars/SearchHistory.php @@ -0,0 +1,80 @@ + 255], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'user_id' => '用户id', + 'keyword' => '关键字', + 'count' => '次数', + 'status' => '状态', + 'type' => '类型', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/TakingSite.php b/common/models/ars/TakingSite.php new file mode 100644 index 0000000..cbd36bd --- /dev/null +++ b/common/models/ars/TakingSite.php @@ -0,0 +1,84 @@ + 120], + [['province', 'city', 'area'], 'string', 'max' => 10], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => '名称', + 'province' => '省份', + 'city' => '城市', + 'area' => '区域', + 'address' => '地址', + 'is_default' => '是否为默认,1为默认', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/TemFile.php b/common/models/ars/TemFile.php new file mode 100644 index 0000000..52c228d --- /dev/null +++ b/common/models/ars/TemFile.php @@ -0,0 +1,80 @@ + 255], + [['alias'], 'string', 'max' => 50], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'user_id' => '父级id', + 'name' => '名称', + 'type' => '类型', + 'alias' => '别名', + 'path' => '地址', + 'updated_at' => '更新时间', + 'created_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/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php new file mode 100644 index 0000000..7180f54 --- /dev/null +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -0,0 +1,149 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + /** + * Lists all Goods models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new GoodsSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + 'columns' => $searchModel->columns() + ]); + } + + /** + * Displays a single Goods model. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new Goods model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Goods(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect('index'); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + /** + * Updates an existing Goods model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect('index'); + } + + return $this->render('update', [ + 'model' => $model, + ]); + } + + /** + * Deletes an existing Goods model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + /** + * Finds the Goods model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return Goods the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = Goods::findOne($id)) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } + /** + * @author iron + * 文件导出 + */ + public function actionExport() + { + $searchModel = new GoodsSearch(); + $params = Yii::$app->request->queryParams; + if ($params['page-type'] == 'all') { + $dataProvider = $searchModel->allData($params); + } else { + $dataProvider = $searchModel->search($params); + } + \iron\widget\Excel::export([ + 'models' => $dataProvider->getModels(), + 'format' => 'Xlsx', + 'asAttachment' => true, + 'fileName' =>'Goods'. "-" .date('Y-m-d H/i/s', time()), + 'columns' => $searchModel->columns() + ]); + } +} diff --git a/vendor/antgoods/goods/src/models/ars/Attribute.php b/vendor/antgoods/goods/src/models/ars/Attribute.php new file mode 100644 index 0000000..c68e652 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/Attribute.php @@ -0,0 +1,81 @@ + 50], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => '属性名', + 'value' => '属性值', + 'type' => '类型', + '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/vendor/antgoods/goods/src/models/ars/Brand.php b/vendor/antgoods/goods/src/models/ars/Brand.php new file mode 100644 index 0000000..a225e59 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/Brand.php @@ -0,0 +1,74 @@ + 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(); + }, + ], + ]; + } +} diff --git a/vendor/antgoods/goods/src/models/ars/Category.php b/vendor/antgoods/goods/src/models/ars/Category.php new file mode 100644 index 0000000..9fe01df --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/Category.php @@ -0,0 +1,87 @@ + 60], + [['icon'], 'string', 'max' => 64], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => '类别名称', + 'pid' => '父级id', + 'goods_count' => '商品数量', + 'sort_order' => '排序', + 'icon_type' => '图标类型', + 'icon' => '图标', + 'is_show' => '是否显示,1为不显示', + '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/vendor/antgoods/goods/src/models/ars/FilterAttr.php b/vendor/antgoods/goods/src/models/ars/FilterAttr.php new file mode 100644 index 0000000..2036d55 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/FilterAttr.php @@ -0,0 +1,78 @@ + 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/vendor/antgoods/goods/src/models/ars/Goods.php b/vendor/antgoods/goods/src/models/ars/Goods.php new file mode 100644 index 0000000..841efc8 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/Goods.php @@ -0,0 +1,135 @@ + 120], + [['sn'], 'string', 'max' => 60], + [['code'], 'string', 'max' => 50], + [['unit'], 'string', 'max' => 16], + [['brief'], 'string', 'max' => 255], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'pid' => '父级id', + 'cat_id' => '后台商品类别id', + 'brand_id' => '品牌id', + 'shop_cat_id' => '前端商品类别id', + 'name' => '商品名称', + 'sn' => '商品唯一货号', + 'code' => '商品货码', + 'supplier_id' => '供应商id', + 'weight' => '重量', + 'length' => '长度', + 'width' => '宽度', + 'height' => '高度', + 'diameter' => '直径', + 'unit' => '单位', + 'sold_count' => '已售数量', + 'limit_count' => '限购数量', + 'stock' => '库存', + 'stock_warn' => '库存警告', + 'market_price' => '市场价', + 'price' => '销售价', + 'brief' => '简介', + 'description' => '详细介绍', + 'image' => '图片id', + 'model_id' => '模型id', + 'is_sale' => '该商品是否开放销售,1为是,0为否', + '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(); + }, + ], + ]; + } +} diff --git a/vendor/antgoods/goods/src/models/ars/GoodsAttr.php b/vendor/antgoods/goods/src/models/ars/GoodsAttr.php new file mode 100644 index 0000000..b888e46 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/GoodsAttr.php @@ -0,0 +1,78 @@ + 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/vendor/antgoods/goods/src/models/ars/GoodsSku.php b/vendor/antgoods/goods/src/models/ars/GoodsSku.php new file mode 100644 index 0000000..7e4644a --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/GoodsSku.php @@ -0,0 +1,105 @@ + 50], + [['goods_sn', 'goods_attr'], 'string', 'max' => 60], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'goods_id' => '商品id', + 'goods_code' => '商品条码', + 'goods_sn' => '商品唯一货号', + 'goods_attr' => '属性匹配', + 'weight' => '重量', + 'length' => '长度', + 'width' => '宽度', + 'height' => '高度', + 'diameter' => '直径', + '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/vendor/antgoods/goods/src/models/ars/ShopCategory.php b/vendor/antgoods/goods/src/models/ars/ShopCategory.php new file mode 100644 index 0000000..2ffb20c --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/ShopCategory.php @@ -0,0 +1,96 @@ + 60], + [['keywords'], 'string', 'max' => 100], + [['desc'], 'string', 'max' => 255], + [['icon'], 'string', 'max' => 64], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => '类别名称', + 'pid' => '父级id', + 'goods_count' => '商品数量', + 'keywords' => '关键字', + 'desc' => '描述', + 'sort_order' => '排序', + 'icon_type' => '图标类型', + 'icon' => '图标', + 'filter_attr' => '筛选属性', + 'is_show' => '是否显示,1为不显示', + '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/vendor/antgoods/goods/src/models/ars/Supplier.php b/vendor/antgoods/goods/src/models/ars/Supplier.php new file mode 100644 index 0000000..73d51f6 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/Supplier.php @@ -0,0 +1,81 @@ + 50], + [['phone'], 'string', 'max' => 20], + ]; + } + + /** + * {@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(); + }, + ], + ]; + } +} diff --git a/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php b/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php new file mode 100644 index 0000000..738cbf2 --- /dev/null +++ b/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php @@ -0,0 +1,197 @@ + 'blobt\grid\CheckboxColumn', + 'width' => '2%', + 'align' => 'center' + ], + 'id', + 'pid', + 'cat_id', + 'brand_id', + 'shop_cat_id', + //'name', + //'sn', + //'code', + //'supplier_id', + //'weight', + //'length', + //'width', + //'height', + //'diameter', + //'unit', + //'sold_count', + //'limit_count', + //'stock', + //'stock_warn', + //'market_price', + //'price', + //'brief', + //'description', + //'image', + //'model_id', + //'is_sale', + //'sort_order', + //'bouns_points', + //'experience_points', + //'is_delete', + //'express_template', + //'created_at', + //'updated_at', + [ + 'class' => 'iron\grid\ActionColumn', + 'align' => 'center', + ], + ]; + } + /** + * @param $params + * @return ActiveDataProvider + * 不分页的所有数据 + */ + public function allData($params) + { + $query = Goods::find(); + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'pagination' => false, + 'sort' => false + ]); + $this->load($params); + return $this->filter($query, $dataProvider); + } + + /** + * Creates data provider instance with search query applied + * + * @param array $params + * + * @return ActiveDataProvider + */ + public function search($params) + { + $query = Goods::find(); + + // add conditions that should always apply here + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'pagination' => [ + 'pageSizeLimit' => [1, 200] + ], + 'sort' => [ + 'defaultOrder' => [ + 'id' => SORT_DESC, + ] + ], + ]); + + $this->load($params); + return $this->filter($query, $dataProvider); + } + /** + * @param $query + * @param $dataProvider + * @return ActiveDataProvider + * 条件筛选 + */ + private function filter($query, $dataProvider){ + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'id' => $this->id, + 'pid' => $this->pid, + 'cat_id' => $this->cat_id, + 'brand_id' => $this->brand_id, + 'shop_cat_id' => $this->shop_cat_id, + 'supplier_id' => $this->supplier_id, + 'weight' => $this->weight, + 'length' => $this->length, + 'width' => $this->width, + 'height' => $this->height, + 'diameter' => $this->diameter, + 'sold_count' => $this->sold_count, + 'limit_count' => $this->limit_count, + 'stock' => $this->stock, + 'stock_warn' => $this->stock_warn, + 'market_price' => $this->market_price, + 'price' => $this->price, + 'image' => $this->image, + 'model_id' => $this->model_id, + 'is_sale' => $this->is_sale, + 'sort_order' => $this->sort_order, + 'bouns_points' => $this->bouns_points, + 'experience_points' => $this->experience_points, + 'is_delete' => $this->is_delete, + 'express_template' => $this->express_template, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + ]); + + $query->andFilterWhere(['like', 'name', $this->name]) + ->andFilterWhere(['like', 'sn', $this->sn]) + ->andFilterWhere(['like', 'code', $this->code]) + ->andFilterWhere(['like', 'unit', $this->unit]) + ->andFilterWhere(['like', 'brief', $this->brief]) + ->andFilterWhere(['like', 'description', $this->description]); + if ($this->created_at_range) { + $arr = explode(' ~ ', $this->created_at_range); + $start = strtotime($arr[0]); + $end = strtotime($arr[1]) + 3600 * 24; + $query->andFilterWhere(['between', 'created_at', $start, $end]); + } + return $dataProvider; + } +} diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php new file mode 100644 index 0000000..5956348 --- /dev/null +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -0,0 +1,82 @@ + + +
+ + + + field($model, 'pid')->textInput() ?> + + field($model, 'cat_id')->textInput() ?> + + field($model, 'brand_id')->textInput() ?> + + field($model, 'shop_cat_id')->textInput() ?> + + field($model, 'name')->textInput(['maxlength' => true]) ?> + + field($model, 'sn')->textInput(['maxlength' => true]) ?> + + field($model, 'code')->textInput(['maxlength' => true]) ?> + + field($model, 'supplier_id')->textInput() ?> + + field($model, 'weight')->textInput() ?> + + field($model, 'length')->textInput() ?> + + field($model, 'width')->textInput() ?> + + field($model, 'height')->textInput() ?> + + field($model, 'diameter')->textInput() ?> + + field($model, 'unit')->textInput(['maxlength' => true]) ?> + + field($model, 'sold_count')->textInput() ?> + + field($model, 'limit_count')->textInput() ?> + + field($model, 'stock')->textInput() ?> + + field($model, 'stock_warn')->textInput() ?> + + field($model, 'market_price')->textInput() ?> + + field($model, 'price')->textInput() ?> + + field($model, 'brief')->textInput(['maxlength' => true]) ?> + + field($model, 'description')->textarea(['rows' => 6]) ?> + + field($model, 'image')->textInput() ?> + + field($model, 'model_id')->textInput() ?> + + field($model, 'is_sale')->textInput() ?> + + field($model, 'sort_order')->textInput() ?> + + field($model, 'bouns_points')->textInput() ?> + + field($model, 'experience_points')->textInput() ?> + + field($model, 'is_delete')->textInput() ?> + + field($model, 'express_template')->textInput() ?> + +
+ 'btn btn-success']) ?> + 'btn btn-info']) ?> +
+ + + +
diff --git a/vendor/antgoods/goods/src/views/goods/_search.php b/vendor/antgoods/goods/src/views/goods/_search.php new file mode 100644 index 0000000..9a86777 --- /dev/null +++ b/vendor/antgoods/goods/src/views/goods/_search.php @@ -0,0 +1,49 @@ + + + ['index'], + 'method' => 'get', + 'validateOnType' => true, + ]); +?> +
+
+ field($model, 'id', [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "检索ID", + "class" => "form-control", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ]) + ?> +
+
+ field($model, "created_at_range", [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "创建时间", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ])->widget(DateRangePicker::className()); + ?> +
+
+ ', ['class' => 'btn btn-default']) ?> + ', ['class' => 'btn btn-default']) ?> +
+
+ \ No newline at end of file diff --git a/vendor/antgoods/goods/src/views/goods/create.php b/vendor/antgoods/goods/src/views/goods/create.php new file mode 100644 index 0000000..4f1d258 --- /dev/null +++ b/vendor/antgoods/goods/src/views/goods/create.php @@ -0,0 +1,18 @@ +title = '创建 Goods'; +$this->params['breadcrumbs'][] = ['label' => 'Goods', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/vendor/antgoods/goods/src/views/goods/index.php b/vendor/antgoods/goods/src/views/goods/index.php new file mode 100644 index 0000000..82c38b2 --- /dev/null +++ b/vendor/antgoods/goods/src/views/goods/index.php @@ -0,0 +1,28 @@ +title = 'Goods'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+
+ $dataProvider, + 'filter' => $this->render("_search", ['model' => $searchModel]), + 'batch' => [ + [ + "label" => "删除", + "url" => "goods/deletes" + ], + ], + 'columns' => $columns + ]); + ?> +
+
\ No newline at end of file diff --git a/vendor/antgoods/goods/src/views/goods/update.php b/vendor/antgoods/goods/src/views/goods/update.php new file mode 100644 index 0000000..9689d6d --- /dev/null +++ b/vendor/antgoods/goods/src/views/goods/update.php @@ -0,0 +1,19 @@ +title = '编辑 Goods: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Goods', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; +$this->params['breadcrumbs'][] = 'Update '; +?> +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/vendor/antgoods/goods/src/views/goods/view.php b/vendor/antgoods/goods/src/views/goods/view.php new file mode 100644 index 0000000..27f0963 --- /dev/null +++ b/vendor/antgoods/goods/src/views/goods/view.php @@ -0,0 +1,59 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Goods', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> +
+ +

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

+ + $model, + 'attributes' => [ + 'id', + 'pid', + 'cat_id', + 'brand_id', + 'shop_cat_id', + 'name', + 'sn', + 'code', + 'supplier_id', + 'weight', + 'length', + 'width', + 'height', + 'diameter', + 'unit', + 'sold_count', + 'limit_count', + 'stock', + 'stock_warn', + 'market_price', + 'price', + 'brief', + 'description:ntext', + 'image', + 'model_id', + 'is_sale', + 'sort_order', + 'bouns_points', + 'experience_points', + 'is_delete', + 'express_template', + 'created_at', + 'updated_at', + ], + ]) ?> + +
From 04d4f5c79c5a1e3fe840bf6bcbf17c09a2b9f819 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 19:22:38 +0800 Subject: [PATCH 034/102] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=9B=A0=E4=B8=BA?= =?UTF-8?q?=E5=B0=91=E4=BA=86/=EF=BC=8C=E5=AF=BC=E8=87=B4menu=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E8=B7=AF=E7=94=B1=E6=B7=B7=E4=B9=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/views/layouts/sidebar.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/views/layouts/sidebar.php b/backend/views/layouts/sidebar.php index 0277d3d..720c666 100755 --- a/backend/views/layouts/sidebar.php +++ b/backend/views/layouts/sidebar.php @@ -21,11 +21,12 @@ use iron\widgets\Menu; ] ], ['label' => '商品管理', 'url' => '#', 'icon' => 'far fa-archive', 'items' => [ - ['label' => '商品列表', 'url' => ['antgoods/goods/index']], + ['label' => '商品列表', 'url' => ['/antgoods/goods/index']], + ['label' => '商品分类', 'url' => ['/antgoods/category/index']], ] ], ['label' => '订单管理', 'url' => '#', 'icon' => 'far fa-list-alt', 'items' => [ - ['label' => '订单列表', 'url' => ['order/index', 'tag' => 'new']], + ['label' => '订单列表', 'url' => ['/order/index', 'tag' => 'new']], ] ], From 14e4996136edbe3a4c9d9db7dddef37dfeef971c Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 19:25:29 +0800 Subject: [PATCH 035/102] =?UTF-8?q?antgoods=E5=A2=9E=E5=8A=A0=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=88=86=E7=B1=BB=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/controllers/CategoryController.php | 149 +++++++++++++++++ .../src/models/searchs/CategorySearch.php | 153 ++++++++++++++++++ .../goods/src/views/category/_form.php | 38 +++++ .../goods/src/views/category/_search.php | 49 ++++++ .../goods/src/views/category/create.php | 18 +++ .../goods/src/views/category/index.php | 28 ++++ .../goods/src/views/category/update.php | 19 +++ .../goods/src/views/category/view.php | 37 +++++ 8 files changed, 491 insertions(+) create mode 100644 vendor/antgoods/goods/src/controllers/CategoryController.php create mode 100644 vendor/antgoods/goods/src/models/searchs/CategorySearch.php create mode 100644 vendor/antgoods/goods/src/views/category/_form.php create mode 100644 vendor/antgoods/goods/src/views/category/_search.php create mode 100644 vendor/antgoods/goods/src/views/category/create.php create mode 100644 vendor/antgoods/goods/src/views/category/index.php create mode 100644 vendor/antgoods/goods/src/views/category/update.php create mode 100644 vendor/antgoods/goods/src/views/category/view.php diff --git a/vendor/antgoods/goods/src/controllers/CategoryController.php b/vendor/antgoods/goods/src/controllers/CategoryController.php new file mode 100644 index 0000000..64017dc --- /dev/null +++ b/vendor/antgoods/goods/src/controllers/CategoryController.php @@ -0,0 +1,149 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + /** + * Lists all Category models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new CategorySearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + 'columns' => $searchModel->columns() + ]); + } + + /** + * Displays a single Category model. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new Category model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Category(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect('index'); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + /** + * Updates an existing Category model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect('index'); + } + + return $this->render('update', [ + 'model' => $model, + ]); + } + + /** + * Deletes an existing Category model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + /** + * Finds the Category model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return Category the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = Category::findOne($id)) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } + /** + * @author iron + * 文件导出 + */ + public function actionExport() + { + $searchModel = new CategorySearch(); + $params = Yii::$app->request->queryParams; + if ($params['page-type'] == 'all') { + $dataProvider = $searchModel->allData($params); + } else { + $dataProvider = $searchModel->search($params); + } + \iron\widget\Excel::export([ + 'models' => $dataProvider->getModels(), + 'format' => 'Xlsx', + 'asAttachment' => true, + 'fileName' =>'Categories'. "-" .date('Y-m-d H/i/s', time()), + 'columns' => $searchModel->columns() + ]); + } +} diff --git a/vendor/antgoods/goods/src/models/searchs/CategorySearch.php b/vendor/antgoods/goods/src/models/searchs/CategorySearch.php new file mode 100644 index 0000000..63ad3f0 --- /dev/null +++ b/vendor/antgoods/goods/src/models/searchs/CategorySearch.php @@ -0,0 +1,153 @@ + 'blobt\grid\CheckboxColumn', + 'width' => '2%', + 'align' => 'center' + ], + 'id', + 'name', + 'pid', + 'goods_count', + 'sort_order', + //'icon_type', + //'icon', + //'is_show', + //'is_delete', + //'created_at', + //'updated_at', + [ + 'class' => 'iron\grid\ActionColumn', + 'align' => 'center', + ], + ]; + } + /** + * @param $params + * @return ActiveDataProvider + * 不分页的所有数据 + */ + public function allData($params) + { + $query = Category::find(); + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'pagination' => false, + 'sort' => false + ]); + $this->load($params); + return $this->filter($query, $dataProvider); + } + + /** + * Creates data provider instance with search query applied + * + * @param array $params + * + * @return ActiveDataProvider + */ + public function search($params) + { + $query = Category::find(); + + // add conditions that should always apply here + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'pagination' => [ + 'pageSizeLimit' => [1, 200] + ], + 'sort' => [ + 'defaultOrder' => [ + 'id' => SORT_DESC, + ] + ], + ]); + + $this->load($params); + return $this->filter($query, $dataProvider); + } + /** + * @param $query + * @param $dataProvider + * @return ActiveDataProvider + * 条件筛选 + */ + private function filter($query, $dataProvider){ + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'id' => $this->id, + 'pid' => $this->pid, + 'goods_count' => $this->goods_count, + 'sort_order' => $this->sort_order, + 'icon_type' => $this->icon_type, + 'is_show' => $this->is_show, + 'is_delete' => $this->is_delete, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + ]); + + $query->andFilterWhere(['like', 'name', $this->name]) + ->andFilterWhere(['like', 'icon', $this->icon]); + if ($this->created_at_range) { + $arr = explode(' ~ ', $this->created_at_range); + $start = strtotime($arr[0]); + $end = strtotime($arr[1]) + 3600 * 24; + $query->andFilterWhere(['between', 'created_at', $start, $end]); + } + return $dataProvider; + } +} diff --git a/vendor/antgoods/goods/src/views/category/_form.php b/vendor/antgoods/goods/src/views/category/_form.php new file mode 100644 index 0000000..c2fe65f --- /dev/null +++ b/vendor/antgoods/goods/src/views/category/_form.php @@ -0,0 +1,38 @@ + + +
+ + + + field($model, 'name')->textInput(['maxlength' => true]) ?> + + field($model, 'pid')->textInput() ?> + + field($model, 'goods_count')->textInput() ?> + + field($model, 'sort_order')->textInput() ?> + + field($model, 'icon_type')->textInput() ?> + + field($model, 'icon')->textInput(['maxlength' => true]) ?> + + field($model, 'is_show')->textInput() ?> + + field($model, 'is_delete')->textInput() ?> + +
+ 'btn btn-success']) ?> + 'btn btn-info']) ?> +
+ + + +
diff --git a/vendor/antgoods/goods/src/views/category/_search.php b/vendor/antgoods/goods/src/views/category/_search.php new file mode 100644 index 0000000..d43cb1d --- /dev/null +++ b/vendor/antgoods/goods/src/views/category/_search.php @@ -0,0 +1,49 @@ + + + ['index'], + 'method' => 'get', + 'validateOnType' => true, + ]); +?> +
+
+ field($model, 'id', [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "检索ID", + "class" => "form-control", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ]) + ?> +
+
+ field($model, "created_at_range", [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "创建时间", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ])->widget(DateRangePicker::className()); + ?> +
+
+ ', ['class' => 'btn btn-default']) ?> + ', ['class' => 'btn btn-default']) ?> +
+
+ \ No newline at end of file diff --git a/vendor/antgoods/goods/src/views/category/create.php b/vendor/antgoods/goods/src/views/category/create.php new file mode 100644 index 0000000..1ecb4fa --- /dev/null +++ b/vendor/antgoods/goods/src/views/category/create.php @@ -0,0 +1,18 @@ +title = '创建 Category'; +$this->params['breadcrumbs'][] = ['label' => 'Categories', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/vendor/antgoods/goods/src/views/category/index.php b/vendor/antgoods/goods/src/views/category/index.php new file mode 100644 index 0000000..b63d020 --- /dev/null +++ b/vendor/antgoods/goods/src/views/category/index.php @@ -0,0 +1,28 @@ +title = '商品分类'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+
+ $dataProvider, + 'filter' => $this->render("_search", ['model' => $searchModel]), + 'batch' => [ + [ + "label" => "删除", + "url" => "category/deletes" + ], + ], + 'columns' => $columns + ]); + ?> +
+
\ No newline at end of file diff --git a/vendor/antgoods/goods/src/views/category/update.php b/vendor/antgoods/goods/src/views/category/update.php new file mode 100644 index 0000000..a4a8106 --- /dev/null +++ b/vendor/antgoods/goods/src/views/category/update.php @@ -0,0 +1,19 @@ +title = '编辑 Category: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Categories', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; +$this->params['breadcrumbs'][] = 'Update '; +?> +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/vendor/antgoods/goods/src/views/category/view.php b/vendor/antgoods/goods/src/views/category/view.php new file mode 100644 index 0000000..2a087d5 --- /dev/null +++ b/vendor/antgoods/goods/src/views/category/view.php @@ -0,0 +1,37 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Categories', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> +
+ +

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

+ + $model, + 'attributes' => [ + 'id', + 'name', + 'pid', + 'goods_count', + 'sort_order', + 'icon_type', + 'icon', + 'is_show', + 'is_delete', + 'created_at', + 'updated_at', + ], + ]) ?> + +
From 3c4252c7591f28695b0c8f4b0188e6168dc839a9 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 19:30:25 +0800 Subject: [PATCH 036/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E6=A0=B7=E5=BC=8F=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/views/category/_form.php | 2 -- vendor/antgoods/goods/src/views/category/create.php | 4 ++-- vendor/antgoods/goods/src/views/category/update.php | 6 +++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/vendor/antgoods/goods/src/views/category/_form.php b/vendor/antgoods/goods/src/views/category/_form.php index c2fe65f..d154648 100644 --- a/vendor/antgoods/goods/src/views/category/_form.php +++ b/vendor/antgoods/goods/src/views/category/_form.php @@ -14,8 +14,6 @@ use yii\widgets\ActiveForm; field($model, 'name')->textInput(['maxlength' => true]) ?> - field($model, 'pid')->textInput() ?> - field($model, 'goods_count')->textInput() ?> field($model, 'sort_order')->textInput() ?> diff --git a/vendor/antgoods/goods/src/views/category/create.php b/vendor/antgoods/goods/src/views/category/create.php index 1ecb4fa..624761d 100644 --- a/vendor/antgoods/goods/src/views/category/create.php +++ b/vendor/antgoods/goods/src/views/category/create.php @@ -5,8 +5,8 @@ use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Category */ -$this->title = '创建 Category'; -$this->params['breadcrumbs'][] = ['label' => 'Categories', 'url' => ['index']]; +$this->title = '创建商品分类'; +$this->params['breadcrumbs'][] = ['label' => '商品分类', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?>
diff --git a/vendor/antgoods/goods/src/views/category/update.php b/vendor/antgoods/goods/src/views/category/update.php index a4a8106..4d8f354 100644 --- a/vendor/antgoods/goods/src/views/category/update.php +++ b/vendor/antgoods/goods/src/views/category/update.php @@ -5,10 +5,10 @@ use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Category */ -$this->title = '编辑 Category: ' . $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Categories', 'url' => ['index']]; +$this->title = '编辑商品分类: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => '商品分类', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; -$this->params['breadcrumbs'][] = 'Update '; +$this->params['breadcrumbs'][] = '编辑 '; ?>
From 731c110292c27f41403af61f76385fa1451e02b1 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 19:58:36 +0800 Subject: [PATCH 037/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9antgoods=E5=95=86?= =?UTF-8?q?=E5=93=81=E6=A8=A1=E5=9D=97=E7=9A=84=E5=AD=97=E6=AE=B5=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/views/goods/create.php | 4 ++-- vendor/antgoods/goods/src/views/goods/index.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vendor/antgoods/goods/src/views/goods/create.php b/vendor/antgoods/goods/src/views/goods/create.php index 4f1d258..05be9b7 100644 --- a/vendor/antgoods/goods/src/views/goods/create.php +++ b/vendor/antgoods/goods/src/views/goods/create.php @@ -5,8 +5,8 @@ use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Goods */ -$this->title = '创建 Goods'; -$this->params['breadcrumbs'][] = ['label' => 'Goods', 'url' => ['index']]; +$this->title = '创建商品'; +$this->params['breadcrumbs'][] = ['label' => '商品列表', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?>
diff --git a/vendor/antgoods/goods/src/views/goods/index.php b/vendor/antgoods/goods/src/views/goods/index.php index 82c38b2..40421e3 100644 --- a/vendor/antgoods/goods/src/views/goods/index.php +++ b/vendor/antgoods/goods/src/views/goods/index.php @@ -7,7 +7,7 @@ use iron\grid\GridView; /* @var $searchModel common\models\searchs\GoodsSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ -$this->title = 'Goods'; +$this->title = '商品列表'; $this->params['breadcrumbs'][] = $this->title; ?>
From 1dd45f0c81ebe43d3e5e796654b15b11a76aed7b Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 10:08:53 +0800 Subject: [PATCH 038/102] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E5=A4=84=E7=90=86=E8=A1=A8=E5=8D=95is=5Fshow=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=8D=95=E9=80=89=E6=A1=86=EF=BC=8C=E5=A4=84=E7=90=86=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=88=A0=E9=99=A4=E6=93=8D=E4=BD=9C=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods/src/controllers/CategoryController.php | 5 ++++- vendor/antgoods/goods/src/models/ars/Category.php | 14 +++++++++++++- .../goods/src/models/searchs/CategorySearch.php | 1 + vendor/antgoods/goods/src/views/category/_form.php | 5 ++--- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/vendor/antgoods/goods/src/controllers/CategoryController.php b/vendor/antgoods/goods/src/controllers/CategoryController.php index 64017dc..1d96800 100644 --- a/vendor/antgoods/goods/src/controllers/CategoryController.php +++ b/vendor/antgoods/goods/src/controllers/CategoryController.php @@ -105,7 +105,10 @@ class CategoryController extends Controller */ public function actionDelete($id) { - $this->findModel($id)->delete(); + $model = $this->findModel($id); + + $model->is_delete = Category::IS_DELETE_YES; + $model->save(); return $this->redirect(['index']); } diff --git a/vendor/antgoods/goods/src/models/ars/Category.php b/vendor/antgoods/goods/src/models/ars/Category.php index 9fe01df..212def5 100644 --- a/vendor/antgoods/goods/src/models/ars/Category.php +++ b/vendor/antgoods/goods/src/models/ars/Category.php @@ -22,6 +22,18 @@ use yii\behaviors\TimestampBehavior; */ class Category extends \yii\db\ActiveRecord { + //是否显示is_show + const IS_SHOW_DISPLAY = 0;//显示 + const IS_SHOW_HIDE = 1;//隐藏 + //是否删除is_delete + const IS_DELETE_NO = 0;//未删除 + const IS_DELETE_YES = 1;//已删除 + + public static $isShow = [ + self::IS_SHOW_DISPLAY => '显示', + self::IS_SHOW_HIDE => '隐藏' + ]; + /** * {@inheritdoc} */ @@ -56,7 +68,7 @@ class Category extends \yii\db\ActiveRecord 'sort_order' => '排序', 'icon_type' => '图标类型', 'icon' => '图标', - 'is_show' => '是否显示,1为不显示', + 'is_show' => '是否显示', 'is_delete' => '是否删除,1为已删除', 'created_at' => '创建时间', 'updated_at' => '更新时间', diff --git a/vendor/antgoods/goods/src/models/searchs/CategorySearch.php b/vendor/antgoods/goods/src/models/searchs/CategorySearch.php index 63ad3f0..7ed7c4f 100644 --- a/vendor/antgoods/goods/src/models/searchs/CategorySearch.php +++ b/vendor/antgoods/goods/src/models/searchs/CategorySearch.php @@ -121,6 +121,7 @@ class CategorySearch extends Category * 条件筛选 */ private function filter($query, $dataProvider){ + $query->andFilterWhere(['is_delete' => 0]); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); diff --git a/vendor/antgoods/goods/src/views/category/_form.php b/vendor/antgoods/goods/src/views/category/_form.php index d154648..4badc99 100644 --- a/vendor/antgoods/goods/src/views/category/_form.php +++ b/vendor/antgoods/goods/src/views/category/_form.php @@ -2,6 +2,7 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; +use blobt\widgets\Icheck; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Category */ @@ -22,9 +23,7 @@ use yii\widgets\ActiveForm; field($model, 'icon')->textInput(['maxlength' => true]) ?> - field($model, 'is_show')->textInput() ?> - - field($model, 'is_delete')->textInput() ?> + field($model, 'is_show')->widget(Icheck::className(), ["items" => $model::$isShow, 'type' => "radio"]) ?>
'btn btn-success']) ?> From 82f319f0c4d5fa51f11f666fa15fc05a0bff1ad6 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 10:22:17 +0800 Subject: [PATCH 039/102] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=88=86=E7=B1=BBview=E9=A1=B5=E9=9D=A2=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/views/category/view.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/vendor/antgoods/goods/src/views/category/view.php b/vendor/antgoods/goods/src/views/category/view.php index 2a087d5..9e7b161 100644 --- a/vendor/antgoods/goods/src/views/category/view.php +++ b/vendor/antgoods/goods/src/views/category/view.php @@ -27,10 +27,14 @@ $this->params['breadcrumbs'][] = $this->title; 'sort_order', 'icon_type', 'icon', - 'is_show', - 'is_delete', - 'created_at', - 'updated_at', + [ + 'attribute' => 'is_show', + 'value' => function ($model) { + return $model->is_show == \antgoods\goods\models\ars\Category::IS_SHOW_DISPLAY ? '显示':'隐藏'; + } + ], + 'created_at:datetime', + 'updated_at:datetime', ], ]) ?> From 067866973bfc63ac35e06d5ed5f66660584c8c33 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 10:29:44 +0800 Subject: [PATCH 040/102] =?UTF-8?q?antgoods=E6=A8=A1=E5=9D=97=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=93=81=E7=89=8C=E7=AE=A1=E7=90=86=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/views/layouts/sidebar.php | 1 + .../antgoods/goods/src}/controllers/BrandController.php | 6 +++--- .../antgoods/goods/src}/models/searchs/BrandSearch.php | 6 +++--- .../antgoods/goods/src}/views/brand/_form.php | 2 +- .../antgoods/goods/src}/views/brand/_search.php | 8 +++++--- .../antgoods/goods/src}/views/brand/create.php | 2 +- .../antgoods/goods/src}/views/brand/index.php | 4 ++-- .../antgoods/goods/src}/views/brand/update.php | 2 +- .../antgoods/goods/src}/views/brand/view.php | 2 +- 9 files changed, 18 insertions(+), 15 deletions(-) rename {backend => vendor/antgoods/goods/src}/controllers/BrandController.php (96%) mode change 100755 => 100644 rename {common => vendor/antgoods/goods/src}/models/searchs/BrandSearch.php (95%) mode change 100755 => 100644 rename {backend => vendor/antgoods/goods/src}/views/brand/_form.php (91%) mode change 100755 => 100644 rename {backend => vendor/antgoods/goods/src}/views/brand/_search.php (92%) mode change 100755 => 100644 rename {backend => vendor/antgoods/goods/src}/views/brand/create.php (86%) mode change 100755 => 100644 rename {backend => vendor/antgoods/goods/src}/views/brand/index.php (92%) mode change 100755 => 100644 rename {backend => vendor/antgoods/goods/src}/views/brand/update.php (89%) mode change 100755 => 100644 rename {backend => vendor/antgoods/goods/src}/views/brand/view.php (92%) mode change 100755 => 100644 diff --git a/backend/views/layouts/sidebar.php b/backend/views/layouts/sidebar.php index 720c666..54868f1 100755 --- a/backend/views/layouts/sidebar.php +++ b/backend/views/layouts/sidebar.php @@ -23,6 +23,7 @@ use iron\widgets\Menu; ['label' => '商品管理', 'url' => '#', 'icon' => 'far fa-archive', 'items' => [ ['label' => '商品列表', 'url' => ['/antgoods/goods/index']], ['label' => '商品分类', 'url' => ['/antgoods/category/index']], + ['label' => '品牌管理', 'url' => ['/antgoods/brand/index']], ] ], ['label' => '订单管理', 'url' => '#', 'icon' => 'far fa-list-alt', 'items' => [ diff --git a/backend/controllers/BrandController.php b/vendor/antgoods/goods/src/controllers/BrandController.php old mode 100755 new mode 100644 similarity index 96% rename from backend/controllers/BrandController.php rename to vendor/antgoods/goods/src/controllers/BrandController.php index 0dd6523..35e5f83 --- a/backend/controllers/BrandController.php +++ b/vendor/antgoods/goods/src/controllers/BrandController.php @@ -1,10 +1,10 @@ diff --git a/backend/views/brand/_search.php b/vendor/antgoods/goods/src/views/brand/_search.php old mode 100755 new mode 100644 similarity index 92% rename from backend/views/brand/_search.php rename to vendor/antgoods/goods/src/views/brand/_search.php index 14a96ae..ed21354 --- a/backend/views/brand/_search.php +++ b/vendor/antgoods/goods/src/views/brand/_search.php @@ -15,8 +15,8 @@ use \blobt\widgets\DateRangePicker; 'validateOnType' => true, ]); ?> -
-
+
+
field($model, 'id', [ "template" => "{input}{error}", "inputOptions" => [ @@ -28,6 +28,8 @@ use \blobt\widgets\DateRangePicker; ] ]) ?> +
+
field($model, "created_at_range", [ "template" => "{input}{error}", "inputOptions" => [ @@ -38,10 +40,10 @@ use \blobt\widgets\DateRangePicker; ] ])->widget(DateRangePicker::className()); ?> +
', ['class' => 'btn btn-default']) ?> ', ['class' => 'btn btn-default']) ?>
-
\ No newline at end of file diff --git a/backend/views/brand/create.php b/vendor/antgoods/goods/src/views/brand/create.php old mode 100755 new mode 100644 similarity index 86% rename from backend/views/brand/create.php rename to vendor/antgoods/goods/src/views/brand/create.php index c768fcb..ca5f84b --- a/backend/views/brand/create.php +++ b/vendor/antgoods/goods/src/views/brand/create.php @@ -3,7 +3,7 @@ use yii\helpers\Html; /* @var $this yii\web\View */ -/* @var $model common\models\ars\Brand */ +/* @var $model antgoods\goods\models\ars\Brand */ $this->title = '创建 Brand'; $this->params['breadcrumbs'][] = ['label' => 'Brands', 'url' => ['index']]; diff --git a/backend/views/brand/index.php b/vendor/antgoods/goods/src/views/brand/index.php old mode 100755 new mode 100644 similarity index 92% rename from backend/views/brand/index.php rename to vendor/antgoods/goods/src/views/brand/index.php index f799f7a..4abe0dd --- a/backend/views/brand/index.php +++ b/vendor/antgoods/goods/src/views/brand/index.php @@ -1,7 +1,7 @@ title = 'Brands'; $this->params['breadcrumbs'][] = $this->title; ?>
-
+
$dataProvider, 'filter' => $this->render("_search", ['model' => $searchModel]), diff --git a/backend/views/brand/update.php b/vendor/antgoods/goods/src/views/brand/update.php old mode 100755 new mode 100644 similarity index 89% rename from backend/views/brand/update.php rename to vendor/antgoods/goods/src/views/brand/update.php index 453ee2f..7884a9c --- a/backend/views/brand/update.php +++ b/vendor/antgoods/goods/src/views/brand/update.php @@ -3,7 +3,7 @@ use yii\helpers\Html; /* @var $this yii\web\View */ -/* @var $model common\models\ars\Brand */ +/* @var $model antgoods\goods\models\ars\Brand */ $this->title = '编辑 Brand: ' . $model->name; $this->params['breadcrumbs'][] = ['label' => 'Brands', 'url' => ['index']]; diff --git a/backend/views/brand/view.php b/vendor/antgoods/goods/src/views/brand/view.php old mode 100755 new mode 100644 similarity index 92% rename from backend/views/brand/view.php rename to vendor/antgoods/goods/src/views/brand/view.php index 814b5be..c592ea0 --- a/backend/views/brand/view.php +++ b/vendor/antgoods/goods/src/views/brand/view.php @@ -4,7 +4,7 @@ use yii\helpers\Html; use yii\widgets\DetailView; /* @var $this yii\web\View */ -/* @var $model common\models\ars\Brand */ +/* @var $model antgoods\goods\models\ars\Brand */ $this->title = $model->name; $this->params['breadcrumbs'][] = ['label' => 'Brands', 'url' => ['index']]; From 69d7929a88c110d050e03ee8a5e9b3ab27bd24d6 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 10:37:25 +0800 Subject: [PATCH 041/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9antgoods=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=93=81=E7=89=8C=E7=AE=A1=E7=90=86=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/models/searchs/BrandSearch.php | 5 ++--- vendor/antgoods/goods/src/views/brand/_form.php | 2 -- vendor/antgoods/goods/src/views/brand/create.php | 4 ++-- vendor/antgoods/goods/src/views/brand/index.php | 2 +- vendor/antgoods/goods/src/views/brand/update.php | 6 +++--- vendor/antgoods/goods/src/views/brand/view.php | 5 ++--- 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/vendor/antgoods/goods/src/models/searchs/BrandSearch.php b/vendor/antgoods/goods/src/models/searchs/BrandSearch.php index 589a2fb..f7fc35e 100644 --- a/vendor/antgoods/goods/src/models/searchs/BrandSearch.php +++ b/vendor/antgoods/goods/src/models/searchs/BrandSearch.php @@ -54,9 +54,8 @@ class BrandSearch extends Brand ], 'id', 'name', - 'is_delete', - 'created_at', - 'updated_at', + 'created_at:datetime', + 'updated_at:datetime', [ 'class' => 'iron\grid\ActionColumn', 'align' => 'center', diff --git a/vendor/antgoods/goods/src/views/brand/_form.php b/vendor/antgoods/goods/src/views/brand/_form.php index 9f7f050..6bd4bbc 100644 --- a/vendor/antgoods/goods/src/views/brand/_form.php +++ b/vendor/antgoods/goods/src/views/brand/_form.php @@ -14,8 +14,6 @@ use yii\widgets\ActiveForm; field($model, 'name')->textInput(['maxlength' => true]) ?> - field($model, 'is_delete')->textInput() ?> -
'btn btn-success']) ?> 'btn btn-info']) ?> diff --git a/vendor/antgoods/goods/src/views/brand/create.php b/vendor/antgoods/goods/src/views/brand/create.php index ca5f84b..7effd14 100644 --- a/vendor/antgoods/goods/src/views/brand/create.php +++ b/vendor/antgoods/goods/src/views/brand/create.php @@ -5,8 +5,8 @@ use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Brand */ -$this->title = '创建 Brand'; -$this->params['breadcrumbs'][] = ['label' => 'Brands', 'url' => ['index']]; +$this->title = '创建品牌'; +$this->params['breadcrumbs'][] = ['label' => '品牌管理', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?>
diff --git a/vendor/antgoods/goods/src/views/brand/index.php b/vendor/antgoods/goods/src/views/brand/index.php index 4abe0dd..7f2b6ba 100644 --- a/vendor/antgoods/goods/src/views/brand/index.php +++ b/vendor/antgoods/goods/src/views/brand/index.php @@ -7,7 +7,7 @@ use iron\grid\GridView; /* @var $searchModel common\models\searchs\BrandSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ -$this->title = 'Brands'; +$this->title = '品牌管理'; $this->params['breadcrumbs'][] = $this->title; ?>
diff --git a/vendor/antgoods/goods/src/views/brand/update.php b/vendor/antgoods/goods/src/views/brand/update.php index 7884a9c..6b13cfe 100644 --- a/vendor/antgoods/goods/src/views/brand/update.php +++ b/vendor/antgoods/goods/src/views/brand/update.php @@ -5,10 +5,10 @@ use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Brand */ -$this->title = '编辑 Brand: ' . $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Brands', 'url' => ['index']]; +$this->title = '编辑品牌: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => '品牌管理', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; -$this->params['breadcrumbs'][] = 'Update '; +$this->params['breadcrumbs'][] = '编辑 '; ?>
diff --git a/vendor/antgoods/goods/src/views/brand/view.php b/vendor/antgoods/goods/src/views/brand/view.php index c592ea0..e31b418 100644 --- a/vendor/antgoods/goods/src/views/brand/view.php +++ b/vendor/antgoods/goods/src/views/brand/view.php @@ -22,9 +22,8 @@ $this->params['breadcrumbs'][] = $this->title; 'attributes' => [ 'id', 'name', - 'is_delete', - 'created_at', - 'updated_at', + 'created_at:datetime', + 'updated_at:datetime', ], ]) ?> From b809932515d14ffca829e419c8c68f25d5330a7a Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 10:42:40 +0800 Subject: [PATCH 042/102] =?UTF-8?q?=E8=AE=BE=E7=BD=AEantgoods=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=93=81=E7=89=8C=EF=BC=8C=E5=88=86=E7=B1=BB=EF=BC=8C?= =?UTF-8?q?=E5=95=86=E5=93=81=E7=9A=84=E5=88=A0=E9=99=A4=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E6=A3=80=E7=B4=A2=E6=98=BE=E7=A4=BA=E6=98=AF?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E5=B7=B2=E5=88=A0=E9=99=A4=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/models/ars/Brand.php | 3 +++ vendor/antgoods/goods/src/models/ars/Goods.php | 3 +++ vendor/antgoods/goods/src/models/searchs/BrandSearch.php | 1 + vendor/antgoods/goods/src/models/searchs/CategorySearch.php | 2 +- vendor/antgoods/goods/src/models/searchs/GoodsSearch.php | 1 + 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/vendor/antgoods/goods/src/models/ars/Brand.php b/vendor/antgoods/goods/src/models/ars/Brand.php index a225e59..bf681bd 100644 --- a/vendor/antgoods/goods/src/models/ars/Brand.php +++ b/vendor/antgoods/goods/src/models/ars/Brand.php @@ -16,6 +16,9 @@ use yii\behaviors\TimestampBehavior; */ class Brand extends \yii\db\ActiveRecord { + //是否删除is_delete + const IS_DELETE_NO = 0;//未删除 + const IS_DELETE_YES = 1;//已删除 /** * {@inheritdoc} */ diff --git a/vendor/antgoods/goods/src/models/ars/Goods.php b/vendor/antgoods/goods/src/models/ars/Goods.php index 841efc8..2434e83 100644 --- a/vendor/antgoods/goods/src/models/ars/Goods.php +++ b/vendor/antgoods/goods/src/models/ars/Goods.php @@ -44,6 +44,9 @@ use yii\behaviors\TimestampBehavior; */ class Goods extends \yii\db\ActiveRecord { + //是否删除is_delete + const IS_DELETE_NO = 0;//未删除 + const IS_DELETE_YES = 1;//已删除 /** * {@inheritdoc} */ diff --git a/vendor/antgoods/goods/src/models/searchs/BrandSearch.php b/vendor/antgoods/goods/src/models/searchs/BrandSearch.php index f7fc35e..e484b56 100644 --- a/vendor/antgoods/goods/src/models/searchs/BrandSearch.php +++ b/vendor/antgoods/goods/src/models/searchs/BrandSearch.php @@ -114,6 +114,7 @@ class BrandSearch extends Brand * 条件筛选 */ 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'); diff --git a/vendor/antgoods/goods/src/models/searchs/CategorySearch.php b/vendor/antgoods/goods/src/models/searchs/CategorySearch.php index 7ed7c4f..cce94b0 100644 --- a/vendor/antgoods/goods/src/models/searchs/CategorySearch.php +++ b/vendor/antgoods/goods/src/models/searchs/CategorySearch.php @@ -121,7 +121,7 @@ class CategorySearch extends Category * 条件筛选 */ private function filter($query, $dataProvider){ - $query->andFilterWhere(['is_delete' => 0]); + $query->andFilterWhere(['is_delete' => Category::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'); diff --git a/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php b/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php index 738cbf2..618b320 100644 --- a/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php +++ b/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php @@ -143,6 +143,7 @@ class GoodsSearch extends Goods * 条件筛选 */ private function filter($query, $dataProvider){ + $query->andFilterWhere(['is_delete' => Goods::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'); From 8ad92f6eaca855eaab2c881253ee9fe335e56739 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 10:45:18 +0800 Subject: [PATCH 043/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E9=83=A8=E5=88=86=E6=98=AF=E5=90=A6=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=EF=BC=8C=E5=A2=9E=E5=8A=A0=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/migrations/m191119_022939_create_table_attribute.php | 2 +- .../src/migrations/m191119_023115_create_table_goods_attr.php | 2 +- .../goods/src/migrations/m191119_024029_create_table_brand.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vendor/antgoods/goods/src/migrations/m191119_022939_create_table_attribute.php b/vendor/antgoods/goods/src/migrations/m191119_022939_create_table_attribute.php index cb2cad2..8f77f8f 100644 --- a/vendor/antgoods/goods/src/migrations/m191119_022939_create_table_attribute.php +++ b/vendor/antgoods/goods/src/migrations/m191119_022939_create_table_attribute.php @@ -19,7 +19,7 @@ class m191119_022939_create_table_attribute extends Migration '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(null)->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); diff --git a/vendor/antgoods/goods/src/migrations/m191119_023115_create_table_goods_attr.php b/vendor/antgoods/goods/src/migrations/m191119_023115_create_table_goods_attr.php index 4f33089..19a263c 100644 --- a/vendor/antgoods/goods/src/migrations/m191119_023115_create_table_goods_attr.php +++ b/vendor/antgoods/goods/src/migrations/m191119_023115_create_table_goods_attr.php @@ -18,7 +18,7 @@ class m191119_023115_create_table_goods_attr extends Migration '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(null)->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); diff --git a/vendor/antgoods/goods/src/migrations/m191119_024029_create_table_brand.php b/vendor/antgoods/goods/src/migrations/m191119_024029_create_table_brand.php index f1d46ad..48984d4 100644 --- a/vendor/antgoods/goods/src/migrations/m191119_024029_create_table_brand.php +++ b/vendor/antgoods/goods/src/migrations/m191119_024029_create_table_brand.php @@ -16,7 +16,7 @@ class m191119_024029_create_table_brand extends Migration $this->createTable('antgoods_brand', [ 'id' => $this->primaryKey(), 'name'=>$this->string(50)->notNull()->comment('品牌名'), - 'is_delete'=>$this->tinyInteger(1)->defaultValue(null)->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); From 573af0427528a44c9439a085b9e3c485009b0b09 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 11:11:42 +0800 Subject: [PATCH 044/102] =?UTF-8?q?antgoods=E6=A8=A1=E5=9D=97=E5=93=81?= =?UTF-8?q?=E7=89=8C=E5=92=8C=E5=88=86=E7=B1=BB=E5=A2=9E=E5=8A=A0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=94=AE=E5=80=BC=E5=AF=B9=E6=96=B9=E6=B3=95=EF=BC=8C?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=AE=8C=E6=88=90=E9=83=A8=E5=88=86=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/models/ars/Brand.php | 5 +++++ vendor/antgoods/goods/src/models/ars/Category.php | 5 +++++ vendor/antgoods/goods/src/views/goods/_form.php | 10 ++++------ vendor/antgoods/goods/src/views/goods/update.php | 6 +++--- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/vendor/antgoods/goods/src/models/ars/Brand.php b/vendor/antgoods/goods/src/models/ars/Brand.php index bf681bd..f3e49b5 100644 --- a/vendor/antgoods/goods/src/models/ars/Brand.php +++ b/vendor/antgoods/goods/src/models/ars/Brand.php @@ -74,4 +74,9 @@ class Brand extends \yii\db\ActiveRecord ], ]; } + + public static function modelColumn() + { + return $column = Brand::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column(); + } } diff --git a/vendor/antgoods/goods/src/models/ars/Category.php b/vendor/antgoods/goods/src/models/ars/Category.php index 212def5..7d4fa46 100644 --- a/vendor/antgoods/goods/src/models/ars/Category.php +++ b/vendor/antgoods/goods/src/models/ars/Category.php @@ -96,4 +96,9 @@ class Category extends \yii\db\ActiveRecord ], ]; } + + public static function modelColumn() + { + return $column = Category::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column(); + } } diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index 5956348..a944d3e 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -2,6 +2,8 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; +use antgoods\goods\models\ars\Category; +use antgoods\goods\models\ars\Brand; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Goods */ @@ -12,11 +14,9 @@ use yii\widgets\ActiveForm; - field($model, 'pid')->textInput() ?> + field($model, 'cat_id')->dropDownList(Category::modelColumn(), ['prompt' => '请选择']) ?> - field($model, 'cat_id')->textInput() ?> - - field($model, 'brand_id')->textInput() ?> + field($model, 'brand_id')->dropDownList(Brand::modelColumn(), ['prompt' => '请选择']) ?> field($model, 'shop_cat_id')->textInput() ?> @@ -68,8 +68,6 @@ use yii\widgets\ActiveForm; field($model, 'experience_points')->textInput() ?> - field($model, 'is_delete')->textInput() ?> - field($model, 'express_template')->textInput() ?>
diff --git a/vendor/antgoods/goods/src/views/goods/update.php b/vendor/antgoods/goods/src/views/goods/update.php index 9689d6d..c4a3cf1 100644 --- a/vendor/antgoods/goods/src/views/goods/update.php +++ b/vendor/antgoods/goods/src/views/goods/update.php @@ -5,10 +5,10 @@ use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Goods */ -$this->title = '编辑 Goods: ' . $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Goods', 'url' => ['index']]; +$this->title = '编辑商品: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => '商品管理', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; -$this->params['breadcrumbs'][] = 'Update '; +$this->params['breadcrumbs'][] = '编辑 '; ?>
From ec6ddb5aca7008ef37cfeb650abd40ad95cdf951 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 11:15:04 +0800 Subject: [PATCH 045/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9antgoods=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E9=83=A8=E5=88=86=E6=A8=A1=E5=9D=97view=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/views/brand/view.php | 2 +- vendor/antgoods/goods/src/views/category/create.php | 4 ++-- vendor/antgoods/goods/src/views/category/index.php | 2 +- vendor/antgoods/goods/src/views/category/update.php | 4 ++-- vendor/antgoods/goods/src/views/category/view.php | 2 +- vendor/antgoods/goods/src/views/goods/view.php | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/vendor/antgoods/goods/src/views/brand/view.php b/vendor/antgoods/goods/src/views/brand/view.php index e31b418..a9de5d8 100644 --- a/vendor/antgoods/goods/src/views/brand/view.php +++ b/vendor/antgoods/goods/src/views/brand/view.php @@ -7,7 +7,7 @@ use yii\widgets\DetailView; /* @var $model antgoods\goods\models\ars\Brand */ $this->title = $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Brands', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => '品牌管理', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; \yii\web\YiiAsset::register($this); ?> diff --git a/vendor/antgoods/goods/src/views/category/create.php b/vendor/antgoods/goods/src/views/category/create.php index 624761d..a213063 100644 --- a/vendor/antgoods/goods/src/views/category/create.php +++ b/vendor/antgoods/goods/src/views/category/create.php @@ -5,8 +5,8 @@ use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Category */ -$this->title = '创建商品分类'; -$this->params['breadcrumbs'][] = ['label' => '商品分类', 'url' => ['index']]; +$this->title = '创建后台商品分类'; +$this->params['breadcrumbs'][] = ['label' => '后台商品分类', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?>
diff --git a/vendor/antgoods/goods/src/views/category/index.php b/vendor/antgoods/goods/src/views/category/index.php index b63d020..0f5127f 100644 --- a/vendor/antgoods/goods/src/views/category/index.php +++ b/vendor/antgoods/goods/src/views/category/index.php @@ -7,7 +7,7 @@ use iron\grid\GridView; /* @var $searchModel common\models\searchs\CategorySearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ -$this->title = '商品分类'; +$this->title = '后台商品分类'; $this->params['breadcrumbs'][] = $this->title; ?>
diff --git a/vendor/antgoods/goods/src/views/category/update.php b/vendor/antgoods/goods/src/views/category/update.php index 4d8f354..9e2753c 100644 --- a/vendor/antgoods/goods/src/views/category/update.php +++ b/vendor/antgoods/goods/src/views/category/update.php @@ -5,8 +5,8 @@ use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Category */ -$this->title = '编辑商品分类: ' . $model->name; -$this->params['breadcrumbs'][] = ['label' => '商品分类', 'url' => ['index']]; +$this->title = '编辑后台商品分类: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => '后台商品分类', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; $this->params['breadcrumbs'][] = '编辑 '; ?> diff --git a/vendor/antgoods/goods/src/views/category/view.php b/vendor/antgoods/goods/src/views/category/view.php index 9e7b161..f0ec780 100644 --- a/vendor/antgoods/goods/src/views/category/view.php +++ b/vendor/antgoods/goods/src/views/category/view.php @@ -7,7 +7,7 @@ use yii\widgets\DetailView; /* @var $model antgoods\goods\models\ars\Category */ $this->title = $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Categories', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => '后台商品分类', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; \yii\web\YiiAsset::register($this); ?> diff --git a/vendor/antgoods/goods/src/views/goods/view.php b/vendor/antgoods/goods/src/views/goods/view.php index 27f0963..c70b22e 100644 --- a/vendor/antgoods/goods/src/views/goods/view.php +++ b/vendor/antgoods/goods/src/views/goods/view.php @@ -7,7 +7,7 @@ use yii\widgets\DetailView; /* @var $model antgoods\goods\models\ars\Goods */ $this->title = $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Goods', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => '商品管理', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; \yii\web\YiiAsset::register($this); ?> From d1a583a58f11b0d0d8568024cabc451687836465 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 11:39:24 +0800 Subject: [PATCH 046/102] =?UTF-8?q?antgoods=E6=A8=A1=E5=9D=97=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=89=8D=E7=AB=AF=E5=95=86=E5=93=81=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/views/layouts/sidebar.php | 3 +- .../controllers/ShopcategoryController.php | 149 ++++++++++++++++ .../goods/src/models/ars/ShopCategory.php | 16 +- .../src/models/searchs/ShopCategorySearch.php | 159 ++++++++++++++++++ .../goods/src/views/shopcategory/_form.php | 41 +++++ .../goods/src/views/shopcategory/_search.php | 49 ++++++ .../goods/src/views/shopcategory/create.php | 18 ++ .../goods/src/views/shopcategory/index.php | 28 +++ .../goods/src/views/shopcategory/update.php | 19 +++ .../goods/src/views/shopcategory/view.php | 40 +++++ 10 files changed, 519 insertions(+), 3 deletions(-) create mode 100644 vendor/antgoods/goods/src/controllers/ShopcategoryController.php create mode 100644 vendor/antgoods/goods/src/models/searchs/ShopCategorySearch.php create mode 100644 vendor/antgoods/goods/src/views/shopcategory/_form.php create mode 100644 vendor/antgoods/goods/src/views/shopcategory/_search.php create mode 100644 vendor/antgoods/goods/src/views/shopcategory/create.php create mode 100644 vendor/antgoods/goods/src/views/shopcategory/index.php create mode 100644 vendor/antgoods/goods/src/views/shopcategory/update.php create mode 100644 vendor/antgoods/goods/src/views/shopcategory/view.php diff --git a/backend/views/layouts/sidebar.php b/backend/views/layouts/sidebar.php index 54868f1..c8f8ada 100755 --- a/backend/views/layouts/sidebar.php +++ b/backend/views/layouts/sidebar.php @@ -22,7 +22,8 @@ use iron\widgets\Menu; ], ['label' => '商品管理', 'url' => '#', 'icon' => 'far fa-archive', 'items' => [ ['label' => '商品列表', 'url' => ['/antgoods/goods/index']], - ['label' => '商品分类', 'url' => ['/antgoods/category/index']], + ['label' => '后台商品分类', 'url' => ['/antgoods/category/index']], + ['label' => '前端商品分类', 'url' => ['/antgoods/shopcategory/index']], ['label' => '品牌管理', 'url' => ['/antgoods/brand/index']], ] ], diff --git a/vendor/antgoods/goods/src/controllers/ShopcategoryController.php b/vendor/antgoods/goods/src/controllers/ShopcategoryController.php new file mode 100644 index 0000000..ef1feec --- /dev/null +++ b/vendor/antgoods/goods/src/controllers/ShopcategoryController.php @@ -0,0 +1,149 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + /** + * Lists all ShopCategory models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new ShopCategorySearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + 'columns' => $searchModel->columns() + ]); + } + + /** + * Displays a single ShopCategory model. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new ShopCategory model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new ShopCategory(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect('index'); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + /** + * Updates an existing ShopCategory model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect('index'); + } + + return $this->render('update', [ + 'model' => $model, + ]); + } + + /** + * Deletes an existing ShopCategory model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + /** + * Finds the ShopCategory model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return ShopCategory the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = ShopCategory::findOne($id)) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } + /** + * @author iron + * 文件导出 + */ + public function actionExport() + { + $searchModel = new ShopCategorySearch(); + $params = Yii::$app->request->queryParams; + if ($params['page-type'] == 'all') { + $dataProvider = $searchModel->allData($params); + } else { + $dataProvider = $searchModel->search($params); + } + \iron\widget\Excel::export([ + 'models' => $dataProvider->getModels(), + 'format' => 'Xlsx', + 'asAttachment' => true, + 'fileName' =>'Shop Categories'. "-" .date('Y-m-d H/i/s', time()), + 'columns' => $searchModel->columns() + ]); + } +} diff --git a/vendor/antgoods/goods/src/models/ars/ShopCategory.php b/vendor/antgoods/goods/src/models/ars/ShopCategory.php index 2ffb20c..a848f51 100644 --- a/vendor/antgoods/goods/src/models/ars/ShopCategory.php +++ b/vendor/antgoods/goods/src/models/ars/ShopCategory.php @@ -25,6 +25,18 @@ use yii\behaviors\TimestampBehavior; */ class ShopCategory extends \yii\db\ActiveRecord { + //是否显示is_show + const IS_SHOW_DISPLAY = 0;//显示 + const IS_SHOW_HIDE = 1;//隐藏 + //是否删除is_delete + const IS_DELETE_NO = 0;//未删除 + const IS_DELETE_YES = 1;//已删除 + + public static $isShow = [ + self::IS_SHOW_DISPLAY => '显示', + self::IS_SHOW_HIDE => '隐藏' + ]; + /** * {@inheritdoc} */ @@ -65,8 +77,8 @@ class ShopCategory extends \yii\db\ActiveRecord 'icon_type' => '图标类型', 'icon' => '图标', 'filter_attr' => '筛选属性', - 'is_show' => '是否显示,1为不显示', - 'is_delete' => '是否删除,1为已删除', + 'is_show' => '是否显示', + 'is_delete' => '是否删除', 'created_at' => '创建时间', 'updated_at' => '更新时间', ]; diff --git a/vendor/antgoods/goods/src/models/searchs/ShopCategorySearch.php b/vendor/antgoods/goods/src/models/searchs/ShopCategorySearch.php new file mode 100644 index 0000000..524eb11 --- /dev/null +++ b/vendor/antgoods/goods/src/models/searchs/ShopCategorySearch.php @@ -0,0 +1,159 @@ + 'blobt\grid\CheckboxColumn', + 'width' => '2%', + 'align' => 'center' + ], + 'id', + 'name', + 'pid', + 'goods_count', + 'keywords', + //'desc', + //'sort_order', + //'icon_type', + //'icon', + //'filter_attr', + //'is_show', + //'is_delete', + //'created_at', + //'updated_at', + [ + 'class' => 'iron\grid\ActionColumn', + 'align' => 'center', + ], + ]; + } + /** + * @param $params + * @return ActiveDataProvider + * 不分页的所有数据 + */ + public function allData($params) + { + $query = ShopCategory::find(); + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'pagination' => false, + 'sort' => false + ]); + $this->load($params); + return $this->filter($query, $dataProvider); + } + + /** + * Creates data provider instance with search query applied + * + * @param array $params + * + * @return ActiveDataProvider + */ + public function search($params) + { + $query = ShopCategory::find(); + + // add conditions that should always apply here + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'pagination' => [ + 'pageSizeLimit' => [1, 200] + ], + 'sort' => [ + 'defaultOrder' => [ + 'id' => SORT_DESC, + ] + ], + ]); + + $this->load($params); + return $this->filter($query, $dataProvider); + } + /** + * @param $query + * @param $dataProvider + * @return ActiveDataProvider + * 条件筛选 + */ + private function filter($query, $dataProvider){ + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'id' => $this->id, + 'pid' => $this->pid, + 'goods_count' => $this->goods_count, + 'sort_order' => $this->sort_order, + 'icon_type' => $this->icon_type, + 'is_show' => $this->is_show, + 'is_delete' => $this->is_delete, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + ]); + + $query->andFilterWhere(['like', 'name', $this->name]) + ->andFilterWhere(['like', 'keywords', $this->keywords]) + ->andFilterWhere(['like', 'desc', $this->desc]) + ->andFilterWhere(['like', 'icon', $this->icon]) + ->andFilterWhere(['like', 'filter_attr', $this->filter_attr]); + if ($this->created_at_range) { + $arr = explode(' ~ ', $this->created_at_range); + $start = strtotime($arr[0]); + $end = strtotime($arr[1]) + 3600 * 24; + $query->andFilterWhere(['between', 'created_at', $start, $end]); + } + return $dataProvider; + } +} diff --git a/vendor/antgoods/goods/src/views/shopcategory/_form.php b/vendor/antgoods/goods/src/views/shopcategory/_form.php new file mode 100644 index 0000000..1c3efe6 --- /dev/null +++ b/vendor/antgoods/goods/src/views/shopcategory/_form.php @@ -0,0 +1,41 @@ + + +
+ + + + field($model, 'name')->textInput(['maxlength' => true]) ?> + + field($model, 'goods_count')->textInput() ?> + + field($model, 'keywords')->textInput(['maxlength' => true]) ?> + + field($model, 'desc')->textInput(['maxlength' => true]) ?> + + field($model, 'sort_order')->textInput() ?> + + field($model, 'icon_type')->textInput() ?> + + field($model, 'icon')->textInput(['maxlength' => true]) ?> + + field($model, 'filter_attr')->textarea(['rows' => 6]) ?> + + field($model, 'is_show')->widget(Icheck::className(), ["items" => $model::$isShow, 'type' => "radio"]) ?> + +
+ 'btn btn-success']) ?> + 'btn btn-info']) ?> +
+ + + +
diff --git a/vendor/antgoods/goods/src/views/shopcategory/_search.php b/vendor/antgoods/goods/src/views/shopcategory/_search.php new file mode 100644 index 0000000..1e839e6 --- /dev/null +++ b/vendor/antgoods/goods/src/views/shopcategory/_search.php @@ -0,0 +1,49 @@ + + + ['index'], + 'method' => 'get', + 'validateOnType' => true, + ]); +?> +
+
+ field($model, 'id', [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "检索ID", + "class" => "form-control", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ]) + ?> +
+
+ field($model, "created_at_range", [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "创建时间", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ])->widget(DateRangePicker::className()); + ?> +
+
+ ', ['class' => 'btn btn-default']) ?> + ', ['class' => 'btn btn-default']) ?> +
+
+ \ No newline at end of file diff --git a/vendor/antgoods/goods/src/views/shopcategory/create.php b/vendor/antgoods/goods/src/views/shopcategory/create.php new file mode 100644 index 0000000..ff6a2cd --- /dev/null +++ b/vendor/antgoods/goods/src/views/shopcategory/create.php @@ -0,0 +1,18 @@ +title = '创建前端商品分类'; +$this->params['breadcrumbs'][] = ['label' => '前端商品分类', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/vendor/antgoods/goods/src/views/shopcategory/index.php b/vendor/antgoods/goods/src/views/shopcategory/index.php new file mode 100644 index 0000000..af3692d --- /dev/null +++ b/vendor/antgoods/goods/src/views/shopcategory/index.php @@ -0,0 +1,28 @@ +title = '前端商品分类'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+
+ $dataProvider, + 'filter' => $this->render("_search", ['model' => $searchModel]), + 'batch' => [ + [ + "label" => "删除", + "url" => "shopcategory/deletes" + ], + ], + 'columns' => $columns + ]); + ?> +
+
\ No newline at end of file diff --git a/vendor/antgoods/goods/src/views/shopcategory/update.php b/vendor/antgoods/goods/src/views/shopcategory/update.php new file mode 100644 index 0000000..d59515f --- /dev/null +++ b/vendor/antgoods/goods/src/views/shopcategory/update.php @@ -0,0 +1,19 @@ +title = '编辑前端商品分类: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => '前端商品分类', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; +$this->params['breadcrumbs'][] = '编辑 '; +?> +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/vendor/antgoods/goods/src/views/shopcategory/view.php b/vendor/antgoods/goods/src/views/shopcategory/view.php new file mode 100644 index 0000000..23f9c29 --- /dev/null +++ b/vendor/antgoods/goods/src/views/shopcategory/view.php @@ -0,0 +1,40 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => '前端商品分类', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> +
+ +

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

+ + $model, + 'attributes' => [ + 'id', + 'name', + 'pid', + 'goods_count', + 'keywords', + 'desc', + 'sort_order', + 'icon_type', + 'icon', + 'filter_attr:ntext', + 'is_show', + 'is_delete', + 'created_at', + 'updated_at', + ], + ]) ?> + +
From 08b43dff7eedb759ba98f4d640fcb2a01796f797 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 11:46:35 +0800 Subject: [PATCH 047/102] =?UTF-8?q?antgoods=E6=A8=A1=E5=9D=97=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=A7=84=E6=A0=BC=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/views/layouts/sidebar.php | 1 + .../src}/controllers/AttributeController.php | 24 ++- .../src/models/searchs/AttributeSearch.php | 147 ++++++++++++++++++ .../goods/src}/views/attribute/_form.php | 2 +- .../goods/src}/views/attribute/_search.php | 2 +- .../goods/src}/views/attribute/create.php | 2 +- .../goods/src}/views/attribute/index.php | 2 +- .../goods/src}/views/attribute/update.php | 2 +- .../goods/src}/views/attribute/view.php | 2 +- 9 files changed, 165 insertions(+), 19 deletions(-) rename {backend => vendor/antgoods/goods/src}/controllers/AttributeController.php (89%) mode change 100755 => 100644 create mode 100644 vendor/antgoods/goods/src/models/searchs/AttributeSearch.php rename {backend => vendor/antgoods/goods/src}/views/attribute/_form.php (93%) mode change 100755 => 100644 rename {backend => vendor/antgoods/goods/src}/views/attribute/_search.php (94%) mode change 100755 => 100644 rename {backend => vendor/antgoods/goods/src}/views/attribute/create.php (86%) mode change 100755 => 100644 rename {backend => vendor/antgoods/goods/src}/views/attribute/index.php (91%) mode change 100755 => 100644 rename {backend => vendor/antgoods/goods/src}/views/attribute/update.php (89%) mode change 100755 => 100644 rename {backend => vendor/antgoods/goods/src}/views/attribute/view.php (92%) mode change 100755 => 100644 diff --git a/backend/views/layouts/sidebar.php b/backend/views/layouts/sidebar.php index c8f8ada..63c126a 100755 --- a/backend/views/layouts/sidebar.php +++ b/backend/views/layouts/sidebar.php @@ -21,6 +21,7 @@ use iron\widgets\Menu; ] ], ['label' => '商品管理', 'url' => '#', 'icon' => 'far fa-archive', 'items' => [ + ['label' => '规格管理', 'url' => ['/antgoods/attribute/index']], ['label' => '商品列表', 'url' => ['/antgoods/goods/index']], ['label' => '后台商品分类', 'url' => ['/antgoods/category/index']], ['label' => '前端商品分类', 'url' => ['/antgoods/shopcategory/index']], diff --git a/backend/controllers/AttributeController.php b/vendor/antgoods/goods/src/controllers/AttributeController.php old mode 100755 new mode 100644 similarity index 89% rename from backend/controllers/AttributeController.php rename to vendor/antgoods/goods/src/controllers/AttributeController.php index a4b35c7..bc99f99 --- a/backend/controllers/AttributeController.php +++ b/vendor/antgoods/goods/src/controllers/AttributeController.php @@ -1,11 +1,10 @@ $searchModel, 'dataProvider' => $dataProvider, 'columns' => $searchModel->columns() - ]); + ]); } /** @@ -126,25 +125,24 @@ class AttributeController extends Controller throw new NotFoundHttpException('The requested page does not exist.'); } - /** - * @author iron - * 文件导出 - */ + * @author iron + * 文件导出 + */ public function actionExport() { - $searchModel = new attributeSearch(); + $searchModel = new AttributeSearch(); $params = Yii::$app->request->queryParams; if ($params['page-type'] == 'all') { - $dataProvider = $searchModel->allData($params); + $dataProvider = $searchModel->allData($params); } else { $dataProvider = $searchModel->search($params); } - \iron\widget\Excel::export([ + \iron\widget\Excel::export([ 'models' => $dataProvider->getModels(), 'format' => 'Xlsx', 'asAttachment' => true, - 'fileName' => 'Attributes' . "-" . date('Y-m-d H/i/s', time()), + 'fileName' =>'Attributes'. "-" .date('Y-m-d H/i/s', time()), 'columns' => $searchModel->columns() ]); } diff --git a/vendor/antgoods/goods/src/models/searchs/AttributeSearch.php b/vendor/antgoods/goods/src/models/searchs/AttributeSearch.php new file mode 100644 index 0000000..f5cc763 --- /dev/null +++ b/vendor/antgoods/goods/src/models/searchs/AttributeSearch.php @@ -0,0 +1,147 @@ + 'blobt\grid\CheckboxColumn', + 'width' => '2%', + 'align' => 'center' + ], + 'id', + 'name', + 'value', + 'type', + 'sort_order', + //'is_delete', + //'created_at', + //'updated_at', + [ + 'class' => 'iron\grid\ActionColumn', + 'align' => 'center', + ], + ]; + } + /** + * @param $params + * @return ActiveDataProvider + * 不分页的所有数据 + */ + public function allData($params) + { + $query = Attribute::find(); + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'pagination' => false, + 'sort' => false + ]); + $this->load($params); + return $this->filter($query, $dataProvider); + } + + /** + * Creates data provider instance with search query applied + * + * @param array $params + * + * @return ActiveDataProvider + */ + public function search($params) + { + $query = Attribute::find(); + + // add conditions that should always apply here + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'pagination' => [ + 'pageSizeLimit' => [1, 200] + ], + 'sort' => [ + 'defaultOrder' => [ + 'id' => SORT_DESC, + ] + ], + ]); + + $this->load($params); + return $this->filter($query, $dataProvider); + } + /** + * @param $query + * @param $dataProvider + * @return ActiveDataProvider + * 条件筛选 + */ + private function filter($query, $dataProvider){ + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'id' => $this->id, + 'type' => $this->type, + 'sort_order' => $this->sort_order, + 'is_delete' => $this->is_delete, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + ]); + + $query->andFilterWhere(['like', 'name', $this->name]) + ->andFilterWhere(['like', 'value', $this->value]); + if ($this->created_at_range) { + $arr = explode(' ~ ', $this->created_at_range); + $start = strtotime($arr[0]); + $end = strtotime($arr[1]) + 3600 * 24; + $query->andFilterWhere(['between', 'created_at', $start, $end]); + } + return $dataProvider; + } +} diff --git a/backend/views/attribute/_form.php b/vendor/antgoods/goods/src/views/attribute/_form.php old mode 100755 new mode 100644 similarity index 93% rename from backend/views/attribute/_form.php rename to vendor/antgoods/goods/src/views/attribute/_form.php index de4e895..7d6644c --- a/backend/views/attribute/_form.php +++ b/vendor/antgoods/goods/src/views/attribute/_form.php @@ -4,7 +4,7 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; /* @var $this yii\web\View */ -/* @var $model common\models\ars\Attribute */ +/* @var $model antgoods\goods\models\ars\Attribute */ /* @var $form yii\widgets\ActiveForm */ ?> diff --git a/backend/views/attribute/_search.php b/vendor/antgoods/goods/src/views/attribute/_search.php old mode 100755 new mode 100644 similarity index 94% rename from backend/views/attribute/_search.php rename to vendor/antgoods/goods/src/views/attribute/_search.php index e8f58ee..0a9d3be --- a/backend/views/attribute/_search.php +++ b/vendor/antgoods/goods/src/views/attribute/_search.php @@ -5,7 +5,7 @@ use yii\widgets\ActiveForm; use \blobt\widgets\DateRangePicker; /* @var $this yii\web\View */ -/* @var $model common\models\searchs\attributeSearch */ +/* @var $model common\models\searchs\AttributeSearch */ /* @var $form yii\widgets\ActiveForm */ ?> diff --git a/backend/views/attribute/create.php b/vendor/antgoods/goods/src/views/attribute/create.php old mode 100755 new mode 100644 similarity index 86% rename from backend/views/attribute/create.php rename to vendor/antgoods/goods/src/views/attribute/create.php index d5578e6..1eaf0e4 --- a/backend/views/attribute/create.php +++ b/vendor/antgoods/goods/src/views/attribute/create.php @@ -3,7 +3,7 @@ use yii\helpers\Html; /* @var $this yii\web\View */ -/* @var $model common\models\ars\Attribute */ +/* @var $model antgoods\goods\models\ars\Attribute */ $this->title = '创建 Attribute'; $this->params['breadcrumbs'][] = ['label' => 'Attributes', 'url' => ['index']]; diff --git a/backend/views/attribute/index.php b/vendor/antgoods/goods/src/views/attribute/index.php old mode 100755 new mode 100644 similarity index 91% rename from backend/views/attribute/index.php rename to vendor/antgoods/goods/src/views/attribute/index.php index 3b9e384..6bdf668 --- a/backend/views/attribute/index.php +++ b/vendor/antgoods/goods/src/views/attribute/index.php @@ -4,7 +4,7 @@ use yii\helpers\Html; use iron\grid\GridView; /* @var $this yii\web\View */ -/* @var $searchModel common\models\searchs\attributeSearch */ +/* @var $searchModel common\models\searchs\AttributeSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Attributes'; diff --git a/backend/views/attribute/update.php b/vendor/antgoods/goods/src/views/attribute/update.php old mode 100755 new mode 100644 similarity index 89% rename from backend/views/attribute/update.php rename to vendor/antgoods/goods/src/views/attribute/update.php index 4532da0..e48b930 --- a/backend/views/attribute/update.php +++ b/vendor/antgoods/goods/src/views/attribute/update.php @@ -3,7 +3,7 @@ use yii\helpers\Html; /* @var $this yii\web\View */ -/* @var $model common\models\ars\Attribute */ +/* @var $model antgoods\goods\models\ars\Attribute */ $this->title = '编辑 Attribute: ' . $model->name; $this->params['breadcrumbs'][] = ['label' => 'Attributes', 'url' => ['index']]; diff --git a/backend/views/attribute/view.php b/vendor/antgoods/goods/src/views/attribute/view.php old mode 100755 new mode 100644 similarity index 92% rename from backend/views/attribute/view.php rename to vendor/antgoods/goods/src/views/attribute/view.php index 8e54adb..beac055 --- a/backend/views/attribute/view.php +++ b/vendor/antgoods/goods/src/views/attribute/view.php @@ -4,7 +4,7 @@ use yii\helpers\Html; use yii\widgets\DetailView; /* @var $this yii\web\View */ -/* @var $model common\models\ars\Attribute */ +/* @var $model antgoods\goods\models\ars\Attribute */ $this->title = $model->name; $this->params['breadcrumbs'][] = ['label' => 'Attributes', 'url' => ['index']]; From 79ec8930f1450ce06e35f8402613184745166ce0 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 13:42:41 +0800 Subject: [PATCH 048/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9antgoods=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E8=A7=84=E6=A0=BC=E6=A8=A1=E5=9D=97=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/models/ars/Attribute.php | 3 +++ .../antgoods/goods/src/models/searchs/AttributeSearch.php | 1 + vendor/antgoods/goods/src/views/attribute/_form.php | 2 -- vendor/antgoods/goods/src/views/attribute/create.php | 4 ++-- vendor/antgoods/goods/src/views/attribute/index.php | 2 +- vendor/antgoods/goods/src/views/attribute/update.php | 4 ++-- vendor/antgoods/goods/src/views/attribute/view.php | 7 +++---- vendor/antgoods/goods/src/views/goods/view.php | 4 ++-- vendor/antgoods/goods/src/views/shopcategory/view.php | 4 ++-- 9 files changed, 16 insertions(+), 15 deletions(-) diff --git a/vendor/antgoods/goods/src/models/ars/Attribute.php b/vendor/antgoods/goods/src/models/ars/Attribute.php index c68e652..c3b2675 100644 --- a/vendor/antgoods/goods/src/models/ars/Attribute.php +++ b/vendor/antgoods/goods/src/models/ars/Attribute.php @@ -19,6 +19,9 @@ use yii\behaviors\TimestampBehavior; */ class Attribute extends \yii\db\ActiveRecord { + //是否删除is_delete + const IS_DELETE_NO = 0;//未删除 + const IS_DELETE_YES = 1;//已删除 /** * {@inheritdoc} */ diff --git a/vendor/antgoods/goods/src/models/searchs/AttributeSearch.php b/vendor/antgoods/goods/src/models/searchs/AttributeSearch.php index f5cc763..b06e242 100644 --- a/vendor/antgoods/goods/src/models/searchs/AttributeSearch.php +++ b/vendor/antgoods/goods/src/models/searchs/AttributeSearch.php @@ -118,6 +118,7 @@ class AttributeSearch extends Attribute * 条件筛选 */ 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'); diff --git a/vendor/antgoods/goods/src/views/attribute/_form.php b/vendor/antgoods/goods/src/views/attribute/_form.php index 7d6644c..75c5ddf 100644 --- a/vendor/antgoods/goods/src/views/attribute/_form.php +++ b/vendor/antgoods/goods/src/views/attribute/_form.php @@ -20,8 +20,6 @@ use yii\widgets\ActiveForm; field($model, 'sort_order')->textInput() ?> - field($model, 'is_delete')->textInput() ?> -
'btn btn-success']) ?> 'btn btn-info']) ?> diff --git a/vendor/antgoods/goods/src/views/attribute/create.php b/vendor/antgoods/goods/src/views/attribute/create.php index 1eaf0e4..6aa1ff6 100644 --- a/vendor/antgoods/goods/src/views/attribute/create.php +++ b/vendor/antgoods/goods/src/views/attribute/create.php @@ -5,8 +5,8 @@ use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Attribute */ -$this->title = '创建 Attribute'; -$this->params['breadcrumbs'][] = ['label' => 'Attributes', 'url' => ['index']]; +$this->title = '创建规格'; +$this->params['breadcrumbs'][] = ['label' => '规格管理', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?>
diff --git a/vendor/antgoods/goods/src/views/attribute/index.php b/vendor/antgoods/goods/src/views/attribute/index.php index 6bdf668..b147a9f 100644 --- a/vendor/antgoods/goods/src/views/attribute/index.php +++ b/vendor/antgoods/goods/src/views/attribute/index.php @@ -7,7 +7,7 @@ use iron\grid\GridView; /* @var $searchModel common\models\searchs\AttributeSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ -$this->title = 'Attributes'; +$this->title = '规格管理'; $this->params['breadcrumbs'][] = $this->title; ?>
diff --git a/vendor/antgoods/goods/src/views/attribute/update.php b/vendor/antgoods/goods/src/views/attribute/update.php index e48b930..0f412bc 100644 --- a/vendor/antgoods/goods/src/views/attribute/update.php +++ b/vendor/antgoods/goods/src/views/attribute/update.php @@ -5,8 +5,8 @@ use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Attribute */ -$this->title = '编辑 Attribute: ' . $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Attributes', 'url' => ['index']]; +$this->title = '编辑规格: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => '规格管理', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; $this->params['breadcrumbs'][] = 'Update '; ?> diff --git a/vendor/antgoods/goods/src/views/attribute/view.php b/vendor/antgoods/goods/src/views/attribute/view.php index beac055..87eaed1 100644 --- a/vendor/antgoods/goods/src/views/attribute/view.php +++ b/vendor/antgoods/goods/src/views/attribute/view.php @@ -7,7 +7,7 @@ use yii\widgets\DetailView; /* @var $model antgoods\goods\models\ars\Attribute */ $this->title = $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Attributes', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => '规格管理', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; \yii\web\YiiAsset::register($this); ?> @@ -25,9 +25,8 @@ $this->params['breadcrumbs'][] = $this->title; 'value:ntext', 'type', 'sort_order', - 'is_delete', - 'created_at', - 'updated_at', + 'created_at:datetime', + 'updated_at:datetime', ], ]) ?> diff --git a/vendor/antgoods/goods/src/views/goods/view.php b/vendor/antgoods/goods/src/views/goods/view.php index c70b22e..5f51770 100644 --- a/vendor/antgoods/goods/src/views/goods/view.php +++ b/vendor/antgoods/goods/src/views/goods/view.php @@ -51,8 +51,8 @@ $this->params['breadcrumbs'][] = $this->title; 'experience_points', 'is_delete', 'express_template', - 'created_at', - 'updated_at', + 'created_at:datetime', + 'updated_at:datetime', ], ]) ?> diff --git a/vendor/antgoods/goods/src/views/shopcategory/view.php b/vendor/antgoods/goods/src/views/shopcategory/view.php index 23f9c29..7157fb0 100644 --- a/vendor/antgoods/goods/src/views/shopcategory/view.php +++ b/vendor/antgoods/goods/src/views/shopcategory/view.php @@ -32,8 +32,8 @@ $this->params['breadcrumbs'][] = $this->title; 'filter_attr:ntext', 'is_show', 'is_delete', - 'created_at', - 'updated_at', + 'created_at:datetime', + 'updated_at:datetime', ], ]) ?> From 2b6c1cc2d97336fd35d4cb7368399924d7004ebb Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 13:52:52 +0800 Subject: [PATCH 049/102] =?UTF-8?q?antgoods=E6=A8=A1=E5=9D=97=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BE=9B=E5=BA=94=E5=95=86=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/views/layouts/sidebar.php | 1 + .../goods/src}/controllers/SupplierController.php | 6 +++--- vendor/antgoods/goods/src/models/ars/Supplier.php | 3 +++ .../goods/src}/models/searchs/SupplierSearch.php | 7 ++++--- .../antgoods/goods/src}/views/supplier/_form.php | 4 +--- .../antgoods/goods/src}/views/supplier/_search.php | 8 +++++--- .../antgoods/goods/src}/views/supplier/create.php | 6 +++--- .../antgoods/goods/src}/views/supplier/index.php | 6 +++--- .../antgoods/goods/src}/views/supplier/update.php | 8 ++++---- .../antgoods/goods/src}/views/supplier/view.php | 9 ++++----- 10 files changed, 31 insertions(+), 27 deletions(-) rename {backend => vendor/antgoods/goods/src}/controllers/SupplierController.php (96%) mode change 100755 => 100644 rename {common => vendor/antgoods/goods/src}/models/searchs/SupplierSearch.php (95%) mode change 100755 => 100644 rename {backend => vendor/antgoods/goods/src}/views/supplier/_form.php (87%) mode change 100755 => 100644 rename {backend => vendor/antgoods/goods/src}/views/supplier/_search.php (92%) mode change 100755 => 100644 rename {backend => vendor/antgoods/goods/src}/views/supplier/create.php (56%) mode change 100755 => 100644 rename {backend => vendor/antgoods/goods/src}/views/supplier/index.php (88%) mode change 100755 => 100644 rename {backend => vendor/antgoods/goods/src}/views/supplier/update.php (53%) mode change 100755 => 100644 rename {backend => vendor/antgoods/goods/src}/views/supplier/view.php (72%) mode change 100755 => 100644 diff --git a/backend/views/layouts/sidebar.php b/backend/views/layouts/sidebar.php index 63c126a..7fd5971 100755 --- a/backend/views/layouts/sidebar.php +++ b/backend/views/layouts/sidebar.php @@ -26,6 +26,7 @@ use iron\widgets\Menu; ['label' => '后台商品分类', 'url' => ['/antgoods/category/index']], ['label' => '前端商品分类', 'url' => ['/antgoods/shopcategory/index']], ['label' => '品牌管理', 'url' => ['/antgoods/brand/index']], + ['label' => '供应商管理', 'url' => ['/antgoods/supplier/index']], ] ], ['label' => '订单管理', 'url' => '#', 'icon' => 'far fa-list-alt', 'items' => [ diff --git a/backend/controllers/SupplierController.php b/vendor/antgoods/goods/src/controllers/SupplierController.php old mode 100755 new mode 100644 similarity index 96% rename from backend/controllers/SupplierController.php rename to vendor/antgoods/goods/src/controllers/SupplierController.php index b538566..cdc6a80 --- a/backend/controllers/SupplierController.php +++ b/vendor/antgoods/goods/src/controllers/SupplierController.php @@ -1,10 +1,10 @@ andFilterWhere(['is_delete' => Supplier::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'); diff --git a/backend/views/supplier/_form.php b/vendor/antgoods/goods/src/views/supplier/_form.php old mode 100755 new mode 100644 similarity index 87% rename from backend/views/supplier/_form.php rename to vendor/antgoods/goods/src/views/supplier/_form.php index dde074b..06b6109 --- a/backend/views/supplier/_form.php +++ b/vendor/antgoods/goods/src/views/supplier/_form.php @@ -4,7 +4,7 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; /* @var $this yii\web\View */ -/* @var $model common\models\ars\Supplier */ +/* @var $model antgoods\goods\models\ars\Supplier */ /* @var $form yii\widgets\ActiveForm */ ?> @@ -20,8 +20,6 @@ use yii\widgets\ActiveForm; field($model, 'address')->textInput(['maxlength' => true]) ?> - field($model, 'is_delete')->textInput() ?> -
'btn btn-success']) ?> 'btn btn-info']) ?> diff --git a/backend/views/supplier/_search.php b/vendor/antgoods/goods/src/views/supplier/_search.php old mode 100755 new mode 100644 similarity index 92% rename from backend/views/supplier/_search.php rename to vendor/antgoods/goods/src/views/supplier/_search.php index f014a90..1f00e41 --- a/backend/views/supplier/_search.php +++ b/vendor/antgoods/goods/src/views/supplier/_search.php @@ -15,8 +15,8 @@ use \blobt\widgets\DateRangePicker; 'validateOnType' => true, ]); ?> -
-
+
+
field($model, 'id', [ "template" => "{input}{error}", "inputOptions" => [ @@ -28,6 +28,8 @@ use \blobt\widgets\DateRangePicker; ] ]) ?> +
+
field($model, "created_at_range", [ "template" => "{input}{error}", "inputOptions" => [ @@ -38,10 +40,10 @@ use \blobt\widgets\DateRangePicker; ] ])->widget(DateRangePicker::className()); ?> +
', ['class' => 'btn btn-default']) ?> ', ['class' => 'btn btn-default']) ?>
-
\ No newline at end of file diff --git a/backend/views/supplier/create.php b/vendor/antgoods/goods/src/views/supplier/create.php old mode 100755 new mode 100644 similarity index 56% rename from backend/views/supplier/create.php rename to vendor/antgoods/goods/src/views/supplier/create.php index eeb7fb0..86b9e63 --- a/backend/views/supplier/create.php +++ b/vendor/antgoods/goods/src/views/supplier/create.php @@ -3,10 +3,10 @@ use yii\helpers\Html; /* @var $this yii\web\View */ -/* @var $model common\models\ars\Supplier */ +/* @var $model antgoods\goods\models\ars\Supplier */ -$this->title = '创建 Supplier'; -$this->params['breadcrumbs'][] = ['label' => 'Suppliers', 'url' => ['index']]; +$this->title = '创建供应商'; +$this->params['breadcrumbs'][] = ['label' => '供应商管理', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?>
diff --git a/backend/views/supplier/index.php b/vendor/antgoods/goods/src/views/supplier/index.php old mode 100755 new mode 100644 similarity index 88% rename from backend/views/supplier/index.php rename to vendor/antgoods/goods/src/views/supplier/index.php index 1c15fb2..bad1e50 --- a/backend/views/supplier/index.php +++ b/vendor/antgoods/goods/src/views/supplier/index.php @@ -1,17 +1,17 @@ title = 'Suppliers'; +$this->title = '供应商管理'; $this->params['breadcrumbs'][] = $this->title; ?>
-
+
$dataProvider, 'filter' => $this->render("_search", ['model' => $searchModel]), diff --git a/backend/views/supplier/update.php b/vendor/antgoods/goods/src/views/supplier/update.php old mode 100755 new mode 100644 similarity index 53% rename from backend/views/supplier/update.php rename to vendor/antgoods/goods/src/views/supplier/update.php index b2b5eec..04906ee --- a/backend/views/supplier/update.php +++ b/vendor/antgoods/goods/src/views/supplier/update.php @@ -3,12 +3,12 @@ use yii\helpers\Html; /* @var $this yii\web\View */ -/* @var $model common\models\ars\Supplier */ +/* @var $model antgoods\goods\models\ars\Supplier */ -$this->title = '编辑 Supplier: ' . $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Suppliers', 'url' => ['index']]; +$this->title = '编辑供应商: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => '供应商管理', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; -$this->params['breadcrumbs'][] = 'Update '; +$this->params['breadcrumbs'][] = '编辑 '; ?>
diff --git a/backend/views/supplier/view.php b/vendor/antgoods/goods/src/views/supplier/view.php old mode 100755 new mode 100644 similarity index 72% rename from backend/views/supplier/view.php rename to vendor/antgoods/goods/src/views/supplier/view.php index 9fef302..f9a1fd2 --- a/backend/views/supplier/view.php +++ b/vendor/antgoods/goods/src/views/supplier/view.php @@ -4,10 +4,10 @@ use yii\helpers\Html; use yii\widgets\DetailView; /* @var $this yii\web\View */ -/* @var $model common\models\ars\Supplier */ +/* @var $model antgoods\goods\models\ars\Supplier */ $this->title = $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Suppliers', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => '供应商管理', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; \yii\web\YiiAsset::register($this); ?> @@ -25,9 +25,8 @@ $this->params['breadcrumbs'][] = $this->title; 'full_name', 'phone', 'address', - 'is_delete', - 'created_at', - 'updated_at', + 'created_at:datetime', + 'updated_at:datetime', ], ]) ?> From e7c91f1b08c749cdbbe207d5815a3c528afc9ae6 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 14:21:07 +0800 Subject: [PATCH 050/102] =?UTF-8?q?=E5=95=86=E5=93=81=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90=E5=95=86=E5=93=81=E5=94=AF?= =?UTF-8?q?=E4=B8=80=E8=B4=A7=E5=8F=B7=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../antgoods/goods/src/models/ars/Brand.php | 2 +- .../goods/src/models/ars/Category.php | 6 ++- .../antgoods/goods/src/models/ars/Goods.php | 42 ++++++++++++++++++- .../goods/src/models/ars/ShopCategory.php | 9 ++++ .../antgoods/goods/src/views/goods/_form.php | 5 ++- 5 files changed, 59 insertions(+), 5 deletions(-) diff --git a/vendor/antgoods/goods/src/models/ars/Brand.php b/vendor/antgoods/goods/src/models/ars/Brand.php index f3e49b5..e577b1d 100644 --- a/vendor/antgoods/goods/src/models/ars/Brand.php +++ b/vendor/antgoods/goods/src/models/ars/Brand.php @@ -77,6 +77,6 @@ class Brand extends \yii\db\ActiveRecord public static function modelColumn() { - return $column = Brand::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column(); + return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column(); } } diff --git a/vendor/antgoods/goods/src/models/ars/Category.php b/vendor/antgoods/goods/src/models/ars/Category.php index 7d4fa46..a64511a 100644 --- a/vendor/antgoods/goods/src/models/ars/Category.php +++ b/vendor/antgoods/goods/src/models/ars/Category.php @@ -97,8 +97,12 @@ class Category extends \yii\db\ActiveRecord ]; } + /** + * @return array + * 数据键值对 + */ public static function modelColumn() { - return $column = Category::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column(); + return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column(); } } diff --git a/vendor/antgoods/goods/src/models/ars/Goods.php b/vendor/antgoods/goods/src/models/ars/Goods.php index 2434e83..0a102b9 100644 --- a/vendor/antgoods/goods/src/models/ars/Goods.php +++ b/vendor/antgoods/goods/src/models/ars/Goods.php @@ -47,6 +47,13 @@ class Goods extends \yii\db\ActiveRecord //是否删除is_delete const IS_DELETE_NO = 0;//未删除 const IS_DELETE_YES = 1;//已删除 + //该商品是否开放销售is_sale + const IS_SALE_NO = 0;//否 + const IS_SALE_YES = 1;//是 + public static $isSale = [ + self::IS_SALE_NO => '否', + self::IS_SALE_YES => '是' + ]; /** * {@inheritdoc} */ @@ -63,6 +70,7 @@ class Goods extends \yii\db\ActiveRecord 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'], 'integer'], [['cat_id', 'brand_id', 'shop_cat_id', 'name', 'sn'], 'required'], + [['sn'], 'checkExist'], [['description'], 'string'], [['name'], 'string', 'max' => 120], [['sn'], 'string', 'max' => 60], @@ -72,6 +80,25 @@ class Goods extends \yii\db\ActiveRecord ]; } + /** + * @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} */ @@ -103,7 +130,7 @@ class Goods extends \yii\db\ActiveRecord 'description' => '详细介绍', 'image' => '图片id', 'model_id' => '模型id', - 'is_sale' => '该商品是否开放销售,1为是,0为否', + 'is_sale' => '该商品是否开放销售', 'sort_order' => '排序', 'bouns_points' => '奖励积分', 'experience_points' => '经验值', @@ -135,4 +162,17 @@ class Goods extends \yii\db\ActiveRecord ], ]; } + + /** + * @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 + } } diff --git a/vendor/antgoods/goods/src/models/ars/ShopCategory.php b/vendor/antgoods/goods/src/models/ars/ShopCategory.php index a848f51..92fa87e 100644 --- a/vendor/antgoods/goods/src/models/ars/ShopCategory.php +++ b/vendor/antgoods/goods/src/models/ars/ShopCategory.php @@ -105,4 +105,13 @@ class ShopCategory extends \yii\db\ActiveRecord ], ]; } + + /** + * @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/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index a944d3e..4dba452 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -4,6 +4,7 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; use antgoods\goods\models\ars\Category; use antgoods\goods\models\ars\Brand; +use antgoods\goods\models\ars\ShopCategory; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Goods */ @@ -18,7 +19,7 @@ use antgoods\goods\models\ars\Brand; field($model, 'brand_id')->dropDownList(Brand::modelColumn(), ['prompt' => '请选择']) ?> - field($model, 'shop_cat_id')->textInput() ?> + field($model, 'shop_cat_id')->dropDownList(ShopCategory::modelColumn(), ['prompt' => '请选择']) ?> field($model, 'name')->textInput(['maxlength' => true]) ?> @@ -60,7 +61,7 @@ use antgoods\goods\models\ars\Brand; field($model, 'model_id')->textInput() ?> - field($model, 'is_sale')->textInput() ?> + field($model, 'is_sale')->radioList($model::$isSale) ?> field($model, 'sort_order')->textInput() ?> From 79327ab225691c36b0c988e2e9512541f732462d Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 14:24:03 +0800 Subject: [PATCH 051/102] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=95=86=E5=93=81?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E4=BE=9B=E5=BA=94=E5=95=86=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/models/ars/Supplier.php | 9 +++++++++ vendor/antgoods/goods/src/views/goods/_form.php | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/vendor/antgoods/goods/src/models/ars/Supplier.php b/vendor/antgoods/goods/src/models/ars/Supplier.php index 899b173..e30b599 100644 --- a/vendor/antgoods/goods/src/models/ars/Supplier.php +++ b/vendor/antgoods/goods/src/models/ars/Supplier.php @@ -81,4 +81,13 @@ class Supplier extends \yii\db\ActiveRecord ], ]; } + + /** + * @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/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index 4dba452..6efd34f 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -5,6 +5,7 @@ use yii\widgets\ActiveForm; use antgoods\goods\models\ars\Category; use antgoods\goods\models\ars\Brand; use antgoods\goods\models\ars\ShopCategory; +use antgoods\goods\models\ars\Supplier; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Goods */ @@ -27,7 +28,7 @@ use antgoods\goods\models\ars\ShopCategory; field($model, 'code')->textInput(['maxlength' => true]) ?> - field($model, 'supplier_id')->textInput() ?> + field($model, 'supplier_id')->dropDownList(Supplier::modelColumn(), ['prompt' => '请选择']) ?> field($model, 'weight')->textInput() ?> From f13496baad418d879ae3455fb50b4a7a31eb8f94 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 14:31:38 +0800 Subject: [PATCH 052/102] =?UTF-8?q?antgoods=E6=A8=A1=E5=9D=97=E5=95=86?= =?UTF-8?q?=E5=93=81=E8=A1=A8=E5=8D=95=E4=B8=AD=E5=88=A0=E9=99=A4=E5=B7=B2?= =?UTF-8?q?=E5=94=AE=E6=95=B0=E9=87=8F=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/views/goods/_form.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index 6efd34f..6cbf21f 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -42,8 +42,6 @@ use antgoods\goods\models\ars\Supplier; field($model, 'unit')->textInput(['maxlength' => true]) ?> - field($model, 'sold_count')->textInput() ?> - field($model, 'limit_count')->textInput() ?> field($model, 'stock')->textInput() ?> From 5638c95582f2ac4f716ea2e6afba05f02abd22fd Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 17:00:58 +0800 Subject: [PATCH 053/102] =?UTF-8?q?=E9=83=A8=E5=88=86=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=B1=8F=E8=94=BDgit=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 82f923c..bf89285 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,5 @@ phpunit.phar vendor.zip /vagrant /backend/web/uploads -dump.rdb \ No newline at end of file +dump.rdb +/console/runtime \ No newline at end of file From 48db0c93608e19fb301a12b93653d14117602489 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 18:47:32 +0800 Subject: [PATCH 054/102] =?UTF-8?q?=E5=B0=86yii=E7=9A=84activeform?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BAbootstrap4=E7=9A=84activeform?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/views/attribute/_form.php | 2 +- vendor/antgoods/goods/src/views/brand/_form.php | 2 +- vendor/antgoods/goods/src/views/category/_form.php | 2 +- vendor/antgoods/goods/src/views/goods/_form.php | 8 ++++++-- vendor/antgoods/goods/src/views/shopcategory/_form.php | 2 +- vendor/antgoods/goods/src/views/supplier/_form.php | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/vendor/antgoods/goods/src/views/attribute/_form.php b/vendor/antgoods/goods/src/views/attribute/_form.php index 75c5ddf..6984a47 100644 --- a/vendor/antgoods/goods/src/views/attribute/_form.php +++ b/vendor/antgoods/goods/src/views/attribute/_form.php @@ -1,7 +1,7 @@ field($model, 'description')->textarea(['rows' => 6]) ?> - field($model, 'image')->textInput() ?> + field($model, 'image')->widget(\iron\widgets\Upload::className(), [ + 'url' => 'upload', + 'deleteUrl' => 'imageDel', + 'dragdropWidth'=> 800 + ]) ?> field($model, 'model_id')->textInput() ?> diff --git a/vendor/antgoods/goods/src/views/shopcategory/_form.php b/vendor/antgoods/goods/src/views/shopcategory/_form.php index 1c3efe6..155b9d3 100644 --- a/vendor/antgoods/goods/src/views/shopcategory/_form.php +++ b/vendor/antgoods/goods/src/views/shopcategory/_form.php @@ -1,7 +1,7 @@ Date: Wed, 20 Nov 2019 18:50:02 +0800 Subject: [PATCH 055/102] =?UTF-8?q?gii=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90?= =?UTF-8?q?crud=E6=A8=A1=E6=9D=BFironCrud,=E5=B0=86form=E9=87=8C=E9=9D=A2y?= =?UTF-8?q?ii=E7=9A=84activeform=E4=BF=AE=E6=94=B9=E4=B8=BAbootstrap4?= =?UTF-8?q?=E7=9A=84activeform?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/iron/generators/crud/default/views/_form.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/iron/generators/crud/default/views/_form.php b/vendor/iron/generators/crud/default/views/_form.php index b370036..907426b 100644 --- a/vendor/iron/generators/crud/default/views/_form.php +++ b/vendor/iron/generators/crud/default/views/_form.php @@ -17,7 +17,7 @@ echo " use yii\helpers\Html; -use yii\widgets\ActiveForm; +use yii\bootstrap4\ActiveForm; /* @var $this yii\web\View */ /* @var $model modelClass, '\\') ?> */ From 1d2824575764723e7c2eeffc9c64bc2efd782ef5 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 19:20:15 +0800 Subject: [PATCH 056/102] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=9B=A0=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E4=B8=8A=E4=BC=A0=E6=8F=92=E4=BB=B6=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=E7=9A=84=E5=86=85=E5=AE=B9=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods/src/controllers/GoodsController.php | 10 +++++++++ .../antgoods/goods/src/views/goods/_form.php | 12 +++++----- vendor/iron/widgets/Upload.php | 22 ++++++++++--------- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index 7180f54..ce4d2a2 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -29,6 +29,16 @@ class GoodsController extends Controller ]; } + public function actions() + { + return [ + 'upload' => [ + 'class' => 'iron\actions\UploadAction', + 'path' => 'xls/' + ] + ]; + } + /** * Lists all Goods models. * @return mixed diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index 713eb61..a3268b0 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -16,6 +16,12 @@ use antgoods\goods\models\ars\Supplier; + field($model, 'image')->widget(\iron\widgets\Upload::className(), [ + 'url' => 'upload', + 'deleteUrl' => 'imageDel', + 'dragdropWidth'=> 800 + ]) ?> + field($model, 'cat_id')->dropDownList(Category::modelColumn(), ['prompt' => '请选择']) ?> field($model, 'brand_id')->dropDownList(Brand::modelColumn(), ['prompt' => '请选择']) ?> @@ -56,12 +62,6 @@ use antgoods\goods\models\ars\Supplier; field($model, 'description')->textarea(['rows' => 6]) ?> - field($model, 'image')->widget(\iron\widgets\Upload::className(), [ - 'url' => 'upload', - 'deleteUrl' => 'imageDel', - 'dragdropWidth'=> 800 - ]) ?> - field($model, 'model_id')->textInput() ?> field($model, 'is_sale')->radioList($model::$isSale) ?> diff --git a/vendor/iron/widgets/Upload.php b/vendor/iron/widgets/Upload.php index 0842c80..5c8f546 100644 --- a/vendor/iron/widgets/Upload.php +++ b/vendor/iron/widgets/Upload.php @@ -201,15 +201,17 @@ SCRIPT; */ protected function renderUploadHtml() { - return '
-
-
Upload -
- -
-
- Drag & Drop Files -
-
'; + return '
+
+
+
Upload +
+ +
+
+ Drag & Drop Files +
+
+
'; } } From 9867a31f3be1876c9e3779729297adbe98a22a37 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 20:12:28 +0800 Subject: [PATCH 057/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=93=81?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/views/goods/_form.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index a3268b0..be88d08 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -16,12 +16,6 @@ use antgoods\goods\models\ars\Supplier; - field($model, 'image')->widget(\iron\widgets\Upload::className(), [ - 'url' => 'upload', - 'deleteUrl' => 'imageDel', - 'dragdropWidth'=> 800 - ]) ?> - field($model, 'cat_id')->dropDownList(Category::modelColumn(), ['prompt' => '请选择']) ?> field($model, 'brand_id')->dropDownList(Brand::modelColumn(), ['prompt' => '请选择']) ?> @@ -58,6 +52,12 @@ use antgoods\goods\models\ars\Supplier; field($model, 'price')->textInput() ?> + field($model, 'image')->widget(\iron\widgets\Upload::className(), [ + 'url' => 'upload', + 'deleteUrl' => 'imageDel', + 'dragdropWidth'=> 800 + ]) ?> + field($model, 'brief')->textInput(['maxlength' => true]) ?> field($model, 'description')->textarea(['rows' => 6]) ?> From a541dd5780937f58068e7217182d58cdd9adb635 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 20:23:55 +0800 Subject: [PATCH 058/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=93=81?= =?UTF-8?q?=E8=A1=A8=E5=95=86=E5=93=81=E5=94=AF=E4=B8=80=E8=B4=A7=E5=8F=B7?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/migrations/sql/goods.sql | 2 +- vendor/antgoods/goods/src/models/ars/Goods.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/antgoods/goods/src/migrations/sql/goods.sql b/vendor/antgoods/goods/src/migrations/sql/goods.sql index f744a0b..fe9d9e2 100755 --- a/vendor/antgoods/goods/src/migrations/sql/goods.sql +++ b/vendor/antgoods/goods/src/migrations/sql/goods.sql @@ -6,7 +6,7 @@ CREATE TABLE `antgoods_goods` ( `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) 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 COMMENT '重量', diff --git a/vendor/antgoods/goods/src/models/ars/Goods.php b/vendor/antgoods/goods/src/models/ars/Goods.php index 0a102b9..85c68dc 100644 --- a/vendor/antgoods/goods/src/models/ars/Goods.php +++ b/vendor/antgoods/goods/src/models/ars/Goods.php @@ -69,7 +69,7 @@ class Goods extends \yii\db\ActiveRecord { 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'], 'integer'], - [['cat_id', 'brand_id', 'shop_cat_id', 'name', 'sn'], 'required'], + [['cat_id', 'brand_id', 'shop_cat_id', 'name'], 'required'], [['sn'], 'checkExist'], [['description'], 'string'], [['name'], 'string', 'max' => 120], From 420d3e959db4c9f5c99306486d32f40c004bddcf Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Thu, 21 Nov 2019 15:02:11 +0800 Subject: [PATCH 059/102] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=B1=82logic,=E5=88=9B=E5=BB=BAfile?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91=E6=96=87=E4=BB=B6FileManager.php,?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E6=A0=B9=E6=8D=AE=E6=96=87=E4=BB=B6=E6=8B=93?= =?UTF-8?q?=E5=B1=95=E5=90=8D=E5=88=A4=E6=96=AD=E6=96=87=E4=BB=B6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/config/main.php | 11 ++++++++ backend/logic/file/FileManager.php | 44 ++++++++++++++++++++++++++++++ common/models/ars/TemFile.php | 7 +++++ 3 files changed, 62 insertions(+) create mode 100644 backend/logic/file/FileManager.php diff --git a/backend/config/main.php b/backend/config/main.php index ec8c2c0..81c6961 100644 --- a/backend/config/main.php +++ b/backend/config/main.php @@ -34,6 +34,16 @@ return [ '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' => [ @@ -45,6 +55,7 @@ return [ 'rules' => [ ], ], + 'file' => ['class' => 'backend\logic\file\FileManager'], ], 'params' => $params, ]; diff --git a/backend/logic/file/FileManager.php b/backend/logic/file/FileManager.php new file mode 100644 index 0000000..cd65a41 --- /dev/null +++ b/backend/logic/file/FileManager.php @@ -0,0 +1,44 @@ + ['jpg', 'png', 'jpeg'], + TemFile::TYPE_VIDEO => ['mp4'], + TemFile::TYPE_EXCEL => [], + TemFile::TYPE_WORD => ['docx'], + TemFile::TYPE_TXT => ['txt'], + ]; + + /** + * @param $array + * @param $value + * @param int $key + * @return int + * 查看$extension数组中是否存在文件类型,不存在则返回-1 + */ + public function searchKey($array,$value, $key=-1){ + foreach($array as $k=>$row){ + if(!is_array($row)){ + if($row == $value){ + if($key != -1) { + return $key; + }else{ + return -1; + } + } + }else{ + $r = self::searchKey($row,$value, $k); + if($r != -1){ + return $r; + } + } + } + return -1; + } +} \ No newline at end of file diff --git a/common/models/ars/TemFile.php b/common/models/ars/TemFile.php index 52c228d..3123d8a 100644 --- a/common/models/ars/TemFile.php +++ b/common/models/ars/TemFile.php @@ -19,6 +19,13 @@ use yii\behaviors\TimestampBehavior; */ class TemFile extends \yii\db\ActiveRecord { + //类型type + const TYPE_IMAGE = 1;//图片 + const TYPE_VIDEO = 2;//影视 + const TYPE_EXCEL = 3;//excel表单 + const TYPE_WORD = 4;//word文本 + const TYPE_TXT = 5;//txt文本 + /** * {@inheritdoc} */ From 15b00087d5524cce125c21ce9432cd2158fd0313 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Thu, 21 Nov 2019 15:29:06 +0800 Subject: [PATCH 060/102] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E5=87=BD=E6=95=B0=E7=9A=84=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E5=90=8D=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/logic/file/FileManager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/logic/file/FileManager.php b/backend/logic/file/FileManager.php index cd65a41..4ab3ffd 100644 --- a/backend/logic/file/FileManager.php +++ b/backend/logic/file/FileManager.php @@ -22,7 +22,7 @@ class FileManager * @return int * 查看$extension数组中是否存在文件类型,不存在则返回-1 */ - public function searchKey($array,$value, $key=-1){ + public function searchType($array,$value, $key=-1){ foreach($array as $k=>$row){ if(!is_array($row)){ if($row == $value){ @@ -33,7 +33,7 @@ class FileManager } } }else{ - $r = self::searchKey($row,$value, $k); + $r = self::searchType($row,$value, $k); if($r != -1){ return $r; } From 30112194d4959d3a47d3d5ee62ace24d7f4104fb Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Thu, 21 Nov 2019 15:30:45 +0800 Subject: [PATCH 061/102] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0=E5=9B=9E=E8=B0=83=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods/src/controllers/GoodsController.php | 28 ++++++++++++++++++- .../antgoods/goods/src/views/goods/_form.php | 13 +++++---- vendor/iron/actions/UploadAction.php | 2 +- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index ce4d2a2..39e69a2 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -8,6 +8,9 @@ use antgoods\goods\models\searchs\GoodsSearch; use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; +use common\models\ars\TemFile; +use common\models\ars\File; +use backend\logic\file\FileManager; /** * GoodsController implements the CRUD actions for Goods model. @@ -34,7 +37,8 @@ class GoodsController extends Controller return [ 'upload' => [ 'class' => 'iron\actions\UploadAction', - 'path' => 'xls/' + 'path' => 'xls/', + 'maxSize' => 20480, ] ]; } @@ -156,4 +160,26 @@ class GoodsController extends Controller 'columns' => $searchModel->columns() ]); } + + /** + * 处理文件上传成功后回调保存到临时文件表中 + */ + public function actionSavefile() + { + $data = Yii::$app->request->get('data'); + $fileName = Yii::$app->request->get('fileName')[0]; + + if ($data['status'] == true) { + $model = new TemFile(); + $model->user_id = Yii::$app->user->identity->id; + $model->name = $fileName; + $type = Yii::$app->file->searchType(FileManager::$extension, pathinfo($data['path'])['extension']); + if ($type != -1) { + $model->type = $type; + } + $model->alias = $data['alias']; + $model->path = $data['path']; + $model->save(); + } + } } diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index be88d08..07366ef 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -52,12 +52,6 @@ use antgoods\goods\models\ars\Supplier; field($model, 'price')->textInput() ?> - field($model, 'image')->widget(\iron\widgets\Upload::className(), [ - 'url' => 'upload', - 'deleteUrl' => 'imageDel', - 'dragdropWidth'=> 800 - ]) ?> - field($model, 'brief')->textInput(['maxlength' => true]) ?> field($model, 'description')->textarea(['rows' => 6]) ?> @@ -74,6 +68,13 @@ use antgoods\goods\models\ars\Supplier; field($model, 'express_template')->textInput() ?> + field($model, 'image')->widget(\iron\widgets\Upload::className(), [ + 'url' => 'upload', + 'deleteUrl' => 'imageDel', + 'dragdropWidth'=> 800, + 'afterSave' => 'savefile' + ]) ?> +
'btn btn-success']) ?> 'btn btn-info']) ?> diff --git a/vendor/iron/actions/UploadAction.php b/vendor/iron/actions/UploadAction.php index ea250fe..384b7bc 100644 --- a/vendor/iron/actions/UploadAction.php +++ b/vendor/iron/actions/UploadAction.php @@ -119,7 +119,7 @@ class UploadAction extends Action // $filePath = "$savePath/$fileName.{$fileExtension}"; // file_put_contents($filePath, $bin); } - return ['status' => true, 'path' => "uploads/$this->path$fileName.{$file->extension}"]; + return ['status' => true, 'path' => "uploads/$this->path$fileName.{$file->extension}", 'alias' => $fileName . '.' . $file->extension]; } catch (\Error $e) { throw new ServerErrorHttpException($e->getMessage()); // return ['status' => false, 'info' => $e->getMessage()]; From 5e88a21821a531a7776a16f658fefca9610c094f Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Thu, 21 Nov 2019 17:23:45 +0800 Subject: [PATCH 062/102] =?UTF-8?q?=E5=A4=84=E7=90=86=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=88=A0=E9=99=A4=E6=9F=90=E5=BC=A0=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=97=B6=EF=BC=8C=E5=90=8C=E6=97=B6=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=AF=A5=E5=9B=BE=E7=89=87=E7=9A=84id=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E4=B8=94=E9=87=8D=E6=96=B0=E5=A1=AB=E5=85=A5=E5=9B=BE=E7=89=87?= =?UTF-8?q?id=E8=BE=93=E5=85=A5=E6=A1=86=E5=86=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods/src/controllers/GoodsController.php | 18 +++++++++++++ .../antgoods/goods/src/models/ars/Goods.php | 1 + .../antgoods/goods/src/views/goods/_form.php | 26 +++++++++++++++++-- vendor/iron/widgets/Upload.php | 12 +++++++++ 4 files changed, 55 insertions(+), 2 deletions(-) diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index 39e69a2..33a5ff7 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -180,6 +180,24 @@ class GoodsController extends Controller $model->alias = $data['alias']; $model->path = $data['path']; $model->save(); + return $model->id; } } + + /** + * @return string + * 点击删除按钮时同时删除字符串中的id + */ + public function actionImgIdDel() + { + $alias = Yii::$app->request->get('data')['alias']; + $imgid = Yii::$app->request->get('imgid'); + $imgidarr = explode(',', $imgid); + $temfile = TemFile::findOne(['alias' => $alias]); + if ($temfile) { + $imgidarr = array_diff($imgidarr, [$temfile->id]); + } + $imgidstr = implode(',', $imgidarr); + return $imgidstr; + } } diff --git a/vendor/antgoods/goods/src/models/ars/Goods.php b/vendor/antgoods/goods/src/models/ars/Goods.php index 85c68dc..ab00598 100644 --- a/vendor/antgoods/goods/src/models/ars/Goods.php +++ b/vendor/antgoods/goods/src/models/ars/Goods.php @@ -44,6 +44,7 @@ use yii\behaviors\TimestampBehavior; */ class Goods extends \yii\db\ActiveRecord { + public $imagePath; //是否删除is_delete const IS_DELETE_NO = 0;//未删除 const IS_DELETE_YES = 1;//已删除 diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index 07366ef..0d262c0 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -68,11 +68,33 @@ use antgoods\goods\models\ars\Supplier; field($model, 'express_template')->textInput() ?> - field($model, 'image')->widget(\iron\widgets\Upload::className(), [ + field($model, 'image')->textInput() ?> + field($model, 'imagePath')->widget(\iron\widgets\Upload::className(), [ 'url' => 'upload', 'deleteUrl' => 'imageDel', 'dragdropWidth'=> 800, - 'afterSave' => 'savefile' + 'afterSave' => 'savefile', + 'successScript' => " + success: function(data) + { + var imageval = $('#goods-image').val(); + if(imageval == ''){ + $('#goods-image').val(data); + }else{ + $('#goods-image').val($('#goods-image').val()+','+data); + } + } + ", + 'deleteScript' => " + $.ajax({ + url: 'img-id-del', + data: {data: data, imgid: $('#goods-image').val()}, + success: function(data) + { + $('#goods-image').val(data); + }, + }); + ", ]) ?>
diff --git a/vendor/iron/widgets/Upload.php b/vendor/iron/widgets/Upload.php index 5c8f546..3486a4b 100644 --- a/vendor/iron/widgets/Upload.php +++ b/vendor/iron/widgets/Upload.php @@ -96,6 +96,16 @@ class Upload extends InputWidget * 拉拽框大小 */ public $dragdropWidth; + /** + * @var javascript + * 图片上传成功回调方法 + */ + public $successScript; + /** + * @var + * 删除图片触发方法 + */ + public $deleteScript; /** * @throws NotFoundHttpException @@ -164,6 +174,7 @@ class Upload extends InputWidget url: "{$this->afterSave}", dataType: "json", data: {data: data, fileName: files}, + {$this->successScript}, }); }, onLoad:function(obj) @@ -182,6 +193,7 @@ class Upload extends InputWidget }); }, deleteCallback: function (data, pd) { + {$this->deleteScript} for (var i = 0; i < data.length; i++) { $.post("{$this->deleteUrl}", {op: "delete",name: data[i]}, function (resp,textStatus, jqXHR) { From 7cfe9414f97cf3b184c2ab765439fe9302af89eb Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Thu, 21 Nov 2019 18:42:37 +0800 Subject: [PATCH 063/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=AD=97=E6=AE=B5=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/views/goods/_form.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index 0d262c0..f41216b 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -68,12 +68,13 @@ use antgoods\goods\models\ars\Supplier; field($model, 'express_template')->textInput() ?> - field($model, 'image')->textInput() ?> + field($model, 'image')->hiddenInput()->label('') ?> field($model, 'imagePath')->widget(\iron\widgets\Upload::className(), [ 'url' => 'upload', 'deleteUrl' => 'imageDel', 'dragdropWidth'=> 800, 'afterSave' => 'savefile', + 'maxCount' => 1, 'successScript' => " success: function(data) { @@ -95,7 +96,7 @@ use antgoods\goods\models\ars\Supplier; }, }); ", - ]) ?> + ])->label('图片') ?>
'btn btn-success']) ?> From b2c185c918b1e0969630f8353608f7f15e94ae66 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Thu, 21 Nov 2019 18:51:02 +0800 Subject: [PATCH 064/102] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=82=E6=95=B0del?= =?UTF-8?q?eteScript=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/iron/widgets/Upload.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/vendor/iron/widgets/Upload.php b/vendor/iron/widgets/Upload.php index 3486a4b..69bf991 100644 --- a/vendor/iron/widgets/Upload.php +++ b/vendor/iron/widgets/Upload.php @@ -104,6 +104,28 @@ class Upload extends InputWidget /** * @var * 删除图片触发方法 + * $.ajax({ + * url: 'img-id-del', + * data: {data: data, imgid: $('#goods-image').val()}, + * success: function(data) + * { + * $('#goods-image').val(data); + * }, + * }); + * + * 路由方法 + * public function actionImgIdDel() + * { + * $alias = Yii::$app->request->get('data')['alias']; + * $imgid = Yii::$app->request->get('imgid'); + * $imgidarr = explode(',', $imgid); + * $temfile = TemFile::findOne(['alias' => $alias]); + * if ($temfile) { + * $imgidarr = array_diff($imgidarr, [$temfile->id]); + * } + * $imgidstr = implode(',', $imgidarr); + * return $imgidstr; + * } */ public $deleteScript; From 8450cd89e3af04d32598c3088969c5cbc3d8716a Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Thu, 21 Nov 2019 19:16:22 +0800 Subject: [PATCH 065/102] =?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E8=A1=A8type=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/models/ars/Attribute.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vendor/antgoods/goods/src/models/ars/Attribute.php b/vendor/antgoods/goods/src/models/ars/Attribute.php index c3b2675..ecefe05 100644 --- a/vendor/antgoods/goods/src/models/ars/Attribute.php +++ b/vendor/antgoods/goods/src/models/ars/Attribute.php @@ -22,6 +22,8 @@ class Attribute extends \yii\db\ActiveRecord //是否删除is_delete const IS_DELETE_NO = 0;//未删除 const IS_DELETE_YES = 1;//已删除 + //类型type + const TYPE_ATTR = 1;//商品sku属性 /** * {@inheritdoc} */ From 4403ab16e1cc4a1d4e73754163f8b1e438145397 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Thu, 21 Nov 2019 19:47:06 +0800 Subject: [PATCH 066/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=A1=A8antgoods=5Fattribute=E7=9A=84type=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=EF=BC=8C=E8=AE=BE=E7=BD=AE=E5=AD=97=E6=AE=B5=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...olumn_type_in_table_antgoods_attribute.php | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 vendor/antgoods/goods/src/migrations/m191121_111825_update_column_type_in_table_antgoods_attribute.php diff --git a/vendor/antgoods/goods/src/migrations/m191121_111825_update_column_type_in_table_antgoods_attribute.php b/vendor/antgoods/goods/src/migrations/m191121_111825_update_column_type_in_table_antgoods_attribute.php new file mode 100644 index 0000000..2d6e34b --- /dev/null +++ b/vendor/antgoods/goods/src/migrations/m191121_111825_update_column_type_in_table_antgoods_attribute.php @@ -0,0 +1,28 @@ +dropColumn('antgoods_attribute', 'type'); + $this->addColumn('antgoods_attribute', 'type', $this->smallInteger(2)->notNull()->defaultValue(1)->comment('类型:1:商品sku属性')); + } + + /** + * {@inheritdoc} + */ + public function down() + { + $this->dropColumn('antgoods_attribute', 'type'); + $this->addColumn('antgoods_attribute', 'type', $this->smallInteger(2)->defaultValue(null)->comment('类型')); + return true; + } +} From b7b244c4a108335c0405a116bd211ecebbdb1c50 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Fri, 22 Nov 2019 08:59:17 +0800 Subject: [PATCH 067/102] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E5=91=BD=E5=90=8D=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods/src/controllers/GoodsController.php | 24 ++++++++++--------- .../antgoods/goods/src/views/goods/_form.php | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index 33a5ff7..b0c3ae1 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -81,7 +81,9 @@ class GoodsController extends Controller { $model = new Goods(); - if ($model->load(Yii::$app->request->post()) && $model->save()) { + if ($model->load(Yii::$app->request->post())) { + $img_id_arr = explode(',', $model->image); + $model->save(); return $this->redirect('index'); } @@ -164,15 +166,15 @@ class GoodsController extends Controller /** * 处理文件上传成功后回调保存到临时文件表中 */ - public function actionSavefile() + public function actionSaveFile() { $data = Yii::$app->request->get('data'); - $fileName = Yii::$app->request->get('fileName')[0]; + $file_name = Yii::$app->request->get('fileName')[0]; if ($data['status'] == true) { $model = new TemFile(); $model->user_id = Yii::$app->user->identity->id; - $model->name = $fileName; + $model->name = $file_name; $type = Yii::$app->file->searchType(FileManager::$extension, pathinfo($data['path'])['extension']); if ($type != -1) { $model->type = $type; @@ -191,13 +193,13 @@ class GoodsController extends Controller public function actionImgIdDel() { $alias = Yii::$app->request->get('data')['alias']; - $imgid = Yii::$app->request->get('imgid'); - $imgidarr = explode(',', $imgid); - $temfile = TemFile::findOne(['alias' => $alias]); - if ($temfile) { - $imgidarr = array_diff($imgidarr, [$temfile->id]); + $img_id = Yii::$app->request->get('imgid'); + $img_id_arr = explode(',', $img_id); + $tem_file = TemFile::findOne(['alias' => $alias]); + if ($tem_file) { + $img_id_arr = array_diff($img_id_arr, [$tem_file->id]); } - $imgidstr = implode(',', $imgidarr); - return $imgidstr; + $img_id_str = implode(',', $img_id_arr); + return $img_id_str; } } diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index f41216b..1eeb656 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -73,7 +73,7 @@ use antgoods\goods\models\ars\Supplier; 'url' => 'upload', 'deleteUrl' => 'imageDel', 'dragdropWidth'=> 800, - 'afterSave' => 'savefile', + 'afterSave' => 'save-file', 'maxCount' => 1, 'successScript' => " success: function(data) From 6ea8813274f254ff31cbf32a5331a297af0cb6cd Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Fri, 22 Nov 2019 11:39:49 +0800 Subject: [PATCH 068/102] =?UTF-8?q?=E5=A2=9E=E5=8A=A0antgoods=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=B1=82logic=EF=BC=8C=E5=88=A0=E9=99=A4=E4=BF=AE?= =?UTF-8?q?=E6=94=B9attribute=E8=A1=A8=E7=9A=84type=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB=E6=96=87=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E5=88=9B=E5=BB=BAantgoods=E6=A8=A1=E5=9D=97=E7=9A=84=E5=95=86?= =?UTF-8?q?=E5=93=81=E9=80=BB=E8=BE=91=E6=96=87=E4=BB=B6=EF=BC=8C=E5=9C=A8?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=A8=A1=E5=9D=97=E9=80=BB=E8=BE=91=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E7=BB=9F=E4=B8=80type=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=86=85=E5=AE=B9=EF=BC=8C=E5=9C=A8=E5=95=86=E5=93=81=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E6=96=87=E4=BB=B6=E4=B8=AD=E5=BC=80=E5=8F=91=E5=B0=86?= =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=96=87=E4=BB=B6=E4=BF=9D=E5=AD=98=E7=9A=84?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=AD=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/config/main.php | 1 + backend/logic/file/FileManager.php | 17 +++-- common/models/ars/File.php | 2 + common/models/ars/TemFile.php | 6 -- .../goods/src/controllers/GoodsController.php | 5 +- .../goods/src/logic/goods/GoodsManager.php | 70 +++++++++++++++++++ ...olumn_type_in_table_antgoods_attribute.php | 28 -------- .../antgoods/goods/src/models/ars/Goods.php | 7 ++ .../antgoods/goods/src/views/goods/_form.php | 2 +- 9 files changed, 95 insertions(+), 43 deletions(-) create mode 100644 vendor/antgoods/goods/src/logic/goods/GoodsManager.php delete mode 100644 vendor/antgoods/goods/src/migrations/m191121_111825_update_column_type_in_table_antgoods_attribute.php diff --git a/backend/config/main.php b/backend/config/main.php index 81c6961..352b926 100644 --- a/backend/config/main.php +++ b/backend/config/main.php @@ -56,6 +56,7 @@ return [ ], ], 'file' => ['class' => 'backend\logic\file\FileManager'], + 'goods' => ['class' => 'antgoods\goods\logic\goods\GoodsManager'], ], 'params' => $params, ]; diff --git a/backend/logic/file/FileManager.php b/backend/logic/file/FileManager.php index 4ab3ffd..9be289f 100644 --- a/backend/logic/file/FileManager.php +++ b/backend/logic/file/FileManager.php @@ -7,12 +7,19 @@ use common\models\ars\TemFile; class FileManager { + //数据表ats_file和ats_tem_file的类型字段type + const TYPE_IMAGE = 1;//图片 + const TYPE_VIDEO = 2;//影视 + const TYPE_EXCEL = 3;//excel表单 + const TYPE_WORD = 4;//word文本 + const TYPE_TXT = 5;//txt文本 + public static $extension = [ - TemFile::TYPE_IMAGE => ['jpg', 'png', 'jpeg'], - TemFile::TYPE_VIDEO => ['mp4'], - TemFile::TYPE_EXCEL => [], - TemFile::TYPE_WORD => ['docx'], - TemFile::TYPE_TXT => ['txt'], + self::TYPE_IMAGE => ['jpg', 'png', 'jpeg'], + self::TYPE_VIDEO => ['mp4'], + self::TYPE_EXCEL => [], + self::TYPE_WORD => ['docx'], + self::TYPE_TXT => ['txt'], ]; /** diff --git a/common/models/ars/File.php b/common/models/ars/File.php index fc1be27..1c6a983 100644 --- a/common/models/ars/File.php +++ b/common/models/ars/File.php @@ -22,6 +22,8 @@ use yii\behaviors\TimestampBehavior; */ class File extends \yii\db\ActiveRecord { + const OWN_TYPE_GOODS_INDEX = 1;//商品首页 + const OWN_TYPE_GOODS_DETAILS = 2;//商品详情 /** * {@inheritdoc} */ diff --git a/common/models/ars/TemFile.php b/common/models/ars/TemFile.php index 3123d8a..450f34c 100644 --- a/common/models/ars/TemFile.php +++ b/common/models/ars/TemFile.php @@ -19,12 +19,6 @@ use yii\behaviors\TimestampBehavior; */ class TemFile extends \yii\db\ActiveRecord { - //类型type - const TYPE_IMAGE = 1;//图片 - const TYPE_VIDEO = 2;//影视 - const TYPE_EXCEL = 3;//excel表单 - const TYPE_WORD = 4;//word文本 - const TYPE_TXT = 5;//txt文本 /** * {@inheritdoc} diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index b0c3ae1..d9e1f56 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -11,6 +11,7 @@ use yii\filters\VerbFilter; use common\models\ars\TemFile; use common\models\ars\File; use backend\logic\file\FileManager; +use antgoods\goods\logic\goods\GoodsManager; /** * GoodsController implements the CRUD actions for Goods model. @@ -81,9 +82,7 @@ class GoodsController extends Controller { $model = new Goods(); - if ($model->load(Yii::$app->request->post())) { - $img_id_arr = explode(',', $model->image); - $model->save(); + if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect('index'); } diff --git a/vendor/antgoods/goods/src/logic/goods/GoodsManager.php b/vendor/antgoods/goods/src/logic/goods/GoodsManager.php new file mode 100644 index 0000000..98ee109 --- /dev/null +++ b/vendor/antgoods/goods/src/logic/goods/GoodsManager.php @@ -0,0 +1,70 @@ + false, 'info' => '参数错误']; + } + + $img_id_arr = explode(',', $imgIdStr); + $i = 1; + $first_file_id = 0; + foreach ($img_id_arr as $key => $value) { + $tem_file = TemFile::findOne($key); + + if(!$tem_file) { + return ['status' => false, 'info' => '存在查找不到的文件']; + } + + $res = self::saveNewFile($tem_file, $ownId, $ownType); + if(!$res['status']) { + return ['status' => false, 'info' => '存在文件保存失败']; + } + if($i == 1) { + $first_file_id = $res['file_id']; + } + + $i++; + } + + return ['status' => true, 'info' => '保存成功', 'first_file_id' => $first_file_id]; + } + + /** + * @param $temFile + * @param $ownId + * @param $ownType + * @return bool + * 创建新的文件 + */ + private function saveNewFile($temFile, $ownId, $ownType) + { + $new_file = new File(); + $new_file->name = $temFile->name; + $new_file->type = $temFile->type; + $new_file->own_id = $ownId; + $new_file->own_type = $ownType; + $new_file->alias = $temFile->alias; + $new_file->path = $temFile->path; + if($new_file->save()) { + return ['status' => true, 'file_id' => $new_file->id]; + } else { + return ['status' => false]; + } + } +} \ No newline at end of file diff --git a/vendor/antgoods/goods/src/migrations/m191121_111825_update_column_type_in_table_antgoods_attribute.php b/vendor/antgoods/goods/src/migrations/m191121_111825_update_column_type_in_table_antgoods_attribute.php deleted file mode 100644 index 2d6e34b..0000000 --- a/vendor/antgoods/goods/src/migrations/m191121_111825_update_column_type_in_table_antgoods_attribute.php +++ /dev/null @@ -1,28 +0,0 @@ -dropColumn('antgoods_attribute', 'type'); - $this->addColumn('antgoods_attribute', 'type', $this->smallInteger(2)->notNull()->defaultValue(1)->comment('类型:1:商品sku属性')); - } - - /** - * {@inheritdoc} - */ - public function down() - { - $this->dropColumn('antgoods_attribute', 'type'); - $this->addColumn('antgoods_attribute', 'type', $this->smallInteger(2)->defaultValue(null)->comment('类型')); - return true; - } -} diff --git a/vendor/antgoods/goods/src/models/ars/Goods.php b/vendor/antgoods/goods/src/models/ars/Goods.php index ab00598..0939e12 100644 --- a/vendor/antgoods/goods/src/models/ars/Goods.php +++ b/vendor/antgoods/goods/src/models/ars/Goods.php @@ -45,6 +45,7 @@ use yii\behaviors\TimestampBehavior; class Goods extends \yii\db\ActiveRecord { public $imagePath; + public $imageId; //是否删除is_delete const IS_DELETE_NO = 0;//未删除 const IS_DELETE_YES = 1;//已删除 @@ -176,4 +177,10 @@ class Goods extends \yii\db\ActiveRecord } return parent::beforeSave($insert); // TODO: Change the autogenerated stub } + + public function afterSave($insert, $changedAttributes) + { + d($this->imageId);die(); + parent::afterSave($insert, $changedAttributes); // TODO: Change the autogenerated stub + } } diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index 1eeb656..fec13ab 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -68,7 +68,7 @@ use antgoods\goods\models\ars\Supplier; field($model, 'express_template')->textInput() ?> - field($model, 'image')->hiddenInput()->label('') ?> + field($model, 'imageId')->hiddenInput()->label('') ?> field($model, 'imagePath')->widget(\iron\widgets\Upload::className(), [ 'url' => 'upload', 'deleteUrl' => 'imageDel', From 30e02bca7c65ecca95837cd3b5bd2b2b1890c7e2 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Fri, 22 Nov 2019 11:42:19 +0800 Subject: [PATCH 069/102] =?UTF-8?q?=E9=87=8D=E6=96=B0=E8=80=83=E8=99=91?= =?UTF-8?q?=E8=A7=84=E5=88=92=E5=95=86=E5=93=81=E9=80=BB=E8=BE=91=E5=92=8C?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E9=80=BB=E8=BE=91=EF=BC=8C=E5=B0=86=E4=B8=B4?= =?UTF-8?q?=E6=97=B6=E6=96=87=E4=BB=B6=E4=BF=9D=E5=AD=98=E5=88=B0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E7=9A=84=E6=96=B9=E6=B3=95=EF=BC=8C=E4=BB=8E?= =?UTF-8?q?=E5=95=86=E5=93=81=E9=80=BB=E8=BE=91=E6=96=87=E4=BB=B6=E8=BD=AC?= =?UTF-8?q?=E7=A7=BB=E5=88=B0=E6=96=87=E4=BB=B6=E9=80=BB=E8=BE=91=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/logic/file/FileManager.php | 61 +++++++++++++++++++ .../goods/src/logic/goods/GoodsManager.php | 60 ------------------ 2 files changed, 61 insertions(+), 60 deletions(-) diff --git a/backend/logic/file/FileManager.php b/backend/logic/file/FileManager.php index 9be289f..7b02a75 100644 --- a/backend/logic/file/FileManager.php +++ b/backend/logic/file/FileManager.php @@ -3,6 +3,7 @@ namespace backend\logic\file; +use common\models\ars\File; use common\models\ars\TemFile; class FileManager @@ -48,4 +49,64 @@ class FileManager } return -1; } + + /** + * @param $imgIdStr + * @param $ownId + * @param $ownType + * @return array + * 根据临时文件id(字符串)将临时文件保存在文件中 + */ + public function saveTemFileToFile($temFIleIdStr, $ownId, $ownType) + { + if(!$temFIleIdStr || !$ownId) { + return ['status' => false, 'info' => '参数错误']; + } + + $img_id_arr = explode(',', $temFIleIdStr); + $i = 1; + $first_file_id = 0; + foreach ($img_id_arr as $key => $value) { + $tem_file = TemFile::findOne($key); + + if(!$tem_file) { + return ['status' => false, 'info' => '存在查找不到的文件']; + } + + $res = self::saveNewFile($tem_file, $ownId, $ownType); + if(!$res['status']) { + return ['status' => false, 'info' => '存在文件保存失败']; + } + if($i == 1) { + $first_file_id = $res['file_id']; + } + + $i++; + } + + return ['status' => true, 'info' => '保存成功', 'first_file_id' => $first_file_id]; + } + + /** + * @param $temFile + * @param $ownId + * @param $ownType + * @return bool + * 创建新的文件 + */ + private function saveNewFile($temFile, $ownId, $ownType) + { + $new_file = new File(); + $new_file->name = $temFile->name; + $new_file->type = $temFile->type; + $new_file->own_id = $ownId; + $new_file->own_type = $ownType; + $new_file->alias = $temFile->alias; + $new_file->path = $temFile->path; + if($new_file->save()) { + return ['status' => true, 'file_id' => $new_file->id]; + } else { + return ['status' => false]; + } + } } \ No newline at end of file diff --git a/vendor/antgoods/goods/src/logic/goods/GoodsManager.php b/vendor/antgoods/goods/src/logic/goods/GoodsManager.php index 98ee109..14afc84 100644 --- a/vendor/antgoods/goods/src/logic/goods/GoodsManager.php +++ b/vendor/antgoods/goods/src/logic/goods/GoodsManager.php @@ -3,68 +3,8 @@ namespace antgoods\goods\logic\goods; -use common\models\ars\TemFile; -use common\models\ars\File; class GoodsManager { - /** - * @param $imgIdStr - * @param $ownId - * @param $ownType - * @return array - * 将临时文件保存在文件中 - */ - public function saveTemFileToFile($imgIdStr, $ownId, $ownType) - { - if(!$imgIdStr || !$ownId) { - return ['status' => false, 'info' => '参数错误']; - } - $img_id_arr = explode(',', $imgIdStr); - $i = 1; - $first_file_id = 0; - foreach ($img_id_arr as $key => $value) { - $tem_file = TemFile::findOne($key); - - if(!$tem_file) { - return ['status' => false, 'info' => '存在查找不到的文件']; - } - - $res = self::saveNewFile($tem_file, $ownId, $ownType); - if(!$res['status']) { - return ['status' => false, 'info' => '存在文件保存失败']; - } - if($i == 1) { - $first_file_id = $res['file_id']; - } - - $i++; - } - - return ['status' => true, 'info' => '保存成功', 'first_file_id' => $first_file_id]; - } - - /** - * @param $temFile - * @param $ownId - * @param $ownType - * @return bool - * 创建新的文件 - */ - private function saveNewFile($temFile, $ownId, $ownType) - { - $new_file = new File(); - $new_file->name = $temFile->name; - $new_file->type = $temFile->type; - $new_file->own_id = $ownId; - $new_file->own_type = $ownType; - $new_file->alias = $temFile->alias; - $new_file->path = $temFile->path; - if($new_file->save()) { - return ['status' => true, 'file_id' => $new_file->id]; - } else { - return ['status' => false]; - } - } } \ No newline at end of file From b2d50d654d094535cba90b93b82cedd35100750f Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Fri, 22 Nov 2019 13:54:04 +0800 Subject: [PATCH 070/102] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E5=8F=B7=E7=A0=81=E9=AA=8C=E8=AF=81=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/models/ars/Supplier.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vendor/antgoods/goods/src/models/ars/Supplier.php b/vendor/antgoods/goods/src/models/ars/Supplier.php index e30b599..a19f7dd 100644 --- a/vendor/antgoods/goods/src/models/ars/Supplier.php +++ b/vendor/antgoods/goods/src/models/ars/Supplier.php @@ -40,6 +40,9 @@ class Supplier extends \yii\db\ActiveRecord [['is_delete'], 'integer'], [['name', 'full_name', 'address'], 'string', 'max' => 50], [['phone'], 'string', 'max' => 20], + ['phone', 'filter', 'filter' => 'trim'], + ['phone','match','pattern'=>'/^[1][34578][0-9]{9}$/'], + ['phone', 'unique', 'targetClass' => '\antgoods\goods\models\ars\Supplier', 'message' => '手机号已被使用'], ]; } From a90a4c2a885dfaaae5b79a4b691c650d2fdc2fe5 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Fri, 22 Nov 2019 14:46:10 +0800 Subject: [PATCH 071/102] =?UTF-8?q?=E5=BC=80=E5=8F=91=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=95=86=E5=93=81=E6=97=B6=E4=BF=9D=E5=AD=98=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods/src/controllers/GoodsController.php | 24 ++++++++++++------- .../goods/src/logic/goods/GoodsManager.php | 22 +++++++++++++++++ .../antgoods/goods/src/models/ars/Goods.php | 8 +------ .../antgoods/goods/src/views/goods/_form.php | 12 +++++----- 4 files changed, 45 insertions(+), 21 deletions(-) diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index d9e1f56..50c4740 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -2,16 +2,13 @@ namespace antgoods\goods\controllers; +use common\models\ars\TemFile; use Yii; use antgoods\goods\models\ars\Goods; use antgoods\goods\models\searchs\GoodsSearch; use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; -use common\models\ars\TemFile; -use common\models\ars\File; -use backend\logic\file\FileManager; -use antgoods\goods\logic\goods\GoodsManager; /** * GoodsController implements the CRUD actions for Goods model. @@ -82,7 +79,8 @@ class GoodsController extends Controller { $model = new Goods(); - if ($model->load(Yii::$app->request->post()) && $model->save()) { + if ($model->load(Yii::$app->request->post())) { + $model->save(); return $this->redirect('index'); } @@ -167,14 +165,19 @@ class GoodsController extends Controller */ 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 TemFile(); + $model = new \common\models\ars\TemFile(); $model->user_id = Yii::$app->user->identity->id; $model->name = $file_name; - $type = Yii::$app->file->searchType(FileManager::$extension, pathinfo($data['path'])['extension']); + $file_manager = new \backend\logic\file\FileManager(); + $type = $file_manager->searchType(\backend\logic\file\FileManager::$extension, pathinfo($data['path'])['extension']); if ($type != -1) { $model->type = $type; } @@ -191,10 +194,15 @@ class GoodsController extends Controller */ public function actionImgIdDel() { + //判断该类是否存在 + if(!class_exists('\common\models\ars\TemFile')){ + return ''; + } + $alias = Yii::$app->request->get('data')['alias']; $img_id = Yii::$app->request->get('imgid'); $img_id_arr = explode(',', $img_id); - $tem_file = TemFile::findOne(['alias' => $alias]); + $tem_file = \common\models\ars\TemFile::findOne(['alias' => $alias]); if ($tem_file) { $img_id_arr = array_diff($img_id_arr, [$tem_file->id]); } diff --git a/vendor/antgoods/goods/src/logic/goods/GoodsManager.php b/vendor/antgoods/goods/src/logic/goods/GoodsManager.php index 14afc84..425b8fe 100644 --- a/vendor/antgoods/goods/src/logic/goods/GoodsManager.php +++ b/vendor/antgoods/goods/src/logic/goods/GoodsManager.php @@ -6,5 +6,27 @@ namespace antgoods\goods\logic\goods; class GoodsManager { + /** + * @param $fileIdStr + * @param $goodsModel + * @param int $filetype + * @return bool + * 判断file逻辑文件FileManager和file模型文件是否存在,若存在,则执行文件保存操作 + */ + public function saveFile($fileIdStr, $goodsModel, $filetype = 1) + { + if(class_exists('\backend\logic\file\FileManager') || class_exists('\common\models\ars\File')) { + return false; + } + $class = new \backend\logic\file\FileManager(); + $res = $class->saveTemFileToFile($fileIdStr, $goodsModel->id, $filetype); + + if($res['status'] || $filetype == \common\models\ars\File::OWN_TYPE_GOODS_INDEX) { + $goodsModel->image = $res['first_file_id']; + $goodsModel->save(); + } + + return true; + } } \ No newline at end of file diff --git a/vendor/antgoods/goods/src/models/ars/Goods.php b/vendor/antgoods/goods/src/models/ars/Goods.php index 0939e12..ad00d9c 100644 --- a/vendor/antgoods/goods/src/models/ars/Goods.php +++ b/vendor/antgoods/goods/src/models/ars/Goods.php @@ -73,7 +73,7 @@ class Goods extends \yii\db\ActiveRecord [['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'], 'integer'], [['cat_id', 'brand_id', 'shop_cat_id', 'name'], 'required'], [['sn'], 'checkExist'], - [['description'], 'string'], + [['description', 'imageId'], 'string'], [['name'], 'string', 'max' => 120], [['sn'], 'string', 'max' => 60], [['code'], 'string', 'max' => 50], @@ -177,10 +177,4 @@ class Goods extends \yii\db\ActiveRecord } return parent::beforeSave($insert); // TODO: Change the autogenerated stub } - - public function afterSave($insert, $changedAttributes) - { - d($this->imageId);die(); - parent::afterSave($insert, $changedAttributes); // TODO: Change the autogenerated stub - } } diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index fec13ab..2f133be 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -68,7 +68,7 @@ use antgoods\goods\models\ars\Supplier; field($model, 'express_template')->textInput() ?> - field($model, 'imageId')->hiddenInput()->label('') ?> + field($model, 'imageId')->textInput()->label('') ?> field($model, 'imagePath')->widget(\iron\widgets\Upload::className(), [ 'url' => 'upload', 'deleteUrl' => 'imageDel', @@ -78,21 +78,21 @@ use antgoods\goods\models\ars\Supplier; 'successScript' => " success: function(data) { - var imageval = $('#goods-image').val(); + var imageval = $('#goods-imageid').val(); if(imageval == ''){ - $('#goods-image').val(data); + $('#goods-imageid').val(data); }else{ - $('#goods-image').val($('#goods-image').val()+','+data); + $('#goods-imageid').val($('#goods-imageid').val()+','+data); } } ", 'deleteScript' => " $.ajax({ url: 'img-id-del', - data: {data: data, imgid: $('#goods-image').val()}, + data: {data: data, imgid: $('#goods-imageid').val()}, success: function(data) { - $('#goods-image').val(data); + $('#goods-imageid').val(data); }, }); ", From 3f405f607e0a45573ae35ac1e2882e2b7c548a2f Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Fri, 22 Nov 2019 15:44:02 +0800 Subject: [PATCH 072/102] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=95=86=E5=93=81?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E5=88=9B=E5=BB=BA=E5=95=86=E5=93=81=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=9B=BE=E7=89=87=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/logic/file/FileManager.php | 2 +- vendor/antgoods/goods/src/controllers/GoodsController.php | 5 +++++ vendor/antgoods/goods/src/logic/goods/GoodsManager.php | 2 +- vendor/antgoods/goods/src/views/goods/_form.php | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/logic/file/FileManager.php b/backend/logic/file/FileManager.php index 7b02a75..7b7ff2e 100644 --- a/backend/logic/file/FileManager.php +++ b/backend/logic/file/FileManager.php @@ -67,7 +67,7 @@ class FileManager $i = 1; $first_file_id = 0; foreach ($img_id_arr as $key => $value) { - $tem_file = TemFile::findOne($key); + $tem_file = TemFile::findOne($value); if(!$tem_file) { return ['status' => false, 'info' => '存在查找不到的文件']; diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index 50c4740..728c569 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -3,12 +3,14 @@ namespace antgoods\goods\controllers; use common\models\ars\TemFile; +use MongoDB\Driver\Manager; use Yii; use antgoods\goods\models\ars\Goods; use antgoods\goods\models\searchs\GoodsSearch; use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; +use antgoods\goods\logic\goods\GoodsManager; /** * GoodsController implements the CRUD actions for Goods model. @@ -80,7 +82,10 @@ class GoodsController extends Controller $model = new Goods(); if ($model->load(Yii::$app->request->post())) { + $file_id_str = $model->imageId; $model->save(); + $goods_manager = new GoodsManager(); + $goods_manager->saveFile($file_id_str, $model); return $this->redirect('index'); } diff --git a/vendor/antgoods/goods/src/logic/goods/GoodsManager.php b/vendor/antgoods/goods/src/logic/goods/GoodsManager.php index 425b8fe..d5514f6 100644 --- a/vendor/antgoods/goods/src/logic/goods/GoodsManager.php +++ b/vendor/antgoods/goods/src/logic/goods/GoodsManager.php @@ -15,7 +15,7 @@ class GoodsManager */ public function saveFile($fileIdStr, $goodsModel, $filetype = 1) { - if(class_exists('\backend\logic\file\FileManager') || class_exists('\common\models\ars\File')) { + if(!class_exists('\backend\logic\file\FileManager') || !class_exists('\common\models\ars\File')) { return false; } diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index 2f133be..18bfe40 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -68,7 +68,7 @@ use antgoods\goods\models\ars\Supplier; field($model, 'express_template')->textInput() ?> - field($model, 'imageId')->textInput()->label('') ?> + field($model, 'imageId')->hiddenInput()->label('') ?> field($model, 'imagePath')->widget(\iron\widgets\Upload::className(), [ 'url' => 'upload', 'deleteUrl' => 'imageDel', From 3ca69b16c2a542a5ecee7bb8366e05e6557987eb Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Fri, 22 Nov 2019 19:23:26 +0800 Subject: [PATCH 073/102] =?UTF-8?q?=E5=B0=86=E4=B8=8A=E4=BC=A0=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E5=8A=A0=E8=BD=BD=E6=85=A2=E7=9A=84js?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=94=B9=E4=B8=BA=E6=9C=AC=E5=9C=B0=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=EF=BC=8C=E5=BC=80=E5=8F=91=E4=BF=AE=E6=94=B9=E5=95=86?= =?UTF-8?q?=E5=93=81=E6=93=8D=E4=BD=9C=E6=97=B6=E5=8A=A0=E8=BD=BD=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E7=9A=84=E6=96=B9=E6=B3=95=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=9B=BE=E7=89=87=E6=97=B6=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E7=9A=84=E5=9B=9E=E8=B0=83=E6=96=B9=E6=B3=95=EF=BC=8C=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E9=80=82=E7=94=A8=E4=BA=8E=E5=88=9B=E5=BB=BA=E5=92=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9A=84=E5=88=A0=E9=99=A4=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/logic/file/FileManager.php | 22 +++------- .../goods/src/controllers/GoodsController.php | 44 ++++++++++++++++--- .../goods/src/logic/goods/GoodsManager.php | 1 + .../antgoods/goods/src/views/goods/_form.php | 7 ++- .../upload/js/jquery-file-upload.min.js | 2 +- vendor/iron/web/UploadAsset.php | 1 + vendor/iron/widgets/Upload.php | 1 + 7 files changed, 54 insertions(+), 24 deletions(-) diff --git a/backend/logic/file/FileManager.php b/backend/logic/file/FileManager.php index 7b7ff2e..da311a8 100644 --- a/backend/logic/file/FileManager.php +++ b/backend/logic/file/FileManager.php @@ -26,28 +26,18 @@ class FileManager /** * @param $array * @param $value - * @param int $key * @return int * 查看$extension数组中是否存在文件类型,不存在则返回-1 */ - public function searchType($array,$value, $key=-1){ - foreach($array as $k=>$row){ - if(!is_array($row)){ - if($row == $value){ - if($key != -1) { - return $key; - }else{ - return -1; - } - } - }else{ - $r = self::searchType($row,$value, $k); - if($r != -1){ - return $r; + public function searchType($array, $keyword, $key=-1){ + foreach($array as $key => $value){ + foreach ($value as $k => $v) { + if($v == $keyword){ + return $key; } } } - return -1; + return false; } /** diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index 728c569..9dbc2a7 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -104,6 +104,7 @@ class GoodsController extends Controller public function actionUpdate($id) { $model = $this->findModel($id); + $model->imageId = $model->image; if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect('index'); @@ -183,7 +184,7 @@ class GoodsController extends Controller $model->name = $file_name; $file_manager = new \backend\logic\file\FileManager(); $type = $file_manager->searchType(\backend\logic\file\FileManager::$extension, pathinfo($data['path'])['extension']); - if ($type != -1) { + if ($type) { $model->type = $type; } $model->alias = $data['alias']; @@ -200,18 +201,49 @@ class GoodsController extends Controller public function actionImgIdDel() { //判断该类是否存在 - if(!class_exists('\common\models\ars\TemFile')){ + if(!class_exists('\common\models\ars\TemFile') || !class_exists('\common\models\ars\File')){ return ''; } - $alias = Yii::$app->request->get('data')['alias']; $img_id = Yii::$app->request->get('imgid'); $img_id_arr = explode(',', $img_id); - $tem_file = \common\models\ars\TemFile::findOne(['alias' => $alias]); - if ($tem_file) { - $img_id_arr = array_diff($img_id_arr, [$tem_file->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; } + + 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(); + if($data) { + $res = array(); + $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); + } + } + return json_encode($res); + } } diff --git a/vendor/antgoods/goods/src/logic/goods/GoodsManager.php b/vendor/antgoods/goods/src/logic/goods/GoodsManager.php index d5514f6..b1410d8 100644 --- a/vendor/antgoods/goods/src/logic/goods/GoodsManager.php +++ b/vendor/antgoods/goods/src/logic/goods/GoodsManager.php @@ -15,6 +15,7 @@ class GoodsManager */ public function saveFile($fileIdStr, $goodsModel, $filetype = 1) { + //判断类名是否存在 if(!class_exists('\backend\logic\file\FileManager') || !class_exists('\common\models\ars\File')) { return false; } diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index 18bfe40..4a30336 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -68,7 +68,7 @@ use antgoods\goods\models\ars\Supplier; field($model, 'express_template')->textInput() ?> - field($model, 'imageId')->hiddenInput()->label('') ?> + field($model, 'imageId')->textInput()->label('') ?> field($model, 'imagePath')->widget(\iron\widgets\Upload::className(), [ 'url' => 'upload', 'deleteUrl' => 'imageDel', @@ -87,15 +87,20 @@ use antgoods\goods\models\ars\Supplier; } ", 'deleteScript' => " + console.log(data); $.ajax({ url: 'img-id-del', data: {data: data, imgid: $('#goods-imageid').val()}, success: function(data) { + console.log(data); $('#goods-imageid').val(data); }, }); ", + 'previewConfig' => [ + 'url' => 'image-file?fileidstr='.$model->imageId, + ], ])->label('图片') ?>
diff --git a/vendor/iron/assets/upload/js/jquery-file-upload.min.js b/vendor/iron/assets/upload/js/jquery-file-upload.min.js index 6788a62..3f525b1 100644 --- a/vendor/iron/assets/upload/js/jquery-file-upload.min.js +++ b/vendor/iron/assets/upload/js/jquery-file-upload.min.js @@ -1 +1 @@ -(function($){if($.fn.ajaxForm==undefined){$.getScript(("https:"==document.location.protocol?"https://":"http://")+"malsup.github.io/jquery.form.js")}var feature={};feature.fileapi=$("").get(0).files!==undefined;feature.formdata=window.FormData!==undefined;$.fn.uploadFile=function(options){var s=$.extend({url:"",method:"POST",enctype:"multipart/form-data",returnType:null,allowDuplicates:true,duplicateStrict:false,allowedTypes:"*",acceptFiles:"*",fileName:"file",formData:false,dynamicFormData:false,maxFileSize:-1,maxFileCount:-1,multiple:true,dragDrop:true,autoSubmit:true,showCancel:true,showAbort:true,showDone:false,showDelete:false,showError:true,showStatusAfterSuccess:true,showStatusAfterError:true,showFileCounter:true,fileCounterStyle:"). ",showFileSize:true,showProgress:false,nestedForms:true,showDownload:false,onLoad:function(obj){},onSelect:function(files){return true},onSubmit:function(files,xhr){},onSuccess:function(files,response,xhr,pd){},onError:function(files,status,message,pd){},onCancel:function(files,pd){},onAbort:function(files,pd){},downloadCallback:false,deleteCallback:false,afterUploadAll:false,serialize:true,sequential:false,sequentialCount:2,customProgressBar:false,abortButtonClass:"ajax-file-upload-abort",cancelButtonClass:"ajax-file-upload-cancel",dragDropContainerClass:"ajax-upload-dragdrop",dragDropHoverClass:"state-hover",errorClass:"ajax-file-upload-error",uploadButtonClass:"ajax-file-upload",dragDropStr:"Drag & Drop Files",uploadStr:"Upload",abortStr:"Abort",cancelStr:"Cancel",deleteStr:"Delete",doneStr:"Done",multiDragErrorStr:"Multiple File Drag & Drop is not allowed.",extErrorStr:"is not allowed. Allowed extensions: ",duplicateErrorStr:"is not allowed. File already exists.",sizeErrorStr:"is not allowed. Allowed Max size: ",uploadErrorStr:"Upload is not allowed",maxFileCountErrorStr:" is not allowed. Maximum allowed files are:",downloadStr:"Download",customErrorKeyStr:"jquery-upload-file-error",showQueueDiv:false,statusBarWidth:400,dragdropWidth:400,showPreview:false,previewHeight:"auto",previewWidth:"100%",extraHTML:false,uploadQueueOrder:"top",headers:{}},options);this.fileCounter=1;this.selectedFiles=0;var formGroup="ajax-file-upload-"+(new Date).getTime();this.formGroup=formGroup;this.errorLog=$("
");this.responses=[];this.existingFileNames=[];if(!feature.formdata){s.dragDrop=false}if(!feature.formdata||s.maxFileCount===1){s.multiple=false}$(this).html("");var obj=this;var uploadLabel=$("
"+s.uploadStr+"
");$(uploadLabel).addClass(s.uploadButtonClass);(function checkAjaxFormLoaded(){if($.fn.ajaxForm){if(s.dragDrop){var dragDrop=$('
').width(s.dragdropWidth);$(obj).append(dragDrop);$(dragDrop).append(uploadLabel);$(dragDrop).append($(s.dragDropStr));setDragDropHandlers(obj,s,dragDrop)}else{$(obj).append(uploadLabel)}$(obj).append(obj.errorLog);if(s.showQueueDiv)obj.container=$("#"+s.showQueueDiv);else obj.container=$("
").insertAfter($(obj));s.onLoad.call(this,obj);createCustomInputFile(obj,formGroup,s,uploadLabel)}else window.setTimeout(checkAjaxFormLoaded,10)})();this.startUpload=function(){$("form").each(function(i,items){if($(this).hasClass(obj.formGroup)){mainQ.push($(this))}});if(mainQ.length>=1)submitPendingUploads()};this.getFileCount=function(){return obj.selectedFiles};this.stopUpload=function(){$("."+s.abortButtonClass).each(function(i,items){if($(this).hasClass(obj.formGroup))$(this).click()});$("."+s.cancelButtonClass).each(function(i,items){if($(this).hasClass(obj.formGroup))$(this).click()})};this.cancelAll=function(){$("."+s.cancelButtonClass).each(function(i,items){if($(this).hasClass(obj.formGroup))$(this).click()})};this.update=function(settings){s=$.extend(s,settings);if(settings.hasOwnProperty("url")){$("form").each(function(i,items){$(this).attr("action",settings["url"])})}};this.enqueueFile=function(file){if(!(file instanceof File))return;var files=[file];serializeAndUploadFiles(s,obj,files)};this.reset=function(removeStatusBars){obj.fileCounter=1;obj.selectedFiles=0;obj.errorLog.html("");if(removeStatusBars!=false){obj.container.html("")}};this.remove=function(){obj.container.html("");$(obj).remove()};this.createProgress=function(filename,filepath,filesize){var pd=new createProgressDiv(this,s);pd.progressDiv.show();pd.progressbar.width("100%");var fileNameStr="";if(s.showFileCounter)fileNameStr=obj.fileCounter+s.fileCounterStyle+filename;else fileNameStr=filename;if(s.showFileSize)fileNameStr+=" ("+getSizeStr(filesize)+")";pd.filename.html(fileNameStr);obj.fileCounter++;obj.selectedFiles++;if(s.showPreview){pd.preview.attr("src",filepath);pd.preview.show()}if(s.showDownload){pd.download.show();pd.download.click(function(){if(s.downloadCallback)s.downloadCallback.call(obj,[filename],pd)})}if(s.showDelete){pd.del.show();pd.del.click(function(){pd.statusbar.hide().remove();var arr=[filename];if(s.deleteCallback)s.deleteCallback.call(this,arr,pd);obj.selectedFiles-=1;updateFileCounter(s,obj)})}return pd};this.getResponses=function(){return this.responses};var mainQ=[];var progressQ=[];var running=false;function submitPendingUploads(){if(running)return;running=true;(function checkPendingForms(){if(!s.sequential)s.sequentialCount=99999;if(mainQ.length==0&&progressQ.length==0){if(s.afterUploadAll)s.afterUploadAll(obj);running=false}else{if(progressQ.length1){if(s.showError)$("
"+s.multiDragErrorStr+"
").appendTo(obj.errorLog);return}if(s.onSelect(files)==false)return;serializeAndUploadFiles(s,obj,files)});ddObj.on("dragleave",function(e){$(this).removeClass(s.dragDropHoverClass)});$(document).on("dragenter",function(e){e.stopPropagation();e.preventDefault()});$(document).on("dragover",function(e){e.stopPropagation();e.preventDefault();var that=$(this);if(!that.hasClass(s.dragDropContainerClass)){that.removeClass(s.dragDropHoverClass)}});$(document).on("drop",function(e){e.stopPropagation();e.preventDefault();$(this).removeClass(s.dragDropHoverClass)})}function getSizeStr(size){var sizeStr="";var sizeKB=size/1024;if(parseInt(sizeKB)>1024){var sizeMB=sizeKB/1024;sizeStr=sizeMB.toFixed(2)+" MB"}else{sizeStr=sizeKB.toFixed(2)+" KB"}return sizeStr}function serializeData(extraData){var serialized=[];if(jQuery.type(extraData)=="string"){serialized=extraData.split("&")}else{serialized=$.param(extraData).split("&")}var len=serialized.length;var result=[];var i,part;for(i=0;i"+files[i].name+" "+s.extErrorStr+s.allowedTypes+"
").appendTo(obj.errorLog);continue}if(s.maxFileSize!=-1&&files[i].size>s.maxFileSize){if(s.showError)$("
"+files[i].name+" "+s.sizeErrorStr+getSizeStr(s.maxFileSize)+"
").appendTo(obj.errorLog);continue}fd.append(fileName+"[]",files[i]);fileArray.push(files[i].name);fileListStr+=obj.fileCounter+"). "+files[i].name+"
";obj.fileCounter++}if(fileArray.length==0)return;var extraData=s.formData;if(extraData){var sData=serializeData(extraData);for(var j=0;j");form.appendTo("body");ajaxFormSubmit(form,ts,pd,fileArray,obj)}function serializeAndUploadFiles(s,obj,files){for(var i=0;i"+files[i].name+" "+s.extErrorStr+s.allowedTypes+"
").appendTo(obj.errorLog);continue}if(!s.allowDuplicates&&isFileDuplicate(obj,files[i].name)){if(s.showError)$("
"+files[i].name+" "+s.duplicateErrorStr+"
").appendTo(obj.errorLog);continue}if(s.maxFileSize!=-1&&files[i].size>s.maxFileSize){if(s.showError)$("
"+files[i].name+" "+s.sizeErrorStr+getSizeStr(s.maxFileSize)+"
").appendTo(obj.errorLog);continue}if(s.maxFileCount!=-1&&obj.selectedFiles>=s.maxFileCount){if(s.showError)$("
"+files[i].name+" "+s.maxFileCountErrorStr+s.maxFileCount+"
").appendTo(obj.errorLog);continue}obj.selectedFiles++;obj.existingFileNames.push(files[i].name);var ts=$.extend({},s);var fd=new FormData;var fileName=s.fileName.replace("[]","");fd.append(fileName,files[i]);var extraData=s.formData;if(extraData){var sData=serializeData(extraData);for(var j=0;j");form.appendTo("body");var fileArray=[];fileArray.push(files[i].name);ajaxFormSubmit(form,ts,pd,fileArray,obj,files[i]);obj.fileCounter++}}function isFileTypeAllowed(obj,s,fileName){var fileExtensions=s.allowedTypes.toLowerCase().split(/[\s,]+/g);var ext=fileName.split(".").pop().toLowerCase();if(s.allowedTypes!="*"&&jQuery.inArray(ext,fileExtensions)<0){return false}return true}function isFileDuplicate(obj,filename){var duplicate=false;if(obj.existingFileNames.length){for(var x=0;x");var fileInputStr="";if(s.multiple){if(s.fileName.indexOf("[]")!=s.fileName.length-2){s.fileName+="[]"}fileInputStr=""}var fileInput=$(fileInputStr).appendTo(form);fileInput.change(function(){obj.errorLog.html("");var fileExtensions=s.allowedTypes.toLowerCase().split(",");var fileArray=[];if(this.files){for(i=0;i"+filenameStr+" "+s.extErrorStr+s.allowedTypes+"
").appendTo(obj.errorLog);return}flist.push({name:filenameStr,size:"NA"});if(s.onSelect(flist)==false)return}updateFileCounter(s,obj);uploadLabel.unbind("click");form.hide();createCustomInputFile(obj,group,s,uploadLabel);form.addClass(group);if(s.serialize&&feature.fileapi&&feature.formdata){form.removeClass(group);var files=this.files;form.remove();serializeAndUploadFiles(s,obj,files)}else{var fileList="";for(var i=0;i";else fileList+=fileArray[i]+"
";obj.fileCounter++}if(s.maxFileCount!=-1&&obj.selectedFiles+fileArray.length>s.maxFileCount){if(s.showError)$("
"+fileList+" "+s.maxFileCountErrorStr+s.maxFileCount+"
").appendTo(obj.errorLog);return}obj.selectedFiles+=fileArray.length;var pd=new createProgressDiv(obj,s);pd.filename.html(fileList);ajaxFormSubmit(form,s,pd,fileArray,obj,null)}});if(s.nestedForms){form.css({margin:0,padding:0});uploadLabel.css({position:"relative",overflow:"hidden",cursor:"default"});fileInput.css({position:"absolute",cursor:"pointer",top:"0px",width:"100%",height:"100%",left:"0px","z-index":"100",opacity:"0.0",filter:"alpha(opacity=0)","-ms-filter":"alpha(opacity=0)","-khtml-opacity":"0.0","-moz-opacity":"0.0"});form.appendTo(uploadLabel)}else{form.appendTo($("body"));form.css({margin:0,padding:0,display:"block",position:"absolute",left:"-250px"});if(navigator.appVersion.indexOf("MSIE ")!=-1){uploadLabel.attr("for",fileUploadId)}else{uploadLabel.click(function(){fileInput.click()})}}}function defaultProgressBar(obj,s){this.statusbar=$("
").width(s.statusBarWidth);this.preview=$("").width(s.previewWidth).height(s.previewHeight).appendTo(this.statusbar).hide();this.filename=$("
").appendTo(this.statusbar);this.progressDiv=$("
").appendTo(this.statusbar).hide();this.progressbar=$("
").appendTo(this.progressDiv);this.abort=$("
"+s.abortStr+"
").appendTo(this.statusbar).hide();this.cancel=$("
"+s.cancelStr+"
").appendTo(this.statusbar).hide();this.done=$("
"+s.doneStr+"
").appendTo(this.statusbar).hide();this.download=$("
"+s.downloadStr+"
").appendTo(this.statusbar).hide();this.del=$("
"+s.deleteStr+"
").appendTo(this.statusbar).hide();this.abort.addClass("ajax-file-upload-red");this.done.addClass("ajax-file-upload-green");this.download.addClass("ajax-file-upload-green");this.cancel.addClass("ajax-file-upload-red");this.del.addClass("ajax-file-upload-red");return this}function createProgressDiv(obj,s){var bar=null;if(s.customProgressBar)bar=new s.customProgressBar(obj,s);else bar=new defaultProgressBar(obj,s);bar.abort.addClass(obj.formGroup);bar.abort.addClass(s.abortButtonClass);bar.cancel.addClass(obj.formGroup);bar.cancel.addClass(s.cancelButtonClass);if(s.extraHTML)bar.extraHTML=$("
"+s.extraHTML()+"
").insertAfter(bar.filename);if(s.uploadQueueOrder=="bottom")$(obj.container).append(bar.statusbar);else $(obj.container).prepend(bar.statusbar);return bar}function ajaxFormSubmit(form,s,pd,fileArray,obj,file){var currentXHR=null;var options={cache:false,contentType:false,processData:false,forceSync:false,type:s.method,data:s.formData,formData:s.fileData,dataType:s.returnType,headers:s.headers,beforeSubmit:function(formData,$form,options){if(s.onSubmit.call(this,fileArray)!=false){if(s.dynamicFormData){var sData=serializeData(s.dynamicFormData());if(sData){for(var j=0;j"+s.uploadErrorStr+"
");pd.cancel.show();form.remove();pd.cancel.click(function(){mainQ.splice(mainQ.indexOf(form),1);removeExistingFileName(obj,fileArray);pd.statusbar.remove();s.onCancel.call(obj,fileArray,pd);obj.selectedFiles-=fileArray.length;updateFileCounter(s,obj)});return false},beforeSend:function(xhr,o){for(var key in o.headers){xhr.setRequestHeader(key,o.headers[key])}pd.progressDiv.show();pd.cancel.hide();pd.done.hide();if(s.showAbort){pd.abort.show();pd.abort.click(function(){removeExistingFileName(obj,fileArray);xhr.abort();obj.selectedFiles-=fileArray.length;s.onAbort.call(obj,fileArray,pd)})}if(!feature.formdata){pd.progressbar.width("5%")}else pd.progressbar.width("1%")},uploadProgress:function(event,position,total,percentComplete){if(percentComplete>98)percentComplete=98;var percentVal=percentComplete+"%";if(percentComplete>1)pd.progressbar.width(percentVal);if(s.showProgress){pd.progressbar.html(percentVal);pd.progressbar.css("text-align","center")}},success:function(data,message,xhr){pd.cancel.remove();progressQ.pop();if(s.returnType=="json"&&$.type(data)=="object"&&data.hasOwnProperty(s.customErrorKeyStr)){pd.abort.hide();var msg=data[s.customErrorKeyStr];s.onError.call(this,fileArray,200,msg,pd);if(s.showStatusAfterError){pd.progressDiv.hide();pd.statusbar.append("ERROR: "+msg+"")}else{pd.statusbar.hide();pd.statusbar.remove()}obj.selectedFiles-=fileArray.length;form.remove();return}obj.responses.push(data);pd.progressbar.width("100%");if(s.showProgress){pd.progressbar.html("100%");pd.progressbar.css("text-align","center")}pd.abort.hide();s.onSuccess.call(this,fileArray,data,xhr,pd);if(s.showStatusAfterSuccess){if(s.showDone){pd.done.show();pd.done.click(function(){pd.statusbar.hide("slow");pd.statusbar.remove()})}else{pd.done.hide()}if(s.showDelete){pd.del.show();pd.del.click(function(){removeExistingFileName(obj,fileArray);pd.statusbar.hide().remove();if(s.deleteCallback)s.deleteCallback.call(this,data,pd);obj.selectedFiles-=fileArray.length;updateFileCounter(s,obj)})}else{pd.del.hide()}}else{pd.statusbar.hide("slow");pd.statusbar.remove()}if(s.showDownload){pd.download.show();pd.download.click(function(){if(s.downloadCallback)s.downloadCallback(data,pd)})}form.remove()},error:function(xhr,status,errMsg){pd.cancel.remove();progressQ.pop();pd.abort.hide();if(xhr.statusText=="abort"){pd.statusbar.hide("slow").remove();updateFileCounter(s,obj)}else{s.onError.call(this,fileArray,status,errMsg,pd);if(s.showStatusAfterError){pd.progressDiv.hide();pd.statusbar.append("ERROR: "+errMsg+"")}else{pd.statusbar.hide();pd.statusbar.remove()}obj.selectedFiles-=fileArray.length}form.remove()}};if(s.showPreview&&file!=null){if(file.type.toLowerCase().split("/").shift()=="image")getSrcToPreview(file,pd.preview)}if(s.autoSubmit){form.ajaxForm(options);mainQ.push(form);submitPendingUploads()}else{if(s.showCancel){pd.cancel.show();pd.cancel.click(function(){mainQ.splice(mainQ.indexOf(form),1);removeExistingFileName(obj,fileArray);form.remove();pd.statusbar.remove();s.onCancel.call(obj,fileArray,pd);obj.selectedFiles-=fileArray.length;updateFileCounter(s,obj)})}form.ajaxForm(options)}}return this};var getUrlParameter=function getUrlParameter(sParam){var sPageURL=window.location.search.substring(1),sURLVariables=sPageURL.split("&"),sParameterName,i;for(i=0;i").get(0).files!==undefined;feature.formdata=window.FormData!==undefined;$.fn.uploadFile=function(options){var s=$.extend({url:"",method:"POST",enctype:"multipart/form-data",returnType:null,allowDuplicates:true,duplicateStrict:false,allowedTypes:"*",acceptFiles:"*",fileName:"file",formData:false,dynamicFormData:false,maxFileSize:-1,maxFileCount:-1,multiple:true,dragDrop:true,autoSubmit:true,showCancel:true,showAbort:true,showDone:false,showDelete:false,showError:true,showStatusAfterSuccess:true,showStatusAfterError:true,showFileCounter:true,fileCounterStyle:"). ",showFileSize:true,showProgress:false,nestedForms:true,showDownload:false,onLoad:function(obj){},onSelect:function(files){return true},onSubmit:function(files,xhr){},onSuccess:function(files,response,xhr,pd){},onError:function(files,status,message,pd){},onCancel:function(files,pd){},onAbort:function(files,pd){},downloadCallback:false,deleteCallback:false,afterUploadAll:false,serialize:true,sequential:false,sequentialCount:2,customProgressBar:false,abortButtonClass:"ajax-file-upload-abort",cancelButtonClass:"ajax-file-upload-cancel",dragDropContainerClass:"ajax-upload-dragdrop",dragDropHoverClass:"state-hover",errorClass:"ajax-file-upload-error",uploadButtonClass:"ajax-file-upload",dragDropStr:"Drag & Drop Files",uploadStr:"Upload",abortStr:"Abort",cancelStr:"Cancel",deleteStr:"Delete",doneStr:"Done",multiDragErrorStr:"Multiple File Drag & Drop is not allowed.",extErrorStr:"is not allowed. Allowed extensions: ",duplicateErrorStr:"is not allowed. File already exists.",sizeErrorStr:"is not allowed. Allowed Max size: ",uploadErrorStr:"Upload is not allowed",maxFileCountErrorStr:" is not allowed. Maximum allowed files are:",downloadStr:"Download",customErrorKeyStr:"jquery-upload-file-error",showQueueDiv:false,statusBarWidth:400,dragdropWidth:400,showPreview:false,previewHeight:"auto",previewWidth:"100%",extraHTML:false,uploadQueueOrder:"top",headers:{}},options);this.fileCounter=1;this.selectedFiles=0;var formGroup="ajax-file-upload-"+(new Date).getTime();this.formGroup=formGroup;this.errorLog=$("
");this.responses=[];this.existingFileNames=[];if(!feature.formdata){s.dragDrop=false}if(!feature.formdata||s.maxFileCount===1){s.multiple=false}$(this).html("");var obj=this;var uploadLabel=$("
"+s.uploadStr+"
");$(uploadLabel).addClass(s.uploadButtonClass);(function checkAjaxFormLoaded(){if($.fn.ajaxForm){if(s.dragDrop){var dragDrop=$('
').width(s.dragdropWidth);$(obj).append(dragDrop);$(dragDrop).append(uploadLabel);$(dragDrop).append($(s.dragDropStr));setDragDropHandlers(obj,s,dragDrop)}else{$(obj).append(uploadLabel)}$(obj).append(obj.errorLog);if(s.showQueueDiv)obj.container=$("#"+s.showQueueDiv);else obj.container=$("
").insertAfter($(obj));s.onLoad.call(this,obj);createCustomInputFile(obj,formGroup,s,uploadLabel)}else window.setTimeout(checkAjaxFormLoaded,10)})();this.startUpload=function(){$("form").each(function(i,items){if($(this).hasClass(obj.formGroup)){mainQ.push($(this))}});if(mainQ.length>=1)submitPendingUploads()};this.getFileCount=function(){return obj.selectedFiles};this.stopUpload=function(){$("."+s.abortButtonClass).each(function(i,items){if($(this).hasClass(obj.formGroup))$(this).click()});$("."+s.cancelButtonClass).each(function(i,items){if($(this).hasClass(obj.formGroup))$(this).click()})};this.cancelAll=function(){$("."+s.cancelButtonClass).each(function(i,items){if($(this).hasClass(obj.formGroup))$(this).click()})};this.update=function(settings){s=$.extend(s,settings);if(settings.hasOwnProperty("url")){$("form").each(function(i,items){$(this).attr("action",settings["url"])})}};this.enqueueFile=function(file){if(!(file instanceof File))return;var files=[file];serializeAndUploadFiles(s,obj,files)};this.reset=function(removeStatusBars){obj.fileCounter=1;obj.selectedFiles=0;obj.errorLog.html("");if(removeStatusBars!=false){obj.container.html("")}};this.remove=function(){obj.container.html("");$(obj).remove()};this.createProgress=function(filename,filepath,filesize){var pd=new createProgressDiv(this,s);pd.progressDiv.show();pd.progressbar.width("100%");var fileNameStr="";if(s.showFileCounter)fileNameStr=obj.fileCounter+s.fileCounterStyle+filename;else fileNameStr=filename;if(s.showFileSize)fileNameStr+=" ("+getSizeStr(filesize)+")";pd.filename.html(fileNameStr);obj.fileCounter++;obj.selectedFiles++;if(s.showPreview){pd.preview.attr("src",filepath);pd.preview.show()}if(s.showDownload){pd.download.show();pd.download.click(function(){if(s.downloadCallback)s.downloadCallback.call(obj,[filename],pd)})}if(s.showDelete){pd.del.show();pd.del.click(function(){pd.statusbar.hide().remove();var arr=[filename];if(s.deleteCallback)s.deleteCallback.call(this,arr,pd);obj.selectedFiles-=1;updateFileCounter(s,obj)})}return pd};this.getResponses=function(){return this.responses};var mainQ=[];var progressQ=[];var running=false;function submitPendingUploads(){if(running)return;running=true;(function checkPendingForms(){if(!s.sequential)s.sequentialCount=99999;if(mainQ.length==0&&progressQ.length==0){if(s.afterUploadAll)s.afterUploadAll(obj);running=false}else{if(progressQ.length1){if(s.showError)$("
"+s.multiDragErrorStr+"
").appendTo(obj.errorLog);return}if(s.onSelect(files)==false)return;serializeAndUploadFiles(s,obj,files)});ddObj.on("dragleave",function(e){$(this).removeClass(s.dragDropHoverClass)});$(document).on("dragenter",function(e){e.stopPropagation();e.preventDefault()});$(document).on("dragover",function(e){e.stopPropagation();e.preventDefault();var that=$(this);if(!that.hasClass(s.dragDropContainerClass)){that.removeClass(s.dragDropHoverClass)}});$(document).on("drop",function(e){e.stopPropagation();e.preventDefault();$(this).removeClass(s.dragDropHoverClass)})}function getSizeStr(size){var sizeStr="";var sizeKB=size/1024;if(parseInt(sizeKB)>1024){var sizeMB=sizeKB/1024;sizeStr=sizeMB.toFixed(2)+" MB"}else{sizeStr=sizeKB.toFixed(2)+" KB"}return sizeStr}function serializeData(extraData){var serialized=[];if(jQuery.type(extraData)=="string"){serialized=extraData.split("&")}else{serialized=$.param(extraData).split("&")}var len=serialized.length;var result=[];var i,part;for(i=0;i"+files[i].name+" "+s.extErrorStr+s.allowedTypes+"
").appendTo(obj.errorLog);continue}if(s.maxFileSize!=-1&&files[i].size>s.maxFileSize){if(s.showError)$("
"+files[i].name+" "+s.sizeErrorStr+getSizeStr(s.maxFileSize)+"
").appendTo(obj.errorLog);continue}fd.append(fileName+"[]",files[i]);fileArray.push(files[i].name);fileListStr+=obj.fileCounter+"). "+files[i].name+"
";obj.fileCounter++}if(fileArray.length==0)return;var extraData=s.formData;if(extraData){var sData=serializeData(extraData);for(var j=0;j");form.appendTo("body");ajaxFormSubmit(form,ts,pd,fileArray,obj)}function serializeAndUploadFiles(s,obj,files){for(var i=0;i"+files[i].name+" "+s.extErrorStr+s.allowedTypes+"
").appendTo(obj.errorLog);continue}if(!s.allowDuplicates&&isFileDuplicate(obj,files[i].name)){if(s.showError)$("
"+files[i].name+" "+s.duplicateErrorStr+"
").appendTo(obj.errorLog);continue}if(s.maxFileSize!=-1&&files[i].size>s.maxFileSize){if(s.showError)$("
"+files[i].name+" "+s.sizeErrorStr+getSizeStr(s.maxFileSize)+"
").appendTo(obj.errorLog);continue}if(s.maxFileCount!=-1&&obj.selectedFiles>=s.maxFileCount){if(s.showError)$("
"+files[i].name+" "+s.maxFileCountErrorStr+s.maxFileCount+"
").appendTo(obj.errorLog);continue}obj.selectedFiles++;obj.existingFileNames.push(files[i].name);var ts=$.extend({},s);var fd=new FormData;var fileName=s.fileName.replace("[]","");fd.append(fileName,files[i]);var extraData=s.formData;if(extraData){var sData=serializeData(extraData);for(var j=0;j");form.appendTo("body");var fileArray=[];fileArray.push(files[i].name);ajaxFormSubmit(form,ts,pd,fileArray,obj,files[i]);obj.fileCounter++}}function isFileTypeAllowed(obj,s,fileName){var fileExtensions=s.allowedTypes.toLowerCase().split(/[\s,]+/g);var ext=fileName.split(".").pop().toLowerCase();if(s.allowedTypes!="*"&&jQuery.inArray(ext,fileExtensions)<0){return false}return true}function isFileDuplicate(obj,filename){var duplicate=false;if(obj.existingFileNames.length){for(var x=0;x");var fileInputStr="";if(s.multiple){if(s.fileName.indexOf("[]")!=s.fileName.length-2){s.fileName+="[]"}fileInputStr=""}var fileInput=$(fileInputStr).appendTo(form);fileInput.change(function(){obj.errorLog.html("");var fileExtensions=s.allowedTypes.toLowerCase().split(",");var fileArray=[];if(this.files){for(i=0;i"+filenameStr+" "+s.extErrorStr+s.allowedTypes+"
").appendTo(obj.errorLog);return}flist.push({name:filenameStr,size:"NA"});if(s.onSelect(flist)==false)return}updateFileCounter(s,obj);uploadLabel.unbind("click");form.hide();createCustomInputFile(obj,group,s,uploadLabel);form.addClass(group);if(s.serialize&&feature.fileapi&&feature.formdata){form.removeClass(group);var files=this.files;form.remove();serializeAndUploadFiles(s,obj,files)}else{var fileList="";for(var i=0;i";else fileList+=fileArray[i]+"
";obj.fileCounter++}if(s.maxFileCount!=-1&&obj.selectedFiles+fileArray.length>s.maxFileCount){if(s.showError)$("
"+fileList+" "+s.maxFileCountErrorStr+s.maxFileCount+"
").appendTo(obj.errorLog);return}obj.selectedFiles+=fileArray.length;var pd=new createProgressDiv(obj,s);pd.filename.html(fileList);ajaxFormSubmit(form,s,pd,fileArray,obj,null)}});if(s.nestedForms){form.css({margin:0,padding:0});uploadLabel.css({position:"relative",overflow:"hidden",cursor:"default"});fileInput.css({position:"absolute",cursor:"pointer",top:"0px",width:"100%",height:"100%",left:"0px","z-index":"100",opacity:"0.0",filter:"alpha(opacity=0)","-ms-filter":"alpha(opacity=0)","-khtml-opacity":"0.0","-moz-opacity":"0.0"});form.appendTo(uploadLabel)}else{form.appendTo($("body"));form.css({margin:0,padding:0,display:"block",position:"absolute",left:"-250px"});if(navigator.appVersion.indexOf("MSIE ")!=-1){uploadLabel.attr("for",fileUploadId)}else{uploadLabel.click(function(){fileInput.click()})}}}function defaultProgressBar(obj,s){this.statusbar=$("
").width(s.statusBarWidth);this.preview=$("").width(s.previewWidth).height(s.previewHeight).appendTo(this.statusbar).hide();this.filename=$("
").appendTo(this.statusbar);this.progressDiv=$("
").appendTo(this.statusbar).hide();this.progressbar=$("
").appendTo(this.progressDiv);this.abort=$("
"+s.abortStr+"
").appendTo(this.statusbar).hide();this.cancel=$("
"+s.cancelStr+"
").appendTo(this.statusbar).hide();this.done=$("
"+s.doneStr+"
").appendTo(this.statusbar).hide();this.download=$("
"+s.downloadStr+"
").appendTo(this.statusbar).hide();this.del=$("
"+s.deleteStr+"
").appendTo(this.statusbar).hide();this.abort.addClass("ajax-file-upload-red");this.done.addClass("ajax-file-upload-green");this.download.addClass("ajax-file-upload-green");this.cancel.addClass("ajax-file-upload-red");this.del.addClass("ajax-file-upload-red");return this}function createProgressDiv(obj,s){var bar=null;if(s.customProgressBar)bar=new s.customProgressBar(obj,s);else bar=new defaultProgressBar(obj,s);bar.abort.addClass(obj.formGroup);bar.abort.addClass(s.abortButtonClass);bar.cancel.addClass(obj.formGroup);bar.cancel.addClass(s.cancelButtonClass);if(s.extraHTML)bar.extraHTML=$("
"+s.extraHTML()+"
").insertAfter(bar.filename);if(s.uploadQueueOrder=="bottom")$(obj.container).append(bar.statusbar);else $(obj.container).prepend(bar.statusbar);return bar}function ajaxFormSubmit(form,s,pd,fileArray,obj,file){var currentXHR=null;var options={cache:false,contentType:false,processData:false,forceSync:false,type:s.method,data:s.formData,formData:s.fileData,dataType:s.returnType,headers:s.headers,beforeSubmit:function(formData,$form,options){if(s.onSubmit.call(this,fileArray)!=false){if(s.dynamicFormData){var sData=serializeData(s.dynamicFormData());if(sData){for(var j=0;j"+s.uploadErrorStr+"
");pd.cancel.show();form.remove();pd.cancel.click(function(){mainQ.splice(mainQ.indexOf(form),1);removeExistingFileName(obj,fileArray);pd.statusbar.remove();s.onCancel.call(obj,fileArray,pd);obj.selectedFiles-=fileArray.length;updateFileCounter(s,obj)});return false},beforeSend:function(xhr,o){for(var key in o.headers){xhr.setRequestHeader(key,o.headers[key])}pd.progressDiv.show();pd.cancel.hide();pd.done.hide();if(s.showAbort){pd.abort.show();pd.abort.click(function(){removeExistingFileName(obj,fileArray);xhr.abort();obj.selectedFiles-=fileArray.length;s.onAbort.call(obj,fileArray,pd)})}if(!feature.formdata){pd.progressbar.width("5%")}else pd.progressbar.width("1%")},uploadProgress:function(event,position,total,percentComplete){if(percentComplete>98)percentComplete=98;var percentVal=percentComplete+"%";if(percentComplete>1)pd.progressbar.width(percentVal);if(s.showProgress){pd.progressbar.html(percentVal);pd.progressbar.css("text-align","center")}},success:function(data,message,xhr){pd.cancel.remove();progressQ.pop();if(s.returnType=="json"&&$.type(data)=="object"&&data.hasOwnProperty(s.customErrorKeyStr)){pd.abort.hide();var msg=data[s.customErrorKeyStr];s.onError.call(this,fileArray,200,msg,pd);if(s.showStatusAfterError){pd.progressDiv.hide();pd.statusbar.append("ERROR: "+msg+"")}else{pd.statusbar.hide();pd.statusbar.remove()}obj.selectedFiles-=fileArray.length;form.remove();return}obj.responses.push(data);pd.progressbar.width("100%");if(s.showProgress){pd.progressbar.html("100%");pd.progressbar.css("text-align","center")}pd.abort.hide();s.onSuccess.call(this,fileArray,data,xhr,pd);if(s.showStatusAfterSuccess){if(s.showDone){pd.done.show();pd.done.click(function(){pd.statusbar.hide("slow");pd.statusbar.remove()})}else{pd.done.hide()}if(s.showDelete){pd.del.show();pd.del.click(function(){removeExistingFileName(obj,fileArray);pd.statusbar.hide().remove();if(s.deleteCallback)s.deleteCallback.call(this,data,pd);obj.selectedFiles-=fileArray.length;updateFileCounter(s,obj)})}else{pd.del.hide()}}else{pd.statusbar.hide("slow");pd.statusbar.remove()}if(s.showDownload){pd.download.show();pd.download.click(function(){if(s.downloadCallback)s.downloadCallback(data,pd)})}form.remove()},error:function(xhr,status,errMsg){pd.cancel.remove();progressQ.pop();pd.abort.hide();if(xhr.statusText=="abort"){pd.statusbar.hide("slow").remove();updateFileCounter(s,obj)}else{s.onError.call(this,fileArray,status,errMsg,pd);if(s.showStatusAfterError){pd.progressDiv.hide();pd.statusbar.append("ERROR: "+errMsg+"")}else{pd.statusbar.hide();pd.statusbar.remove()}obj.selectedFiles-=fileArray.length}form.remove()}};if(s.showPreview&&file!=null){if(file.type.toLowerCase().split("/").shift()=="image")getSrcToPreview(file,pd.preview)}if(s.autoSubmit){form.ajaxForm(options);mainQ.push(form);submitPendingUploads()}else{if(s.showCancel){pd.cancel.show();pd.cancel.click(function(){mainQ.splice(mainQ.indexOf(form),1);removeExistingFileName(obj,fileArray);form.remove();pd.statusbar.remove();s.onCancel.call(obj,fileArray,pd);obj.selectedFiles-=fileArray.length;updateFileCounter(s,obj)})}form.ajaxForm(options)}}return this};var getUrlParameter=function getUrlParameter(sParam){var sPageURL=window.location.search.substring(1),sURLVariables=sPageURL.split("&"),sParameterName,i;for(i=0;iregisterJs($js); From 9b59a55cd1db023e516dfedb5dc27eefa33ef5b1 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Fri, 22 Nov 2019 19:29:11 +0800 Subject: [PATCH 074/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=8B=93=E5=B1=95=E5=90=8D=E6=9F=A5=E6=89=BE?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=AE=9A=E4=B9=89=E7=9A=84=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/logic/file/FileManager.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/logic/file/FileManager.php b/backend/logic/file/FileManager.php index da311a8..d8e054c 100644 --- a/backend/logic/file/FileManager.php +++ b/backend/logic/file/FileManager.php @@ -25,11 +25,11 @@ class FileManager /** * @param $array - * @param $value - * @return int - * 查看$extension数组中是否存在文件类型,不存在则返回-1 + * @param $keyword + * @return bool|int|string + * 根据文件拓展名在$extension中查找对应的文件类型,若不存在则返回false */ - public function searchType($array, $keyword, $key=-1){ + public function searchType($array, $keyword){ foreach($array as $key => $value){ foreach ($value as $k => $v) { if($v == $keyword){ From 56e00b68aabdb83de8ac64da8f79ef140f763783 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Fri, 22 Nov 2019 19:54:05 +0800 Subject: [PATCH 075/102] =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/models/ars/File.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/models/ars/File.php b/common/models/ars/File.php index 1c6a983..a6a41fd 100644 --- a/common/models/ars/File.php +++ b/common/models/ars/File.php @@ -22,8 +22,12 @@ use yii\behaviors\TimestampBehavior; */ class File extends \yii\db\ActiveRecord { + //own_type const OWN_TYPE_GOODS_INDEX = 1;//商品首页 const OWN_TYPE_GOODS_DETAILS = 2;//商品详情 + //is_delete + const IS_DELETE_YES = 1;//已删除 + const IS_DELETE_NO = 0;//未删除 /** * {@inheritdoc} */ From cb1f7310ea8d898bf4698c67860510f7c159b55c Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Fri, 22 Nov 2019 19:55:27 +0800 Subject: [PATCH 076/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E6=A0=B9=E6=8D=AEarray=5Fdiff=E6=96=B9=E6=B3=95=E5=AF=B9?= =?UTF-8?q?=E6=AF=94=E6=97=A7=E6=95=B0=E6=8D=AE=E6=95=B0=E7=BB=84=E5=92=8C?= =?UTF-8?q?=E6=96=B0=E6=95=B0=E6=8D=AE=E6=95=B0=E7=BB=84,=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E5=88=9B=E5=BB=BA=E5=92=8C=E5=88=A0=E9=99=A4=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/logic/file/FileManager.php | 27 +++++++++++++++---- .../goods/src/logic/goods/GoodsManager.php | 23 +++++++++++----- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/backend/logic/file/FileManager.php b/backend/logic/file/FileManager.php index d8e054c..d164216 100644 --- a/backend/logic/file/FileManager.php +++ b/backend/logic/file/FileManager.php @@ -29,7 +29,8 @@ class FileManager * @return bool|int|string * 根据文件拓展名在$extension中查找对应的文件类型,若不存在则返回false */ - public function searchType($array, $keyword){ + public function searchType($array, $keyword) + { foreach($array as $key => $value){ foreach ($value as $k => $v) { if($v == $keyword){ @@ -47,16 +48,15 @@ class FileManager * @return array * 根据临时文件id(字符串)将临时文件保存在文件中 */ - public function saveTemFileToFile($temFIleIdStr, $ownId, $ownType) + public function saveTemFileToFile($temFIleIdArr, $ownId, $ownType) { - if(!$temFIleIdStr || !$ownId) { + if(!$temFIleIdArr || !$ownId) { return ['status' => false, 'info' => '参数错误']; } - $img_id_arr = explode(',', $temFIleIdStr); $i = 1; $first_file_id = 0; - foreach ($img_id_arr as $key => $value) { + foreach ($temFIleIdArr as $key => $value) { $tem_file = TemFile::findOne($value); if(!$tem_file) { @@ -99,4 +99,21 @@ class FileManager return ['status' => false]; } } + + /** + * @param $fileIdArr + * 删除file表中的文件 + */ + public function deleteFile($fileIdArr) + { + if($fileIdArr){ + foreach ($fileIdArr as $key => $value) { + $file_model = File::findOne($value); + if($file_model){ + $file_model->is_delete = File::IS_DELETE_YES; + $file_model->save(); + } + } + } + } } \ No newline at end of file diff --git a/vendor/antgoods/goods/src/logic/goods/GoodsManager.php b/vendor/antgoods/goods/src/logic/goods/GoodsManager.php index b1410d8..4f69054 100644 --- a/vendor/antgoods/goods/src/logic/goods/GoodsManager.php +++ b/vendor/antgoods/goods/src/logic/goods/GoodsManager.php @@ -7,24 +7,35 @@ namespace antgoods\goods\logic\goods; class GoodsManager { /** - * @param $fileIdStr + * @param $newFileIdArr + * @param array $oldFileIdArr * @param $goodsModel * @param int $filetype * @return bool - * 判断file逻辑文件FileManager和file模型文件是否存在,若存在,则执行文件保存操作 + * 保存新文件,删除不需要的文件操作 */ - public function saveFile($fileIdStr, $goodsModel, $filetype = 1) + public function saveFile($newFileIdArr, $oldFileIdArr = [], $goodsModel, $filetype = 1) { //判断类名是否存在 if(!class_exists('\backend\logic\file\FileManager') || !class_exists('\common\models\ars\File')) { return false; } + //需要新建的文件id + $create_file_id_arr = array_diff($newFileIdArr, $oldFileIdArr); + + //创建文件 $class = new \backend\logic\file\FileManager(); - $res = $class->saveTemFileToFile($fileIdStr, $goodsModel->id, $filetype); + $create_file_res = $class->saveTemFileToFile($create_file_id_arr, $goodsModel->id, $filetype); + + //需要删除的文件id + $del_file_id_arr = array_diff($oldFileIdArr, $newFileIdArr); + + //删除文件 + $class->deleteFile($del_file_id_arr); - if($res['status'] || $filetype == \common\models\ars\File::OWN_TYPE_GOODS_INDEX) { - $goodsModel->image = $res['first_file_id']; + if($create_file_res['status'] || $filetype == \common\models\ars\File::OWN_TYPE_GOODS_INDEX) { + $goodsModel->image = $create_file_res['first_file_id']; $goodsModel->save(); } From f1c87201e6e2012784187d2105ffdb8ddee86a3c Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Fri, 22 Nov 2019 20:30:58 +0800 Subject: [PATCH 077/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=92=8C=E5=88=A0=E9=99=A4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/logic/file/FileManager.php | 13 +++++++---- .../goods/src/controllers/GoodsController.php | 23 +++++++++++++++---- .../goods/src/logic/goods/GoodsManager.php | 13 ++++++----- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/backend/logic/file/FileManager.php b/backend/logic/file/FileManager.php index d164216..579096a 100644 --- a/backend/logic/file/FileManager.php +++ b/backend/logic/file/FileManager.php @@ -34,11 +34,11 @@ class FileManager foreach($array as $key => $value){ foreach ($value as $k => $v) { if($v == $keyword){ - return $key; + return ['status' => true, 'info' => '操作成功', 'type' => $key]; } } } - return false; + return ['status' => false, 'info' => '操作失败']; } /** @@ -94,9 +94,9 @@ class FileManager $new_file->alias = $temFile->alias; $new_file->path = $temFile->path; if($new_file->save()) { - return ['status' => true, 'file_id' => $new_file->id]; + return ['status' => true, 'info' => '操作成功', 'file_id' => $new_file->id]; } else { - return ['status' => false]; + return ['status' => false, 'info' => '操作失败']; } } @@ -111,9 +111,12 @@ class FileManager $file_model = File::findOne($value); if($file_model){ $file_model->is_delete = File::IS_DELETE_YES; - $file_model->save(); + if($file_model->save()){ + return ['status' => false, 'info' => '操作失败']; + } } } } + return ['status' => true, 'info' => '操作成功']; } } \ No newline at end of file diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index 9dbc2a7..e82edc5 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -85,7 +85,11 @@ class GoodsController extends Controller $file_id_str = $model->imageId; $model->save(); $goods_manager = new GoodsManager(); - $goods_manager->saveFile($file_id_str, $model); + $save_file_res = $goods_manager->saveFile(explode($file_id_str), $model); + if($save_file_res['status']){ + $model->image = $save_file_res['first_file_id']; + $model->save(); + } return $this->redirect('index'); } @@ -105,8 +109,17 @@ class GoodsController extends Controller { $model = $this->findModel($id); $model->imageId = $model->image; + $old_id_arr = $model->image; - if ($model->load(Yii::$app->request->post()) && $model->save()) { + if ($model->load(Yii::$app->request->post())) { + $file_id_str = $model->imageId; + $model->save(); + $goods_manager = new GoodsManager(); + $save_file_res = $goods_manager->saveFile(explode($file_id_str), $model, $old_id_arr); + if($save_file_res['status']){ + $model->image = $save_file_res['first_file_id']; + $model->save(); + } return $this->redirect('index'); } @@ -183,9 +196,9 @@ class GoodsController extends Controller $model->user_id = Yii::$app->user->identity->id; $model->name = $file_name; $file_manager = new \backend\logic\file\FileManager(); - $type = $file_manager->searchType(\backend\logic\file\FileManager::$extension, pathinfo($data['path'])['extension']); - if ($type) { - $model->type = $type; + $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']; diff --git a/vendor/antgoods/goods/src/logic/goods/GoodsManager.php b/vendor/antgoods/goods/src/logic/goods/GoodsManager.php index 4f69054..c52e8d3 100644 --- a/vendor/antgoods/goods/src/logic/goods/GoodsManager.php +++ b/vendor/antgoods/goods/src/logic/goods/GoodsManager.php @@ -14,11 +14,11 @@ class GoodsManager * @return bool * 保存新文件,删除不需要的文件操作 */ - public function saveFile($newFileIdArr, $oldFileIdArr = [], $goodsModel, $filetype = 1) + public function saveFile($newFileIdArr, $goodsModel, $oldFileIdArr = [], $filetype = 1) { //判断类名是否存在 if(!class_exists('\backend\logic\file\FileManager') || !class_exists('\common\models\ars\File')) { - return false; + return ['status' => false, 'info' => '操作失败']; } //需要新建的文件id @@ -34,11 +34,12 @@ class GoodsManager //删除文件 $class->deleteFile($del_file_id_arr); - if($create_file_res['status'] || $filetype == \common\models\ars\File::OWN_TYPE_GOODS_INDEX) { - $goodsModel->image = $create_file_res['first_file_id']; - $goodsModel->save(); + //记录第一张图片id + $first_file_id = 0; + if($create_file_res['status']) { + $first_file_id = $create_file_res['first_file_id']; } - return true; + return ['status' => true, 'info' => '操作成功', 'first_file_id' => $first_file_id]; } } \ No newline at end of file From f141de9bc7f2d5749dabeb1030f8fdcffb58f053 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Sat, 23 Nov 2019 14:26:51 +0800 Subject: [PATCH 078/102] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=96=B9=E6=B3=95explode=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/controllers/GoodsController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index e82edc5..6458eb3 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -85,7 +85,7 @@ class GoodsController extends Controller $file_id_str = $model->imageId; $model->save(); $goods_manager = new GoodsManager(); - $save_file_res = $goods_manager->saveFile(explode($file_id_str), $model); + $save_file_res = $goods_manager->saveFile(explode(',', $file_id_str), $model); if($save_file_res['status']){ $model->image = $save_file_res['first_file_id']; $model->save(); @@ -115,7 +115,7 @@ class GoodsController extends Controller $file_id_str = $model->imageId; $model->save(); $goods_manager = new GoodsManager(); - $save_file_res = $goods_manager->saveFile(explode($file_id_str), $model, $old_id_arr); + $save_file_res = $goods_manager->saveFile(explode(',', $file_id_str), $model, $old_id_arr); if($save_file_res['status']){ $model->image = $save_file_res['first_file_id']; $model->save(); From 265e6ec21d59c606f8c5197d1e5a1fe28ef8841a Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Sat, 23 Nov 2019 14:29:05 +0800 Subject: [PATCH 079/102] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=BD=BF=E7=94=A8=E5=87=BD=E6=95=B0array=5Fd?= =?UTF-8?q?iff=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/controllers/GoodsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index 6458eb3..ab3177e 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -115,7 +115,7 @@ class GoodsController extends Controller $file_id_str = $model->imageId; $model->save(); $goods_manager = new GoodsManager(); - $save_file_res = $goods_manager->saveFile(explode(',', $file_id_str), $model, $old_id_arr); + $save_file_res = $goods_manager->saveFile(explode(',', $file_id_str), $model, explode(',', $old_id_arr)); if($save_file_res['status']){ $model->image = $save_file_res['first_file_id']; $model->save(); From 8983b84078839e7ef886332767d63341ceb50220 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Sat, 23 Nov 2019 14:29:41 +0800 Subject: [PATCH 080/102] =?UTF-8?q?=E5=B0=86=E5=95=86=E5=93=81=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E8=A1=A8=E5=8D=95=E5=9B=BE=E7=89=87id=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/views/goods/_form.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index 4a30336..cba100e 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -68,7 +68,7 @@ use antgoods\goods\models\ars\Supplier; field($model, 'express_template')->textInput() ?> - field($model, 'imageId')->textInput()->label('') ?> + field($model, 'imageId')->hiddenInput()->label('') ?> field($model, 'imagePath')->widget(\iron\widgets\Upload::className(), [ 'url' => 'upload', 'deleteUrl' => 'imageDel', From d56b764f3ad93c92c29bfbfe386df80719e0409f Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Mon, 25 Nov 2019 08:53:40 +0800 Subject: [PATCH 081/102] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=AE=9E=E4=BE=8B=E5=8C=96php=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=92=8CJavaScript=E4=BB=A3=E7=A0=81=E5=88=86?= =?UTF-8?q?=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods/src/controllers/GoodsController.php | 2 +- .../antgoods/goods/src/views/goods/_form.php | 31 +---- vendor/iron/widgets/Upload.php | 124 +++++++++++++----- 3 files changed, 94 insertions(+), 63 deletions(-) diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index ab3177e..66a8d41 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -180,7 +180,7 @@ class GoodsController extends Controller } /** - * 处理文件上传成功后回调保存到临时文件表中 + * 处理文件上传成功后回调保存到临时文件表中,并返回临时文件id */ public function actionSaveFile() { diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index cba100e..b475d64 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -68,36 +68,15 @@ use antgoods\goods\models\ars\Supplier; field($model, 'express_template')->textInput() ?> - field($model, 'imageId')->hiddenInput()->label('') ?> + field($model, 'imageId')->textInput()->label('') ?> field($model, 'imagePath')->widget(\iron\widgets\Upload::className(), [ 'url' => 'upload', - 'deleteUrl' => 'imageDel', + 'deleteUrl' => 'img-id-del', 'dragdropWidth'=> 800, 'afterSave' => 'save-file', - 'maxCount' => 1, - 'successScript' => " - success: function(data) - { - var imageval = $('#goods-imageid').val(); - if(imageval == ''){ - $('#goods-imageid').val(data); - }else{ - $('#goods-imageid').val($('#goods-imageid').val()+','+data); - } - } - ", - 'deleteScript' => " - console.log(data); - $.ajax({ - url: 'img-id-del', - data: {data: data, imgid: $('#goods-imageid').val()}, - success: function(data) - { - console.log(data); - $('#goods-imageid').val(data); - }, - }); - ", + 'maxCount' => 10, + 'fillInAttribute' => 'imageId', + 'model' => $model, 'previewConfig' => [ 'url' => 'image-file?fileidstr='.$model->imageId, ], diff --git a/vendor/iron/widgets/Upload.php b/vendor/iron/widgets/Upload.php index 4db48f0..a5132db 100644 --- a/vendor/iron/widgets/Upload.php +++ b/vendor/iron/widgets/Upload.php @@ -26,9 +26,12 @@ namespace iron\widgets; use iron\web\UploadAsset; +use yii\base\InvalidArgumentException; +use yii\base\Model; use yii\helpers\Html; use yii\web\NotFoundHttpException; use yii\widgets\InputWidget; +use yii; /*** * @author iron @@ -97,37 +100,26 @@ class Upload extends InputWidget */ public $dragdropWidth; /** - * @var javascript - * 图片上传成功回调方法 + * @var + * 数据模型 + */ + public $model; + /** + * @var + * 填入结果的参数 */ - public $successScript; + public $fillInAttribute; /** * @var - * 删除图片触发方法 - * $.ajax({ - * url: 'img-id-del', - * data: {data: data, imgid: $('#goods-image').val()}, - * success: function(data) - * { - * $('#goods-image').val(data); - * }, - * }); - * - * 路由方法 - * public function actionImgIdDel() - * { - * $alias = Yii::$app->request->get('data')['alias']; - * $imgid = Yii::$app->request->get('imgid'); - * $imgidarr = explode(',', $imgid); - * $temfile = TemFile::findOne(['alias' => $alias]); - * if ($temfile) { - * $imgidarr = array_diff($imgidarr, [$temfile->id]); - * } - * $imgidstr = implode(',', $imgidarr); - * return $imgidstr; - * } - */ - public $deleteScript; + * 填入结果的输入框id + */ + private $fillInId; + /** + * @var string Regular expression used for attribute name validation. + * @since 2.0.12 + * 属性匹配规则 + */ + private static $attributeRegex = '/(^|.*\])([\w\.\+]+)(\[.*|$)/u'; /** * @throws NotFoundHttpException @@ -152,6 +144,13 @@ class Upload extends InputWidget $this->maxCount = $this->maxCount ?: 10;//默认数量限制十张图 $this->showDelete = $this->deleteUrl ? 'true' : 'false';//默认不显示删除按钮 $this->maxSize = $this->maxSize ? $this->maxSize *= 1024 : 2 * 1024 * 1024;//默认限制2M大小; + if (!$this->fillInAttribute) { + throw new NotFoundHttpException('(fillInAttribute) 必须配置填入参数'); + } + if (!$this->model) { + throw new NotFoundHttpException('(model) 必须配置model'); + } + $this->fillInId = self::getInputId($this->model, $this->fillInAttribute); } /** @@ -196,7 +195,15 @@ class Upload extends InputWidget url: "{$this->afterSave}", dataType: "json", data: {data: data, fileName: files}, - {$this->successScript}, + success: function(data) + { + var imageval = $('#{$this->fillInId}').val(); + if(imageval == ''){ + $('#{$this->fillInId}').val(data); + }else{ + $('#{$this->fillInId}').val($('#{$this->fillInId}').val()+','+data); + } + } }); }, onLoad:function(obj) @@ -215,13 +222,21 @@ class Upload extends InputWidget }); }, deleteCallback: function (data, pd) { - {$this->deleteScript} - for (var i = 0; i < data.length; i++) { - $.post("{$this->deleteUrl}", {op: "delete",name: data[i]}, - function (resp,textStatus, jqXHR) { - - }); - } + $.ajax({ + url: '{$this->deleteUrl}', + data: {data: data, imgid: $('#{$this->fillInId}').val()}, + success: function(data) + { + console.log(data); + $('#{$this->fillInId}').val(data); + }, + }); +// for (var i = 0; i < data.length; i++) { +// $.post("{$this->deleteUrl}", {op: "delete",name: data[i]}, +// function (resp,textStatus, jqXHR) { +// +// }); +// } pd.statusbar.hide(); //You choice. }, @@ -249,4 +264,41 @@ SCRIPT;
'; } + + /** + * @param $model + * @param $attribute + * @return string + * 获取要填入属性的输入框name + */ + private static function getInputName($model, $attribute) + { + $formName = $model->formName(); + if (!preg_match(static::$attributeRegex, $attribute, $matches)) { + throw new InvalidArgumentException('Attribute name must contain word characters only.'); + } + $prefix = $matches[1]; + $attribute = $matches[2]; + $suffix = $matches[3]; + if ($formName === '' && $prefix === '') { + return $attribute . $suffix; + } elseif ($formName !== '') { + return $formName . $prefix . "[$attribute]" . $suffix; + } + + throw new InvalidArgumentException(get_class($model) . '::formName() cannot be empty for tabular inputs.'); + } + + /** + * @param $model + * @param $attribute + * @return mixed + * 获取要填入属性的输入框id + */ + private static function getInputId($model, $attribute) + { + $charset = Yii::$app ? Yii::$app->charset : 'UTF-8'; + $name = mb_strtolower(static::getInputName($model, $attribute), $charset); + return str_replace(['[]', '][', '[', ']', ' ', '.'], ['', '-', '-', '', '-', '-'], $name); + } } From 0167f3b76304f4621f62b71636b0b0e317acf20f Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Mon, 25 Nov 2019 09:02:36 +0800 Subject: [PATCH 082/102] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=B7=B2=E6=9C=89=E8=AE=B0=E5=BD=95=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E7=9A=84=E8=B7=AF=E5=BE=84=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BAyii2=E7=9A=84Url=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/views/goods/_form.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index b475d64..4844378 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -6,6 +6,7 @@ use antgoods\goods\models\ars\Category; use antgoods\goods\models\ars\Brand; use antgoods\goods\models\ars\ShopCategory; use antgoods\goods\models\ars\Supplier; +use yii\helpers\Url; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Goods */ @@ -78,7 +79,7 @@ use antgoods\goods\models\ars\Supplier; 'fillInAttribute' => 'imageId', 'model' => $model, 'previewConfig' => [ - 'url' => 'image-file?fileidstr='.$model->imageId, + 'url' => Url::to(['image-file', 'fileidstr' => $model->imageId]), ], ])->label('图片') ?> From 7cd213840df13d389ba27b26316a684fe0bfd0e1 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Mon, 25 Nov 2019 09:05:40 +0800 Subject: [PATCH 083/102] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=95=86=E5=93=81?= =?UTF-8?q?=E8=A7=84=E6=A0=BC=E8=A1=A8=E5=8D=95=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/models/ars/Attribute.php | 4 ++-- vendor/antgoods/goods/src/views/attribute/_form.php | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/vendor/antgoods/goods/src/models/ars/Attribute.php b/vendor/antgoods/goods/src/models/ars/Attribute.php index ecefe05..d621446 100644 --- a/vendor/antgoods/goods/src/models/ars/Attribute.php +++ b/vendor/antgoods/goods/src/models/ars/Attribute.php @@ -52,8 +52,8 @@ class Attribute extends \yii\db\ActiveRecord { return [ 'id' => 'id', - 'name' => '属性名', - 'value' => '属性值', + 'name' => '规格名称', + 'value' => '规格内容(每项以逗号隔开)', 'type' => '类型', 'sort_order' => '排序', 'is_delete' => '是否删除,1为已删除', diff --git a/vendor/antgoods/goods/src/views/attribute/_form.php b/vendor/antgoods/goods/src/views/attribute/_form.php index 6984a47..b0e98f7 100644 --- a/vendor/antgoods/goods/src/views/attribute/_form.php +++ b/vendor/antgoods/goods/src/views/attribute/_form.php @@ -16,8 +16,6 @@ use yii\bootstrap4\ActiveForm; field($model, 'value')->textarea(['rows' => 6]) ?> - field($model, 'type')->textInput() ?> - field($model, 'sort_order')->textInput() ?>
From 8ebddf2c0854cc7333a683fe2585081b49e5688a Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Mon, 25 Nov 2019 09:28:53 +0800 Subject: [PATCH 084/102] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=88=86=E7=B1=BBicon=5Ftype=E5=AD=97=E6=AE=B5=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E5=9C=A8=E8=A1=A8=E5=8D=95=E4=B8=AD=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ..._column_icon_type_in_antgoods_category.php | 22 +++++++++++++++++++ .../goods/src/views/category/_form.php | 2 -- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 vendor/antgoods/goods/src/migrations/m191125_012449_update_column_icon_type_in_antgoods_category.php diff --git a/vendor/antgoods/goods/src/migrations/m191125_012449_update_column_icon_type_in_antgoods_category.php b/vendor/antgoods/goods/src/migrations/m191125_012449_update_column_icon_type_in_antgoods_category.php new file mode 100644 index 0000000..00fb52e --- /dev/null +++ b/vendor/antgoods/goods/src/migrations/m191125_012449_update_column_icon_type_in_antgoods_category.php @@ -0,0 +1,22 @@ +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/vendor/antgoods/goods/src/views/category/_form.php b/vendor/antgoods/goods/src/views/category/_form.php index c047cae..508550f 100644 --- a/vendor/antgoods/goods/src/views/category/_form.php +++ b/vendor/antgoods/goods/src/views/category/_form.php @@ -19,8 +19,6 @@ use blobt\widgets\Icheck; field($model, 'sort_order')->textInput() ?> - field($model, 'icon_type')->textInput() ?> - field($model, 'icon')->textInput(['maxlength' => true]) ?> field($model, 'is_show')->widget(Icheck::className(), ["items" => $model::$isShow, 'type' => "radio"]) ?> From 3216c9aa54c0b58d6f422843160b67a105802bf2 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Mon, 25 Nov 2019 09:46:29 +0800 Subject: [PATCH 085/102] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E5=88=A0=E9=99=A4=E5=95=86=E5=93=81=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/views/category/_form.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/vendor/antgoods/goods/src/views/category/_form.php b/vendor/antgoods/goods/src/views/category/_form.php index 508550f..313e3b6 100644 --- a/vendor/antgoods/goods/src/views/category/_form.php +++ b/vendor/antgoods/goods/src/views/category/_form.php @@ -15,8 +15,6 @@ use blobt\widgets\Icheck; field($model, 'name')->textInput(['maxlength' => true]) ?> - field($model, 'goods_count')->textInput() ?> - field($model, 'sort_order')->textInput() ?> field($model, 'icon')->textInput(['maxlength' => true]) ?> From fe4a41fed61fed8883dfc347e5590c0b40a40ba0 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Mon, 25 Nov 2019 09:47:22 +0800 Subject: [PATCH 086/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=93=81?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E5=95=86=E5=93=81=E9=A6=96=E9=A1=B5=E5=8F=AF?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=9B=BE=E7=89=87=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/views/goods/_form.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index 4844378..8fbbe82 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -75,7 +75,7 @@ use yii\helpers\Url; 'deleteUrl' => 'img-id-del', 'dragdropWidth'=> 800, 'afterSave' => 'save-file', - 'maxCount' => 10, + 'maxCount' => 1, 'fillInAttribute' => 'imageId', 'model' => $model, 'previewConfig' => [ From 59ec48ce2d3b3cb715808f0d26ab8ebd9c6d1126 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Mon, 25 Nov 2019 09:55:05 +0800 Subject: [PATCH 087/102] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=97=B6=E5=BD=93=E6=96=87=E4=BB=B6=E4=B8=B4?= =?UTF-8?q?=E6=97=B6id=E4=B8=BA0=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/iron/widgets/Upload.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/iron/widgets/Upload.php b/vendor/iron/widgets/Upload.php index a5132db..6f8b10e 100644 --- a/vendor/iron/widgets/Upload.php +++ b/vendor/iron/widgets/Upload.php @@ -198,7 +198,7 @@ class Upload extends InputWidget success: function(data) { var imageval = $('#{$this->fillInId}').val(); - if(imageval == ''){ + if(imageval == '' || imageval == 0){ $('#{$this->fillInId}').val(data); }else{ $('#{$this->fillInId}').val($('#{$this->fillInId}').val()+','+data); From e71848e3118adc5d5b9826ed96c38f75dedfb297 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Mon, 25 Nov 2019 09:59:15 +0800 Subject: [PATCH 088/102] =?UTF-8?q?=E5=A4=84=E7=90=86=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=B0=81=E9=9D=A2=E5=9B=BE=E7=89=87=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/controllers/GoodsController.php | 6 +++--- vendor/antgoods/goods/src/models/ars/Goods.php | 6 +++--- vendor/antgoods/goods/src/views/goods/_form.php | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index 66a8d41..9d7691d 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -82,7 +82,7 @@ class GoodsController extends Controller $model = new Goods(); if ($model->load(Yii::$app->request->post())) { - $file_id_str = $model->imageId; + $file_id_str = $model->coverImageId; $model->save(); $goods_manager = new GoodsManager(); $save_file_res = $goods_manager->saveFile(explode(',', $file_id_str), $model); @@ -108,11 +108,11 @@ class GoodsController extends Controller public function actionUpdate($id) { $model = $this->findModel($id); - $model->imageId = $model->image; + $model->coverImageId = $model->image; $old_id_arr = $model->image; if ($model->load(Yii::$app->request->post())) { - $file_id_str = $model->imageId; + $file_id_str = $model->coverImageId; $model->save(); $goods_manager = new GoodsManager(); $save_file_res = $goods_manager->saveFile(explode(',', $file_id_str), $model, explode(',', $old_id_arr)); diff --git a/vendor/antgoods/goods/src/models/ars/Goods.php b/vendor/antgoods/goods/src/models/ars/Goods.php index ad00d9c..6dd092c 100644 --- a/vendor/antgoods/goods/src/models/ars/Goods.php +++ b/vendor/antgoods/goods/src/models/ars/Goods.php @@ -44,8 +44,8 @@ use yii\behaviors\TimestampBehavior; */ class Goods extends \yii\db\ActiveRecord { - public $imagePath; - public $imageId; + public $coverImagePath; + public $coverImageId; //是否删除is_delete const IS_DELETE_NO = 0;//未删除 const IS_DELETE_YES = 1;//已删除 @@ -73,7 +73,7 @@ class Goods extends \yii\db\ActiveRecord [['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'], 'integer'], [['cat_id', 'brand_id', 'shop_cat_id', 'name'], 'required'], [['sn'], 'checkExist'], - [['description', 'imageId'], 'string'], + [['description', 'coverImageId'], 'string'], [['name'], 'string', 'max' => 120], [['sn'], 'string', 'max' => 60], [['code'], 'string', 'max' => 50], diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index 8fbbe82..d9db444 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -69,17 +69,17 @@ use yii\helpers\Url; field($model, 'express_template')->textInput() ?> - field($model, 'imageId')->textInput()->label('') ?> - field($model, 'imagePath')->widget(\iron\widgets\Upload::className(), [ + field($model, 'coverImageId')->textInput()->label('') ?> + field($model, 'coverImagePath')->widget(\iron\widgets\Upload::className(), [ 'url' => 'upload', 'deleteUrl' => 'img-id-del', 'dragdropWidth'=> 800, 'afterSave' => 'save-file', 'maxCount' => 1, - 'fillInAttribute' => 'imageId', + 'fillInAttribute' => 'coverImageId', 'model' => $model, 'previewConfig' => [ - 'url' => Url::to(['image-file', 'fileidstr' => $model->imageId]), + 'url' => Url::to(['image-file', 'fileidstr' => $model->coverImageId]), ], ])->label('图片') ?> From 0486802ad33a85a681cfbe7b6688f9e654b32aec Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Mon, 25 Nov 2019 11:09:43 +0800 Subject: [PATCH 089/102] =?UTF-8?q?=E5=A4=84=E7=90=86=E4=B8=A4=E4=B8=AA?= =?UTF-8?q?=E4=BB=A5=E4=B8=8A=E4=B8=8A=E4=BC=A0=E6=8F=92=E4=BB=B6=E5=9C=A8?= =?UTF-8?q?=E5=90=8C=E4=B8=80=E9=A1=B5=E9=9D=A2=E6=97=B6=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E6=B7=B7=E4=B9=B1=E9=97=AE=E9=A2=98=EF=BC=8C=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=B0=81=E9=9D=A2=E5=9B=BE=E5=92=8C=E5=95=86?= =?UTF-8?q?=E5=93=81=E8=AF=A6=E6=83=85=E5=9B=BE=E4=BF=9D=E5=AD=98=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods/src/controllers/GoodsController.php | 26 ++++++++++++------- .../antgoods/goods/src/models/ars/Goods.php | 6 ++++- .../antgoods/goods/src/views/goods/_form.php | 16 +++++++++++- vendor/iron/widgets/Upload.php | 5 ++-- 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index 9d7691d..bf65680 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -11,6 +11,7 @@ use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; use antgoods\goods\logic\goods\GoodsManager; +use common\models\ars\File; /** * GoodsController implements the CRUD actions for Goods model. @@ -82,12 +83,14 @@ class GoodsController extends Controller $model = new Goods(); if ($model->load(Yii::$app->request->post())) { - $file_id_str = $model->coverImageId; + $cover_image_id_str = $model->coverImageId; + $detail_image_id_str = $model->detailImageId; $model->save(); $goods_manager = new GoodsManager(); - $save_file_res = $goods_manager->saveFile(explode(',', $file_id_str), $model); - if($save_file_res['status']){ - $model->image = $save_file_res['first_file_id']; + $save_cover_image_res = $goods_manager->saveFile(explode(',', $cover_image_id_str), $model); + $save_detail_image_res = $goods_manager->saveFile(explode(',', $detail_image_id_str), $model, [], File::OWN_TYPE_GOODS_DETAILS); + if($save_cover_image_res['status'] && $save_detail_image_res['status']){ + $model->image = $save_cover_image_res['first_file_id']; $model->save(); } return $this->redirect('index'); @@ -109,15 +112,19 @@ class GoodsController extends Controller { $model = $this->findModel($id); $model->coverImageId = $model->image; - $old_id_arr = $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()); + $cover_image_old_id_arr = $model->image; + $detail_image_old_id_arr = $model->detailImageId; if ($model->load(Yii::$app->request->post())) { - $file_id_str = $model->coverImageId; + $cover_image_id_str = $model->coverImageId; + $detail_image_id_str = $model->detailImageId; $model->save(); $goods_manager = new GoodsManager(); - $save_file_res = $goods_manager->saveFile(explode(',', $file_id_str), $model, explode(',', $old_id_arr)); - if($save_file_res['status']){ - $model->image = $save_file_res['first_file_id']; + $save_cover_image_res = $goods_manager->saveFile(explode(',', $cover_image_id_str), $model, explode(',', $cover_image_old_id_arr)); + $save_detail_image_res = $goods_manager->saveFile(explode(',', $detail_image_id_str), $model, explode(',', $detail_image_old_id_arr), File::OWN_TYPE_GOODS_DETAILS); + if($save_cover_image_res['status'] && $save_detail_image_res['status']){ + $model->image = $save_cover_image_res['first_file_id']; $model->save(); } return $this->redirect('index'); @@ -255,6 +262,7 @@ class GoodsController extends Controller $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/vendor/antgoods/goods/src/models/ars/Goods.php b/vendor/antgoods/goods/src/models/ars/Goods.php index 6dd092c..d446283 100644 --- a/vendor/antgoods/goods/src/models/ars/Goods.php +++ b/vendor/antgoods/goods/src/models/ars/Goods.php @@ -44,8 +44,12 @@ use yii\behaviors\TimestampBehavior; */ class Goods extends \yii\db\ActiveRecord { + //商品封面图 public $coverImagePath; public $coverImageId; + //商品详情图 + public $detailImagePath; + public $detailImageId; //是否删除is_delete const IS_DELETE_NO = 0;//未删除 const IS_DELETE_YES = 1;//已删除 @@ -73,7 +77,7 @@ class Goods extends \yii\db\ActiveRecord [['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'], 'integer'], [['cat_id', 'brand_id', 'shop_cat_id', 'name'], 'required'], [['sn'], 'checkExist'], - [['description', 'coverImageId'], 'string'], + [['description', 'coverImageId', 'detailImageId'], 'string'], [['name'], 'string', 'max' => 120], [['sn'], 'string', 'max' => 60], [['code'], 'string', 'max' => 50], diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index d9db444..c758167 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -81,7 +81,21 @@ use yii\helpers\Url; 'previewConfig' => [ 'url' => Url::to(['image-file', 'fileidstr' => $model->coverImageId]), ], - ])->label('图片') ?> + ])->label('商品封面图') ?> + + field($model, 'detailImageId')->textInput()->label('') ?> + field($model, 'detailImagePath')->widget(\iron\widgets\Upload::className(), [ + 'url' => 'upload', + 'deleteUrl' => 'img-id-del', + 'dragdropWidth'=> 800, + 'afterSave' => 'save-file', + 'maxCount' => 5, + 'fillInAttribute' => 'detailImageId', + 'model' => $model, + 'previewConfig' => [ + 'url' => Url::to(['image-file', 'fileidstr' => $model->detailImageId]), + ], + ])->label('商品详情图') ?>
'btn btn-success']) ?> diff --git a/vendor/iron/widgets/Upload.php b/vendor/iron/widgets/Upload.php index 6f8b10e..0fbf994 100644 --- a/vendor/iron/widgets/Upload.php +++ b/vendor/iron/widgets/Upload.php @@ -171,7 +171,7 @@ class Upload extends InputWidget $view = $this->getView(); UploadAsset::register($view); $js = <<< SCRIPT - $("#upload-file").uploadFile({ + $("#upload-file-{$this->attribute}").uploadFile({ url:"upload", returnType: "json", multiple:true, @@ -214,6 +214,7 @@ class Upload extends InputWidget dataType: "json", success: function(data) { + console.log(data); for(var i=0;i -
+
Upload
From a8a78b5ad352cbafc1c53297437c19c4c1190075 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Mon, 25 Nov 2019 11:38:49 +0800 Subject: [PATCH 090/102] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B0=81=E9=9D=A2?= =?UTF-8?q?=E5=9B=BE=E6=9C=AA=E4=BF=AE=E6=94=B9=E6=97=B6=E6=B8=85=E9=9B=B6?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/controllers/GoodsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index bf65680..fae96f3 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -123,7 +123,7 @@ class GoodsController extends Controller $goods_manager = new GoodsManager(); $save_cover_image_res = $goods_manager->saveFile(explode(',', $cover_image_id_str), $model, explode(',', $cover_image_old_id_arr)); $save_detail_image_res = $goods_manager->saveFile(explode(',', $detail_image_id_str), $model, explode(',', $detail_image_old_id_arr), File::OWN_TYPE_GOODS_DETAILS); - if($save_cover_image_res['status'] && $save_detail_image_res['status']){ + if($save_cover_image_res['status'] && $save_detail_image_res['status'] && $save_cover_image_res['first_file_id'] != 0){ $model->image = $save_cover_image_res['first_file_id']; $model->save(); } From 9d098ef89b62693c846e5d10cf6d1b0f695d5997 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Mon, 25 Nov 2019 16:42:59 +0800 Subject: [PATCH 091/102] =?UTF-8?q?antgoods=5Fcategory=E5=88=A0=E9=99=A4ic?= =?UTF-8?q?on=5Ftype=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...n_icon_type_in_table_antgoods_category.php | 20 +++++++++++++++++++ .../goods/src/models/ars/Category.php | 6 ++++-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 vendor/antgoods/goods/src/migrations/m191125_083820_drop_column_icon_type_in_table_antgoods_category.php diff --git a/vendor/antgoods/goods/src/migrations/m191125_083820_drop_column_icon_type_in_table_antgoods_category.php b/vendor/antgoods/goods/src/migrations/m191125_083820_drop_column_icon_type_in_table_antgoods_category.php new file mode 100644 index 0000000..04c6a2b --- /dev/null +++ b/vendor/antgoods/goods/src/migrations/m191125_083820_drop_column_icon_type_in_table_antgoods_category.php @@ -0,0 +1,20 @@ +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/vendor/antgoods/goods/src/models/ars/Category.php b/vendor/antgoods/goods/src/models/ars/Category.php index a64511a..783580b 100644 --- a/vendor/antgoods/goods/src/models/ars/Category.php +++ b/vendor/antgoods/goods/src/models/ars/Category.php @@ -13,7 +13,6 @@ use yii\behaviors\TimestampBehavior; * @property int $pid 父级id * @property int $goods_count 商品数量 * @property int $sort_order 排序 - * @property int $icon_type 图标类型 * @property string $icon 图标 * @property int $is_show 是否显示,1为不显示 * @property int $is_delete 是否删除,1为已删除 @@ -22,6 +21,8 @@ use yii\behaviors\TimestampBehavior; */ class Category extends \yii\db\ActiveRecord { + public $iconImageId; + public $iconImagePath; //是否显示is_show const IS_SHOW_DISPLAY = 0;//显示 const IS_SHOW_HIDE = 1;//隐藏 @@ -49,9 +50,10 @@ class Category extends \yii\db\ActiveRecord { return [ [['name'], 'required'], - [['pid', 'goods_count', 'sort_order', 'icon_type', 'is_show', 'is_delete'], 'integer'], + [['pid', 'goods_count', 'sort_order', 'is_show', 'is_delete'], 'integer'], [['name'], 'string', 'max' => 60], [['icon'], 'string', 'max' => 64], + [['iconImageId'], 'string'], ]; } From d3140650478bb7a27d334f433f23ff9f774fb040 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Mon, 25 Nov 2019 16:52:27 +0800 Subject: [PATCH 092/102] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=A1=A8antgoods=5Fcategory=E7=9A=84pid=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=92=8Cicon=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...id_and_icon_in_table_antgoods_category.php | 26 +++++++++++++++++++ .../goods/src/models/ars/Category.php | 5 ++-- 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 vendor/antgoods/goods/src/migrations/m191125_084547_update_column_pid_and_icon_in_table_antgoods_category.php diff --git a/vendor/antgoods/goods/src/migrations/m191125_084547_update_column_pid_and_icon_in_table_antgoods_category.php b/vendor/antgoods/goods/src/migrations/m191125_084547_update_column_pid_and_icon_in_table_antgoods_category.php new file mode 100644 index 0000000..055e84c --- /dev/null +++ b/vendor/antgoods/goods/src/migrations/m191125_084547_update_column_pid_and_icon_in_table_antgoods_category.php @@ -0,0 +1,26 @@ +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/vendor/antgoods/goods/src/models/ars/Category.php b/vendor/antgoods/goods/src/models/ars/Category.php index 783580b..6a50d3a 100644 --- a/vendor/antgoods/goods/src/models/ars/Category.php +++ b/vendor/antgoods/goods/src/models/ars/Category.php @@ -13,7 +13,7 @@ use yii\behaviors\TimestampBehavior; * @property int $pid 父级id * @property int $goods_count 商品数量 * @property int $sort_order 排序 - * @property string $icon 图标 + * @property int $icon 图标 * @property int $is_show 是否显示,1为不显示 * @property int $is_delete 是否删除,1为已删除 * @property int $created_at 创建时间 @@ -50,9 +50,8 @@ class Category extends \yii\db\ActiveRecord { return [ [['name'], 'required'], - [['pid', 'goods_count', 'sort_order', 'is_show', 'is_delete'], 'integer'], + [['pid', 'goods_count', 'sort_order', 'is_show', 'is_delete', 'icon'], 'integer'], [['name'], 'string', 'max' => 60], - [['icon'], 'string', 'max' => 64], [['iconImageId'], 'string'], ]; } From 257d5cd15f03f0749eca81e6cb759b378f1e604b Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Mon, 25 Nov 2019 17:23:46 +0800 Subject: [PATCH 093/102] =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=B1=BB=E7=9B=AE=E5=9B=BE=E7=89=87=E5=88=86?= =?UTF-8?q?=E7=B1=BB=EF=BC=8C=E5=BC=80=E5=8F=91=E7=B1=BB=E7=9B=AE=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E4=B8=8A=E4=BC=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/models/ars/File.php | 1 + .../src/controllers/CategoryController.php | 130 +++++++++++++++++- .../goods/src/controllers/GoodsController.php | 12 ++ .../goods/src/views/category/_form.php | 15 +- .../antgoods/goods/src/views/goods/_form.php | 4 +- vendor/iron/widgets/Upload.php | 2 - 6 files changed, 156 insertions(+), 8 deletions(-) diff --git a/common/models/ars/File.php b/common/models/ars/File.php index a6a41fd..e75e597 100644 --- a/common/models/ars/File.php +++ b/common/models/ars/File.php @@ -25,6 +25,7 @@ class File extends \yii\db\ActiveRecord //own_type const OWN_TYPE_GOODS_INDEX = 1;//商品首页 const OWN_TYPE_GOODS_DETAILS = 2;//商品详情 + const OWN_TYPE_CATEGORY_ICON = 3;//类目图标 //is_delete const IS_DELETE_YES = 1;//已删除 const IS_DELETE_NO = 0;//未删除 diff --git a/vendor/antgoods/goods/src/controllers/CategoryController.php b/vendor/antgoods/goods/src/controllers/CategoryController.php index 1d96800..efedfec 100644 --- a/vendor/antgoods/goods/src/controllers/CategoryController.php +++ b/vendor/antgoods/goods/src/controllers/CategoryController.php @@ -2,6 +2,8 @@ namespace antgoods\goods\controllers; +use antgoods\goods\logic\goods\GoodsManager; +use common\models\ars\File; use Yii; use antgoods\goods\models\ars\Category; use antgoods\goods\models\searchs\CategorySearch; @@ -29,6 +31,17 @@ class CategoryController extends Controller ]; } + public function actions() + { + return [ + 'upload' => [ + 'class' => 'iron\actions\UploadAction', + 'path' => 'xls/', + 'maxSize' => 20480, + ] + ]; + } + /** * Lists all Category models. * @return mixed @@ -42,7 +55,7 @@ class CategoryController extends Controller 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'columns' => $searchModel->columns() - ]); + ]); } /** @@ -67,7 +80,18 @@ class CategoryController extends Controller { $model = new Category(); - if ($model->load(Yii::$app->request->post()) && $model->save()) { + if ($model->load(Yii::$app->request->post())) { + + //类目图片上传保存处理 + $icon_image_id_str = $model->iconImageId; + $model->save(); + $goods_manager = new GoodsManager(); + $save_icon_image_res = $goods_manager->saveFile(explode(',', $icon_image_id_str), $model); + if($save_icon_image_res['status']){ + $model->icon = $save_icon_image_res['first_file_id']; + $model->save(); + } + return $this->redirect('index'); } @@ -86,8 +110,22 @@ class CategoryController extends Controller 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())) { + + //类目图片上传保存处理 + $icon_image_id_str = $model->iconImageId; + $model->save(); + $goods_manager = new GoodsManager(); + $save_icon_image_res = $goods_manager->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->image = $save_icon_image_res['first_file_id']; + $model->save(); + } - if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect('index'); } @@ -149,4 +187,90 @@ class CategoryController extends Controller '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(); + if($data) { + $res = array(); + $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/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index fae96f3..5b5e087 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -83,6 +83,8 @@ class GoodsController extends Controller $model = new Goods(); if ($model->load(Yii::$app->request->post())) { + + //商品封面图和商品详情图上传保存处理 $cover_image_id_str = $model->coverImageId; $detail_image_id_str = $model->detailImageId; $model->save(); @@ -93,6 +95,7 @@ class GoodsController extends Controller $model->image = $save_cover_image_res['first_file_id']; $model->save(); } + return $this->redirect('index'); } @@ -113,10 +116,14 @@ class GoodsController extends Controller $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_arr = $model->image; $detail_image_old_id_arr = $model->detailImageId; if ($model->load(Yii::$app->request->post())) { + + //商品封面图和商品详情图上传保存处理 $cover_image_id_str = $model->coverImageId; $detail_image_id_str = $model->detailImageId; $model->save(); @@ -127,6 +134,7 @@ class GoodsController extends Controller $model->image = $save_cover_image_res['first_file_id']; $model->save(); } + return $this->redirect('index'); } @@ -245,6 +253,10 @@ class GoodsController extends Controller return $img_id_str; } + /** + * @return bool|false|string + * 加载已有的文件 + */ public function actionImageFile() { //判断该类是否存在 diff --git a/vendor/antgoods/goods/src/views/category/_form.php b/vendor/antgoods/goods/src/views/category/_form.php index 313e3b6..a4a63e4 100644 --- a/vendor/antgoods/goods/src/views/category/_form.php +++ b/vendor/antgoods/goods/src/views/category/_form.php @@ -3,6 +3,7 @@ use yii\helpers\Html; use yii\bootstrap4\ActiveForm; use blobt\widgets\Icheck; +use yii\helpers\Url; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Category */ @@ -17,7 +18,19 @@ use blobt\widgets\Icheck; field($model, 'sort_order')->textInput() ?> - field($model, 'icon')->textInput(['maxlength' => true]) ?> + field($model, 'iconImageId')->textInput()->label('') ?> + field($model, 'iconImagePath')->widget(\iron\widgets\Upload::className(), [ + 'url' => 'upload', + 'deleteUrl' => 'img-id-del', + 'dragdropWidth'=> 800, + 'afterSave' => 'save-file', + 'maxCount' => 1, + 'fillInAttribute' => 'iconImageId', + 'model' => $model, + 'previewConfig' => [ + 'url' => Url::to(['image-file', 'fileidstr' => $model->iconImageId]), + ], + ])->label('类目图片') ?> field($model, 'is_show')->widget(Icheck::className(), ["items" => $model::$isShow, 'type' => "radio"]) ?> diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index c758167..99d331c 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -69,7 +69,7 @@ use yii\helpers\Url; field($model, 'express_template')->textInput() ?> - field($model, 'coverImageId')->textInput()->label('') ?> + field($model, 'coverImageId')->hiddenInput()->label('') ?> field($model, 'coverImagePath')->widget(\iron\widgets\Upload::className(), [ 'url' => 'upload', 'deleteUrl' => 'img-id-del', @@ -83,7 +83,7 @@ use yii\helpers\Url; ], ])->label('商品封面图') ?> - field($model, 'detailImageId')->textInput()->label('') ?> + field($model, 'detailImageId')->hiddenInput()->label('') ?> field($model, 'detailImagePath')->widget(\iron\widgets\Upload::className(), [ 'url' => 'upload', 'deleteUrl' => 'img-id-del', diff --git a/vendor/iron/widgets/Upload.php b/vendor/iron/widgets/Upload.php index 0fbf994..291a9e7 100644 --- a/vendor/iron/widgets/Upload.php +++ b/vendor/iron/widgets/Upload.php @@ -214,7 +214,6 @@ class Upload extends InputWidget dataType: "json", success: function(data) { - console.log(data); for(var i=0;ifillInId}').val()}, success: function(data) { - console.log(data); $('#{$this->fillInId}').val(data); }, }); From 931a2d8f47572f3e881d6c2d16a3f30353ab1e93 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Mon, 25 Nov 2019 19:39:53 +0800 Subject: [PATCH 094/102] =?UTF-8?q?=E5=88=A0=E9=99=A4shop=5Fcategory?= =?UTF-8?q?=E8=A1=A8=E7=9A=84icon=5Ftype=E5=AD=97=E6=AE=B5=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9pid=E5=92=8Cicon=E5=AD=97=E6=AE=B5,=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=A1=A8=E5=8D=95=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...n_type_in_table_antgoods_shop_category.php | 20 ++++++++++++++ ...d_icon_in_table_antgoods_shop_category.php | 26 +++++++++++++++++++ .../src/models/searchs/CategorySearch.php | 10 +++---- .../src/models/searchs/ShopCategorySearch.php | 7 +++-- .../goods/src/views/shopcategory/_form.php | 4 --- 5 files changed, 53 insertions(+), 14 deletions(-) create mode 100644 vendor/antgoods/goods/src/migrations/m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category.php create mode 100644 vendor/antgoods/goods/src/migrations/m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category.php diff --git a/vendor/antgoods/goods/src/migrations/m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category.php b/vendor/antgoods/goods/src/migrations/m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category.php new file mode 100644 index 0000000..2f182eb --- /dev/null +++ b/vendor/antgoods/goods/src/migrations/m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category.php @@ -0,0 +1,20 @@ +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/vendor/antgoods/goods/src/migrations/m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category.php b/vendor/antgoods/goods/src/migrations/m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category.php new file mode 100644 index 0000000..b1536ac --- /dev/null +++ b/vendor/antgoods/goods/src/migrations/m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category.php @@ -0,0 +1,26 @@ +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/vendor/antgoods/goods/src/models/searchs/CategorySearch.php b/vendor/antgoods/goods/src/models/searchs/CategorySearch.php index cce94b0..868afe6 100644 --- a/vendor/antgoods/goods/src/models/searchs/CategorySearch.php +++ b/vendor/antgoods/goods/src/models/searchs/CategorySearch.php @@ -26,8 +26,8 @@ class CategorySearch extends Category public function rules() { return [ - [['id', 'pid', 'goods_count', 'sort_order', 'icon_type', 'is_show', 'is_delete', 'created_at', 'updated_at'], 'integer'], - [['name', 'icon'], 'safe'], + [['id', 'pid', 'goods_count', 'sort_order', 'is_show', 'is_delete', 'created_at', 'updated_at', 'icon'], 'integer'], + [['name'], 'safe'], ['created_at_range','safe'], ]; } @@ -57,7 +57,6 @@ class CategorySearch extends Category 'pid', 'goods_count', 'sort_order', - //'icon_type', //'icon', //'is_show', //'is_delete', @@ -134,15 +133,14 @@ class CategorySearch extends Category 'pid' => $this->pid, 'goods_count' => $this->goods_count, 'sort_order' => $this->sort_order, - 'icon_type' => $this->icon_type, 'is_show' => $this->is_show, 'is_delete' => $this->is_delete, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, + 'icon' => $this->icon, ]); - $query->andFilterWhere(['like', 'name', $this->name]) - ->andFilterWhere(['like', 'icon', $this->icon]); + $query->andFilterWhere(['like', 'name', $this->name]); if ($this->created_at_range) { $arr = explode(' ~ ', $this->created_at_range); $start = strtotime($arr[0]); diff --git a/vendor/antgoods/goods/src/models/searchs/ShopCategorySearch.php b/vendor/antgoods/goods/src/models/searchs/ShopCategorySearch.php index 524eb11..2e5dcfc 100644 --- a/vendor/antgoods/goods/src/models/searchs/ShopCategorySearch.php +++ b/vendor/antgoods/goods/src/models/searchs/ShopCategorySearch.php @@ -26,8 +26,8 @@ class ShopCategorySearch extends ShopCategory public function rules() { return [ - [['id', 'pid', 'goods_count', 'sort_order', 'icon_type', 'is_show', 'is_delete', 'created_at', 'updated_at'], 'integer'], - [['name', 'keywords', 'desc', 'icon', 'filter_attr'], 'safe'], + [['id', 'pid', 'goods_count', 'sort_order', 'is_show', 'is_delete', 'created_at', 'updated_at', 'icon'], 'integer'], + [['name', 'keywords', 'desc', 'filter_attr'], 'safe'], ['created_at_range','safe'], ]; } @@ -136,7 +136,7 @@ class ShopCategorySearch extends ShopCategory 'pid' => $this->pid, 'goods_count' => $this->goods_count, 'sort_order' => $this->sort_order, - 'icon_type' => $this->icon_type, + 'icon' => $this->icon, 'is_show' => $this->is_show, 'is_delete' => $this->is_delete, 'created_at' => $this->created_at, @@ -146,7 +146,6 @@ class ShopCategorySearch extends ShopCategory $query->andFilterWhere(['like', 'name', $this->name]) ->andFilterWhere(['like', 'keywords', $this->keywords]) ->andFilterWhere(['like', 'desc', $this->desc]) - ->andFilterWhere(['like', 'icon', $this->icon]) ->andFilterWhere(['like', 'filter_attr', $this->filter_attr]); if ($this->created_at_range) { $arr = explode(' ~ ', $this->created_at_range); diff --git a/vendor/antgoods/goods/src/views/shopcategory/_form.php b/vendor/antgoods/goods/src/views/shopcategory/_form.php index 155b9d3..97a9d30 100644 --- a/vendor/antgoods/goods/src/views/shopcategory/_form.php +++ b/vendor/antgoods/goods/src/views/shopcategory/_form.php @@ -15,16 +15,12 @@ use blobt\widgets\Icheck; field($model, 'name')->textInput(['maxlength' => true]) ?> - field($model, 'goods_count')->textInput() ?> - field($model, 'keywords')->textInput(['maxlength' => true]) ?> field($model, 'desc')->textInput(['maxlength' => true]) ?> field($model, 'sort_order')->textInput() ?> - field($model, 'icon_type')->textInput() ?> - field($model, 'icon')->textInput(['maxlength' => true]) ?> field($model, 'filter_attr')->textarea(['rows' => 6]) ?> From f6142f18b2c252d9078604ce3ddd693db6a36033 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 26 Nov 2019 08:56:50 +0800 Subject: [PATCH 095/102] =?UTF-8?q?=E5=A4=84=E7=90=86=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=8C=BA=E5=88=86=E5=88=A0=E9=99=A4=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E5=92=8C=E4=B8=8D=E4=BF=AE=E6=94=B9=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/controllers/CategoryController.php | 8 +- .../goods/src/controllers/GoodsController.php | 4 +- .../controllers/ShopcategoryController.php | 128 +++++++++++++++++- .../goods/src/logic/goods/GoodsManager.php | 10 +- .../goods/src/models/ars/ShopCategory.php | 5 +- .../goods/src/views/shopcategory/_form.php | 15 +- 6 files changed, 157 insertions(+), 13 deletions(-) diff --git a/vendor/antgoods/goods/src/controllers/CategoryController.php b/vendor/antgoods/goods/src/controllers/CategoryController.php index efedfec..10ff1b8 100644 --- a/vendor/antgoods/goods/src/controllers/CategoryController.php +++ b/vendor/antgoods/goods/src/controllers/CategoryController.php @@ -86,7 +86,7 @@ class CategoryController extends Controller $icon_image_id_str = $model->iconImageId; $model->save(); $goods_manager = new GoodsManager(); - $save_icon_image_res = $goods_manager->saveFile(explode(',', $icon_image_id_str), $model); + $save_icon_image_res = $goods_manager->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(); @@ -121,8 +121,8 @@ class CategoryController extends Controller $model->save(); $goods_manager = new GoodsManager(); $save_icon_image_res = $goods_manager->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->image = $save_icon_image_res['first_file_id']; + 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(); } @@ -261,8 +261,8 @@ class CategoryController extends Controller $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) { - $res = array(); $i = 0; foreach ($data as $key => $value) { $res[$i]['name'] = $value->alias; diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index 5b5e087..eaca006 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -130,7 +130,7 @@ class GoodsController extends Controller $goods_manager = new GoodsManager(); $save_cover_image_res = $goods_manager->saveFile(explode(',', $cover_image_id_str), $model, explode(',', $cover_image_old_id_arr)); $save_detail_image_res = $goods_manager->saveFile(explode(',', $detail_image_id_str), $model, explode(',', $detail_image_old_id_arr), File::OWN_TYPE_GOODS_DETAILS); - if($save_cover_image_res['status'] && $save_detail_image_res['status'] && $save_cover_image_res['first_file_id'] != 0){ + if($save_cover_image_res['status'] && $save_detail_image_res['status'] && $save_cover_image_res['first_file_id'] !== 0){ $model->image = $save_cover_image_res['first_file_id']; $model->save(); } @@ -267,8 +267,8 @@ class GoodsController extends Controller $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) { - $res = array(); $i = 0; foreach ($data as $key => $value) { $res[$i]['name'] = $value->alias; diff --git a/vendor/antgoods/goods/src/controllers/ShopcategoryController.php b/vendor/antgoods/goods/src/controllers/ShopcategoryController.php index ef1feec..64c758a 100644 --- a/vendor/antgoods/goods/src/controllers/ShopcategoryController.php +++ b/vendor/antgoods/goods/src/controllers/ShopcategoryController.php @@ -2,6 +2,8 @@ namespace antgoods\goods\controllers; +use antgoods\goods\logic\goods\GoodsManager; +use common\models\ars\File; use Yii; use antgoods\goods\models\ars\ShopCategory; use antgoods\goods\models\searchs\ShopCategorySearch; @@ -29,6 +31,17 @@ class ShopcategoryController extends Controller ]; } + public function actions() + { + return [ + 'upload' => [ + 'class' => 'iron\actions\UploadAction', + 'path' => 'xls/', + 'maxSize' => 20480, + ] + ]; + } + /** * Lists all ShopCategory models. * @return mixed @@ -67,7 +80,18 @@ class ShopcategoryController extends Controller { $model = new ShopCategory(); - if ($model->load(Yii::$app->request->post()) && $model->save()) { + if ($model->load(Yii::$app->request->post())) { + + //类目图片上传保存处理 + $icon_image_id_str = $model->iconImageId; + $model->save(); + $goods_manager = new GoodsManager(); + $save_icon_image_res = $goods_manager->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'); } @@ -86,8 +110,22 @@ class ShopcategoryController extends Controller 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())) { + + //类目图片上传保存处理 + $icon_image_id_str = $model->iconImageId; + $model->save(); + $goods_manager = new GoodsManager(); + $save_icon_image_res = $goods_manager->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(); + } - if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect('index'); } @@ -146,4 +184,90 @@ class ShopcategoryController extends Controller '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/vendor/antgoods/goods/src/logic/goods/GoodsManager.php b/vendor/antgoods/goods/src/logic/goods/GoodsManager.php index c52e8d3..63696e5 100644 --- a/vendor/antgoods/goods/src/logic/goods/GoodsManager.php +++ b/vendor/antgoods/goods/src/logic/goods/GoodsManager.php @@ -36,8 +36,14 @@ class GoodsManager //记录第一张图片id $first_file_id = 0; - if($create_file_res['status']) { - $first_file_id = $create_file_res['first_file_id']; + + //查看修改数组是否为空 + if (!$newFileIdArr[0]) { + $first_file_id = null; + }else { + if ($create_file_res['status']) { + $first_file_id = $create_file_res['first_file_id']; + } } return ['status' => true, 'info' => '操作成功', 'first_file_id' => $first_file_id]; diff --git a/vendor/antgoods/goods/src/models/ars/ShopCategory.php b/vendor/antgoods/goods/src/models/ars/ShopCategory.php index 92fa87e..d6dc798 100644 --- a/vendor/antgoods/goods/src/models/ars/ShopCategory.php +++ b/vendor/antgoods/goods/src/models/ars/ShopCategory.php @@ -25,6 +25,8 @@ use yii\behaviors\TimestampBehavior; */ class ShopCategory extends \yii\db\ActiveRecord { + public $iconImageId; + public $iconImagePath; //是否显示is_show const IS_SHOW_DISPLAY = 0;//显示 const IS_SHOW_HIDE = 1;//隐藏 @@ -52,12 +54,11 @@ class ShopCategory extends \yii\db\ActiveRecord { return [ [['name'], 'required'], - [['pid', 'goods_count', 'sort_order', 'icon_type', 'is_show', 'is_delete'], 'integer'], + [['pid', 'goods_count', 'sort_order', 'icon', 'is_show', 'is_delete', 'iconImageId'], 'integer'], [['filter_attr'], 'string'], [['name'], 'string', 'max' => 60], [['keywords'], 'string', 'max' => 100], [['desc'], 'string', 'max' => 255], - [['icon'], 'string', 'max' => 64], ]; } diff --git a/vendor/antgoods/goods/src/views/shopcategory/_form.php b/vendor/antgoods/goods/src/views/shopcategory/_form.php index 97a9d30..cf80c31 100644 --- a/vendor/antgoods/goods/src/views/shopcategory/_form.php +++ b/vendor/antgoods/goods/src/views/shopcategory/_form.php @@ -3,6 +3,7 @@ use yii\helpers\Html; use yii\bootstrap4\ActiveForm; use blobt\widgets\Icheck; +use yii\helpers\Url; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\ShopCategory */ @@ -21,7 +22,19 @@ use blobt\widgets\Icheck; field($model, 'sort_order')->textInput() ?> - field($model, 'icon')->textInput(['maxlength' => true]) ?> + field($model, 'iconImageId')->textInput()->label('') ?> + field($model, 'iconImagePath')->widget(\iron\widgets\Upload::className(), [ + 'url' => 'upload', + 'deleteUrl' => 'img-id-del', + 'dragdropWidth'=> 800, + 'afterSave' => 'save-file', + 'maxCount' => 1, + 'fillInAttribute' => 'iconImageId', + 'model' => $model, + 'previewConfig' => [ + 'url' => Url::to(['image-file', 'fileidstr' => $model->iconImageId]), + ], + ])->label('类目图片') ?> field($model, 'filter_attr')->textarea(['rows' => 6]) ?> From 24a3dfc5c78e1bdd77fd277586438fa5235e94f9 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 26 Nov 2019 09:03:08 +0800 Subject: [PATCH 096/102] =?UTF-8?q?=E5=A4=84=E7=90=86=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E9=9A=90=E8=97=8F=E7=9A=84=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/views/category/_form.php | 2 +- vendor/antgoods/goods/src/views/shopcategory/_form.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/antgoods/goods/src/views/category/_form.php b/vendor/antgoods/goods/src/views/category/_form.php index a4a63e4..344b234 100644 --- a/vendor/antgoods/goods/src/views/category/_form.php +++ b/vendor/antgoods/goods/src/views/category/_form.php @@ -18,7 +18,7 @@ use yii\helpers\Url; field($model, 'sort_order')->textInput() ?> - field($model, 'iconImageId')->textInput()->label('') ?> + field($model, 'iconImageId')->hiddenInput()->label('') ?> field($model, 'iconImagePath')->widget(\iron\widgets\Upload::className(), [ 'url' => 'upload', 'deleteUrl' => 'img-id-del', diff --git a/vendor/antgoods/goods/src/views/shopcategory/_form.php b/vendor/antgoods/goods/src/views/shopcategory/_form.php index cf80c31..d213cda 100644 --- a/vendor/antgoods/goods/src/views/shopcategory/_form.php +++ b/vendor/antgoods/goods/src/views/shopcategory/_form.php @@ -22,7 +22,7 @@ use yii\helpers\Url; field($model, 'sort_order')->textInput() ?> - field($model, 'iconImageId')->textInput()->label('') ?> + field($model, 'iconImageId')->hiddenInput()->label('') ?> field($model, 'iconImagePath')->widget(\iron\widgets\Upload::className(), [ 'url' => 'upload', 'deleteUrl' => 'img-id-del', From 5499f17f70e530a22a22c55ae2cfb808572d12aa Mon Sep 17 00:00:00 2001 From: iron Date: Tue, 26 Nov 2019 11:28:22 +0800 Subject: [PATCH 097/102] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0api=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/assets/AppAsset.php | 26 +++++++ api/config/.gitignore | 4 + api/config/bootstrap.php | 1 + api/config/main.php | 51 ++++++++++++ api/config/params.php | 3 + api/controllers/SiteController.php | 22 ++++++ api/controllers/TestController.php | 59 ++++++++++++++ api/runtime/.gitignore | 2 + api/views/site/error.php | 27 +++++++ api/web/.gitignore | 5 ++ api/web/assets/.gitignore | 2 + api/web/css/site.css | 120 +++++++++++++++++++++++++++++ api/web/favicon.ico | Bin 0 -> 318 bytes backend/views/layouts/sidebar.php | 19 +++-- common/config/bootstrap.php | 1 + datadictionary.md | 0 16 files changed, 332 insertions(+), 10 deletions(-) create mode 100644 api/assets/AppAsset.php create mode 100644 api/config/.gitignore create mode 100644 api/config/bootstrap.php create mode 100644 api/config/main.php create mode 100644 api/config/params.php create mode 100644 api/controllers/SiteController.php create mode 100644 api/controllers/TestController.php create mode 100644 api/runtime/.gitignore create mode 100644 api/views/site/error.php create mode 100644 api/web/.gitignore create mode 100644 api/web/assets/.gitignore create mode 100644 api/web/css/site.css create mode 100644 api/web/favicon.ico delete mode 100644 datadictionary.md diff --git a/api/assets/AppAsset.php b/api/assets/AppAsset.php new file mode 100644 index 0000000..6a7b360 --- /dev/null +++ b/api/assets/AppAsset.php @@ -0,0 +1,26 @@ + 'api', + 'basePath' => dirname(__DIR__), + 'controllerNamespace' => 'api\controllers', + 'bootstrap' => ['log'], + 'modules' => [], + 'components' => [ + 'request' => [ + 'parsers' => [ + 'application/json' => 'yii\web\JsonParser', + ], + 'csrfParam' => '_csrf-backend', + ], + 'user' => [ + 'identityClass' => 'common\models\User', + 'enableAutoLogin' => true, + 'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true], + ], + 'session' => [ + // this is the name of the session cookie used for login on the app + 'name' => 'advanced-api', + ], + 'log' => [ + 'traceLevel' => YII_DEBUG ? 3 : 0, + 'targets' => [ + [ + 'class' => 'yii\log\FileTarget', + 'levels' => ['error', 'warning'], + ], + ], + ], + 'errorHandler' => [ + 'errorAction' => 'site/error', + ], + 'urlManager' => [ + 'enablePrettyUrl' => true, + 'showScriptName' => true, + 'enableStrictParsing' => false, + 'rules' => [ + ['class' => 'yii\rest\UrlRule', 'controller' => 'test'], + ], + ], + ], + 'params' => $params, +]; diff --git a/api/config/params.php b/api/config/params.php new file mode 100644 index 0000000..d0b9c34 --- /dev/null +++ b/api/config/params.php @@ -0,0 +1,3 @@ + [ + 'class' => 'yii\web\ErrorAction', + ], + ]; + } +} diff --git a/api/controllers/TestController.php b/api/controllers/TestController.php new file mode 100644 index 0000000..7ede9df --- /dev/null +++ b/api/controllers/TestController.php @@ -0,0 +1,59 @@ + Goods::find(), + 'pagination' => [ + 'pageSize' => 1, + ], + ]); + } +} diff --git a/api/runtime/.gitignore b/api/runtime/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/api/runtime/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/api/views/site/error.php b/api/views/site/error.php new file mode 100644 index 0000000..0ba2574 --- /dev/null +++ b/api/views/site/error.php @@ -0,0 +1,27 @@ +title = $name; +?> +
+ +

title) ?>

+ +
+ +
+ +

+ 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. +

+ +
diff --git a/api/web/.gitignore b/api/web/.gitignore new file mode 100644 index 0000000..ab89d98 --- /dev/null +++ b/api/web/.gitignore @@ -0,0 +1,5 @@ +/index.php +/index-test.php +/robots.txt +uploads + diff --git a/api/web/assets/.gitignore b/api/web/assets/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/api/web/assets/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/api/web/css/site.css b/api/web/css/site.css new file mode 100644 index 0000000..f787e34 --- /dev/null +++ b/api/web/css/site.css @@ -0,0 +1,120 @@ +html, +body { + height: 100%; +} + +.wrap { + min-height: 100%; + height: auto; + margin: 0 auto -60px; + padding: 0 0 60px; +} + +.wrap > .container { + padding: 70px 15px 20px; +} + +.footer { + height: 60px; + background-color: #f5f5f5; + border-top: 1px solid #ddd; + padding-top: 20px; +} + +.jumbotron { + text-align: center; + background-color: transparent; +} + +.jumbotron .btn { + font-size: 21px; + padding: 14px 24px; +} + +.not-set { + color: #c55; + font-style: italic; +} + +/* add sorting icons to gridview sort links */ +a.asc:after, a.desc:after { + position: relative; + top: 1px; + display: inline-block; + font-family: 'Glyphicons Halflings'; + font-style: normal; + font-weight: normal; + line-height: 1; + padding-left: 5px; +} + +a.asc:after { + content: /*"\e113"*/ "\e151"; +} + +a.desc:after { + content: /*"\e114"*/ "\e152"; +} + +.sort-numerical a.asc:after { + content: "\e153"; +} + +.sort-numerical a.desc:after { + content: "\e154"; +} + +.sort-ordinal a.asc:after { + content: "\e155"; +} + +.sort-ordinal a.desc:after { + content: "\e156"; +} + +.grid-view td { + white-space: nowrap; +} + +.grid-view .filters input, +.grid-view .filters select { + min-width: 50px; +} + +.hint-block { + display: block; + margin-top: 5px; + color: #999; +} + +.error-summary { + color: #a94442; + background: #fdf7f7; + border-left: 3px solid #eed3d7; + padding: 10px 20px; + margin: 0 0 15px 0; +} + +/* align the logout "link" (button in forms) of the navbar */ +.nav li > form > button.logout { + padding: 15px; + border: none; +} + +@media(max-width:767px) { + .nav li > form > button.logout { + display:block; + text-align: left; + width: 100%; + padding: 10px 15px; + } +} + +.nav > li > form > button.logout:focus, +.nav > li > form > button.logout:hover { + text-decoration: none; +} + +.nav > li > form > button.logout:focus { + outline: none; +} diff --git a/api/web/favicon.ico b/api/web/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..580ed732e86556ec57f3f3395a210246d679c076 GIT binary patch literal 318 zcmZQzU<5(|0RbS%!l1#(z#zuJz@P!d0zj+)#2|4HXaJKC0wf0lAEr2iX{M9K3=BR0 y!E90pK{x=K$Oz&POT#sS8N$ZKhC)h8ip0_|-T#43{vnSYgXBQCu@O54$pHYIza?e> literal 0 HcmV?d00001 diff --git a/backend/views/layouts/sidebar.php b/backend/views/layouts/sidebar.php index 828322f..a975ac1 100644 --- a/backend/views/layouts/sidebar.php +++ b/backend/views/layouts/sidebar.php @@ -15,22 +15,21 @@ use iron\widgets\Menu; echo Menu::widget([ 'items' => [ // ['label' => 'MAIN NAVIGATION', 'is_header' => true], - ['label' => '商城管理', 'url' => '#', 'icon' => 'far fa-store', 'items' => [ - ['label' => '运营数据', 'url' => ['site/index', 'tag' => 'new']], - ['label' => '基础配置', 'url' => ['config/index', 'tag' => 'new']], + ['label' => '商城管理', 'url' => '#', 'icon' => 'fa-store', 'items' => [ + ['label' => '运营数据', 'url' => ['site/index']], + ['label' => '基础配置', 'url' => ['config/index']], ] ], - ['label' => '商品管理', 'url' => '#', 'icon' => 'far fa-archive', 'items' => [ - ['label' => '商品分类', 'url' => ['category/index', 'tag' => 'new']], - ['label' => '商品列表', 'url' => ['goods/index']], - ['label' => '属性管理', 'url' => ['attribute/index']], + ['label' => '商品管理', 'url' => '#', 'icon' => 'fa-archive', 'items' => [ + ['label' => '商品分类', 'url' => ['/category']], + ['label' => '商品列表', 'url' => ['/goods']], + ['label' => '属性管理', 'url' => ['/attribute']], ] ], - ['label' => '订单管理', 'url' => '#', 'icon' => 'far fa-list-alt', 'items' => [ - ['label' => '订单列表', 'url' => ['order/index', 'tag' => 'new']], + ['label' => '订单管理', 'url' => '#', 'icon' => 'fa-list-alt', 'items' => [ + ['label' => '订单列表', 'url' => ['order/index']], ] ], - ] ]); ?> diff --git a/common/config/bootstrap.php b/common/config/bootstrap.php index 4102199..b8d4302 100755 --- a/common/config/bootstrap.php +++ b/common/config/bootstrap.php @@ -2,3 +2,4 @@ Yii::setAlias('@common', dirname(__DIR__)); Yii::setAlias('@console', dirname(dirname(__DIR__)) . '/console'); Yii::setAlias('@backend', dirname(dirname(__DIR__)) . '/backend'); +Yii::setAlias('@api', dirname(dirname(__DIR__)) . '/api'); diff --git a/datadictionary.md b/datadictionary.md deleted file mode 100644 index e69de29..0000000 From a63aa5ba6cb1b52149369d4277f0264a30be2ebc Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 26 Nov 2019 13:56:54 +0800 Subject: [PATCH 098/102] =?UTF-8?q?=E8=A1=A5=E5=85=85=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=9A=84js=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/iron/assets/upload/js/jquery-form.js | 1277 +++++++++++++++++ vendor/linyao/generators/crud/Generator.php | 555 ------- .../generators/crud/default/controller.php | 179 --- .../linyao/generators/crud/default/search.php | 86 -- .../generators/crud/default/views/_form.php | 43 - .../generators/crud/default/views/_search.php | 45 - .../generators/crud/default/views/create.php | 27 - .../generators/crud/default/views/index.php | 61 - .../generators/crud/default/views/update.php | 38 - .../generators/crud/default/views/view.php | 49 - vendor/linyao/generators/crud/form.php | 17 - vendor/linyao/generators/model/Generator.php | 995 ------------- .../linyao/generators/model/default/model.php | 124 -- .../linyao/generators/model/default/query.php | 56 - vendor/linyao/generators/model/form.php | 30 - 15 files changed, 1277 insertions(+), 2305 deletions(-) create mode 100644 vendor/iron/assets/upload/js/jquery-form.js delete mode 100644 vendor/linyao/generators/crud/Generator.php delete mode 100644 vendor/linyao/generators/crud/default/controller.php delete mode 100644 vendor/linyao/generators/crud/default/search.php delete mode 100644 vendor/linyao/generators/crud/default/views/_form.php delete mode 100644 vendor/linyao/generators/crud/default/views/_search.php delete mode 100644 vendor/linyao/generators/crud/default/views/create.php delete mode 100644 vendor/linyao/generators/crud/default/views/index.php delete mode 100644 vendor/linyao/generators/crud/default/views/update.php delete mode 100644 vendor/linyao/generators/crud/default/views/view.php delete mode 100644 vendor/linyao/generators/crud/form.php delete mode 100644 vendor/linyao/generators/model/Generator.php delete mode 100644 vendor/linyao/generators/model/default/model.php delete mode 100644 vendor/linyao/generators/model/default/query.php delete mode 100644 vendor/linyao/generators/model/form.php diff --git a/vendor/iron/assets/upload/js/jquery-form.js b/vendor/iron/assets/upload/js/jquery-form.js new file mode 100644 index 0000000..f4e0662 --- /dev/null +++ b/vendor/iron/assets/upload/js/jquery-form.js @@ -0,0 +1,1277 @@ +/*! + * jQuery Form Plugin + * version: 3.51.0-2014.06.20 + * Requires jQuery v1.5 or later + * Copyright (c) 2014 M. Alsup + * Examples and documentation at: http://malsup.com/jquery/form/ + * Project repository: https://github.com/malsup/form + * Dual licensed under the MIT and GPL licenses. + * https://github.com/malsup/form#copyright-and-license + */ +/*global ActiveXObject */ + +// AMD support +(function (factory) { + "use strict"; + if (typeof define === 'function' && define.amd) { + // using AMD; register as anon module + define(['jquery'], factory); + } else { + // no AMD; invoke directly + factory( (typeof(jQuery) != 'undefined') ? jQuery : window.Zepto ); + } +} + +(function($) { + "use strict"; + + /* + Usage Note: + ----------- + Do not use both ajaxSubmit and ajaxForm on the same form. These + functions are mutually exclusive. Use ajaxSubmit if you want + to bind your own submit handler to the form. For example, + + $(document).ready(function() { + $('#myForm').on('submit', function(e) { + e.preventDefault(); // <-- important + $(this).ajaxSubmit({ + target: '#output' + }); + }); + }); + + Use ajaxForm when you want the plugin to manage all the event binding + for you. For example, + + $(document).ready(function() { + $('#myForm').ajaxForm({ + target: '#output' + }); + }); + + You can also use ajaxForm with delegation (requires jQuery v1.7+), so the + form does not have to exist when you invoke ajaxForm: + + $('#myForm').ajaxForm({ + delegation: true, + target: '#output' + }); + + When using ajaxForm, the ajaxSubmit function will be invoked for you + at the appropriate time. + */ + + /** + * Feature detection + */ + var feature = {}; + feature.fileapi = $("").get(0).files !== undefined; + feature.formdata = window.FormData !== undefined; + + var hasProp = !!$.fn.prop; + +// attr2 uses prop when it can but checks the return type for +// an expected string. this accounts for the case where a form +// contains inputs with names like "action" or "method"; in those +// cases "prop" returns the element + $.fn.attr2 = function() { + if ( ! hasProp ) { + return this.attr.apply(this, arguments); + } + var val = this.prop.apply(this, arguments); + if ( ( val && val.jquery ) || typeof val === 'string' ) { + return val; + } + return this.attr.apply(this, arguments); + }; + + /** + * ajaxSubmit() provides a mechanism for immediately submitting + * an HTML form using AJAX. + */ + $.fn.ajaxSubmit = function(options) { + /*jshint scripturl:true */ + + // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) + if (!this.length) { + log('ajaxSubmit: skipping submit process - no element selected'); + return this; + } + + var method, action, url, $form = this; + + if (typeof options == 'function') { + options = { success: options }; + } + else if ( options === undefined ) { + options = {}; + } + + method = options.type || this.attr2('method'); + action = options.url || this.attr2('action'); + + url = (typeof action === 'string') ? $.trim(action) : ''; + url = url || window.location.href || ''; + if (url) { + // clean url (don't include hash vaue) + url = (url.match(/^([^#]+)/)||[])[1]; + } + + options = $.extend(true, { + url: url, + success: $.ajaxSettings.success, + type: method || $.ajaxSettings.type, + iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' + }, options); + + // hook for manipulating the form data before it is extracted; + // convenient for use with rich editors like tinyMCE or FCKEditor + var veto = {}; + this.trigger('form-pre-serialize', [this, options, veto]); + if (veto.veto) { + log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); + return this; + } + + // provide opportunity to alter form data before it is serialized + if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { + log('ajaxSubmit: submit aborted via beforeSerialize callback'); + return this; + } + + var traditional = options.traditional; + if ( traditional === undefined ) { + traditional = $.ajaxSettings.traditional; + } + + var elements = []; + var qx, a = this.formToArray(options.semantic, elements); + if (options.data) { + options.extraData = options.data; + qx = $.param(options.data, traditional); + } + + // give pre-submit callback an opportunity to abort the submit + if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { + log('ajaxSubmit: submit aborted via beforeSubmit callback'); + return this; + } + + // fire vetoable 'validate' event + this.trigger('form-submit-validate', [a, this, options, veto]); + if (veto.veto) { + log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); + return this; + } + + var q = $.param(a, traditional); + if (qx) { + q = ( q ? (q + '&' + qx) : qx ); + } + if (options.type.toUpperCase() == 'GET') { + options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; + options.data = null; // data is null for 'get' + } + else { + options.data = q; // data is the query string for 'post' + } + + var callbacks = []; + if (options.resetForm) { + callbacks.push(function() { $form.resetForm(); }); + } + if (options.clearForm) { + callbacks.push(function() { $form.clearForm(options.includeHidden); }); + } + + // perform a load on the target only if dataType is not provided + if (!options.dataType && options.target) { + var oldSuccess = options.success || function(){}; + callbacks.push(function(data) { + var fn = options.replaceTarget ? 'replaceWith' : 'html'; + $(options.target)[fn](data).each(oldSuccess, arguments); + }); + } + else if (options.success) { + callbacks.push(options.success); + } + + options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg + var context = options.context || this ; // jQuery 1.4+ supports scope context + for (var i=0, max=callbacks.length; i < max; i++) { + callbacks[i].apply(context, [data, status, xhr || $form, $form]); + } + }; + + if (options.error) { + var oldError = options.error; + options.error = function(xhr, status, error) { + var context = options.context || this; + oldError.apply(context, [xhr, status, error, $form]); + }; + } + + if (options.complete) { + var oldComplete = options.complete; + options.complete = function(xhr, status) { + var context = options.context || this; + oldComplete.apply(context, [xhr, status, $form]); + }; + } + + // are there files to upload? + + // [value] (issue #113), also see comment: + // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219 + var fileInputs = $('input[type=file]:enabled', this).filter(function() { return $(this).val() !== ''; }); + + var hasFileInputs = fileInputs.length > 0; + var mp = 'multipart/form-data'; + var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp); + + var fileAPI = feature.fileapi && feature.formdata; + log("fileAPI :" + fileAPI); + var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI; + + var jqxhr; + + // options.iframe allows user to force iframe mode + // 06-NOV-09: now defaulting to iframe mode if file input is detected + if (options.iframe !== false && (options.iframe || shouldUseFrame)) { + // hack to fix Safari hang (thanks to Tim Molendijk for this) + // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d + if (options.closeKeepAlive) { + $.get(options.closeKeepAlive, function() { + jqxhr = fileUploadIframe(a); + }); + } + else { + jqxhr = fileUploadIframe(a); + } + } + else if ((hasFileInputs || multipart) && fileAPI) { + jqxhr = fileUploadXhr(a); + } + else { + jqxhr = $.ajax(options); + } + + $form.removeData('jqxhr').data('jqxhr', jqxhr); + + // clear element array + for (var k=0; k < elements.length; k++) { + elements[k] = null; + } + + // fire 'notify' event + this.trigger('form-submit-notify', [this, options]); + return this; + + // utility fn for deep serialization + function deepSerialize(extraData){ + var serialized = $.param(extraData, options.traditional).split('&'); + var len = serialized.length; + var result = []; + var i, part; + for (i=0; i < len; i++) { + // #252; undo param space replacement + serialized[i] = serialized[i].replace(/\+/g,' '); + part = serialized[i].split('='); + // #278; use array instead of object storage, favoring array serializations + result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]); + } + return result; + } + + // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz) + function fileUploadXhr(a) { + var formdata = new FormData(); + + for (var i=0; i < a.length; i++) { + formdata.append(a[i].name, a[i].value); + } + + if (options.extraData) { + var serializedData = deepSerialize(options.extraData); + for (i=0; i < serializedData.length; i++) { + if (serializedData[i]) { + formdata.append(serializedData[i][0], serializedData[i][1]); + } + } + } + + options.data = null; + + var s = $.extend(true, {}, $.ajaxSettings, options, { + contentType: false, + processData: false, + cache: false, + type: method || 'POST' + }); + + if (options.uploadProgress) { + // workaround because jqXHR does not expose upload property + s.xhr = function() { + var xhr = $.ajaxSettings.xhr(); + if (xhr.upload) { + xhr.upload.addEventListener('progress', function(event) { + var percent = 0; + var position = event.loaded || event.position; /*event.position is deprecated*/ + var total = event.total; + if (event.lengthComputable) { + percent = Math.ceil(position / total * 100); + } + options.uploadProgress(event, position, total, percent); + }, false); + } + return xhr; + }; + } + + s.data = null; + var beforeSend = s.beforeSend; + s.beforeSend = function(xhr, o) { + //Send FormData() provided by user + if (options.formData) { + o.data = options.formData; + } + else { + o.data = formdata; + } + if(beforeSend) { + beforeSend.call(this, xhr, o); + } + }; + return $.ajax(s); + } + + // private function for handling file uploads (hat tip to YAHOO!) + function fileUploadIframe(a) { + var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle; + var deferred = $.Deferred(); + + // #341 + deferred.abort = function(status) { + xhr.abort(status); + }; + + if (a) { + // ensure that every serialized input is still enabled + for (i=0; i < elements.length; i++) { + el = $(elements[i]); + if ( hasProp ) { + el.prop('disabled', false); + } + else { + el.removeAttr('disabled'); + } + } + } + + s = $.extend(true, {}, $.ajaxSettings, options); + s.context = s.context || s; + id = 'jqFormIO' + (new Date().getTime()); + if (s.iframeTarget) { + $io = $(s.iframeTarget); + n = $io.attr2('name'); + if (!n) { + $io.attr2('name', id); + } + else { + id = n; + } + } + else { + $io = $('