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禁用'])