From 1b220392d4b0c0c8bf1f1de4eb059f1de9582e80 Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Tue, 11 Feb 2025 15:31:53 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/v1/Product.php | 5 ++++- database/migrations/20241218064708_create_product.php | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/admin/controller/v1/Product.php b/app/admin/controller/v1/Product.php index fa9f604c..1326bc78 100644 --- a/app/admin/controller/v1/Product.php +++ b/app/admin/controller/v1/Product.php @@ -38,6 +38,8 @@ class Product 'is_new', 'is_hot', 'is_sale', + 'is_show', + 'stock_qty', 'status', 'created_at' ]) @@ -111,6 +113,7 @@ class Product 'is_sale', 'is_new', 'is_hot', + 'is_show', 'sort', 'detail', 'params' => '', @@ -183,7 +186,7 @@ class Product return error('请确认操作对象是否存在'); } - $product->is_sale = (int)!$product->is_sale; + $product->is_show = (int)!$product->is_show; if (!$product->save()) { return error('操作失败'); } diff --git a/database/migrations/20241218064708_create_product.php b/database/migrations/20241218064708_create_product.php index c30685a6..937f3f2d 100644 --- a/database/migrations/20241218064708_create_product.php +++ b/database/migrations/20241218064708_create_product.php @@ -37,9 +37,11 @@ class CreateProduct extends Migrator ->addColumn('desc', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '产品描述']) ->addColumn('video_img', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '产品视频封面']) ->addColumn('video_url', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '产品视频']) - ->addColumn('is_sale', 'boolean', ['default' => 1, 'null' => false, 'comment' => '是否上架:1上架,0下架']) + ->addColumn('is_sale', 'boolean', ['default' => 1, 'null' => false, 'comment' => '是否在售:1是,0否']) ->addColumn('is_new', 'boolean', ['default' => 0, 'null' => false, 'comment' => '是否新品:1新品,0非新品']) ->addColumn('is_hot', 'boolean', ['default' => 0, 'null' => false, 'comment' => '是否热销:1热销,0非热销']) + ->addColumn('is_show', 'boolean', ['default' => 0, 'null' => false, 'comment' => '是否上架:1上架,0下架']) + ->addColumn('stock_qty', 'integer', ['signed' => false, 'null' => true, 'default' => 0, 'comment' => '库存数量']) ->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序']) ->addColumn('detail', 'text', ['null' => true, 'comment' => '产品详情']) ->addColumn('status', 'boolean', ['null' => false, 'default' => 1, 'comment' => '状态:1启用,-1禁用'])