From 455cae1b3d7dd3e0b692778a4bf5fb7f938b00f6 Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Mon, 23 Dec 2024 14:10:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E6=B7=BB=E5=8A=A0=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E6=98=AF=E6=96=B0=E5=93=81=E9=80=89=E6=8B=A9=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/shop/controller/goods/Goods.php | 3 -- app/shop/view/goods/goods/add.html | 1 + app/shop/view/goods/goods/goods_base.html | 9 ++++ ...53219_add_is_new_goods_fields_to_goods.php | 44 +++++++++++++++++++ 4 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 database/migrations/20241223053219_add_is_new_goods_fields_to_goods.php diff --git a/app/shop/controller/goods/Goods.php b/app/shop/controller/goods/Goods.php index e7b3b1fc..db8d60af 100755 --- a/app/shop/controller/goods/Goods.php +++ b/app/shop/controller/goods/Goods.php @@ -255,7 +255,6 @@ class Goods extends ShopBase $goods_id = $this->request->get('goods_id'); $a = MallCategoryLogic::getAllTree(); $b = GoodsLogic::info($goods_id); - $second_pid = array(); $arr = $arr1 = array(); if ($b['base']['second_cate_id'] != 0) { @@ -280,12 +279,10 @@ class Goods extends ShopBase $b['base']['first_cate_id'] = explode(",", $b['base']['first_cate_id']); $b['base']['second_cate_id'] = explode(",", $b['base']['second_cate_id']); $b['base']['third_cate_id'] = explode(",", $b['base']['third_cate_id']); - $subsidy = []; if ($b['base']['subsidy_id']) { $subsidy = (new GoodsSubsidy())->getSubsidyById($b['base']['subsidy_id']); } - return view('goods/goods/add', [ 'category_lists_new' => $a, 'category_first' => $b['base']['first_cate_id'], diff --git a/app/shop/view/goods/goods/add.html b/app/shop/view/goods/goods/add.html index f05b7c61..3092463f 100755 --- a/app/shop/view/goods/goods/add.html +++ b/app/shop/view/goods/goods/add.html @@ -843,6 +843,7 @@ var goods_info= {$info|raw|default=''}; // 商品类型 + $("input[name=is_new_goods]").prop("checked", goods_info['base']['is_new_goods'] == 1); $("input[name=type]").prop("disabled",true); $("input[name=type][value="+goods_info['base']['type']+"]").prop("checked",true); switchGoodsType(goods_info['base']['type']); diff --git a/app/shop/view/goods/goods/goods_base.html b/app/shop/view/goods/goods/goods_base.html index f7224fed..871c379f 100755 --- a/app/shop/view/goods/goods/goods_base.html +++ b/app/shop/view/goods/goods/goods_base.html @@ -24,6 +24,15 @@ class="layui-input"> + + +
+ +
+ +
+
+
diff --git a/database/migrations/20241223053219_add_is_new_goods_fields_to_goods.php b/database/migrations/20241223053219_add_is_new_goods_fields_to_goods.php new file mode 100644 index 00000000..1afde62e --- /dev/null +++ b/database/migrations/20241223053219_add_is_new_goods_fields_to_goods.php @@ -0,0 +1,44 @@ +table('goods'); + $table->addColumn('is_new_goods', 'tinyinteger', [ + 'limit' => 1, 'default' => 0, 'null' => false, 'comment' => '是否是新品:0不是 1是;' + ])->update(); // 更新表结构 + } + + public function down() + { + // 回滚操作删除添加的字段 + $table = $this->table('goods_subsidy'); + $table->removeColumn('store_subsidy') + ->update(); + } +}