refactor: 修改产品相关接口
This commit is contained in:
@@ -38,6 +38,8 @@ class Product
|
|||||||
'is_new',
|
'is_new',
|
||||||
'is_hot',
|
'is_hot',
|
||||||
'is_sale',
|
'is_sale',
|
||||||
|
'is_show',
|
||||||
|
'stock_qty',
|
||||||
'status',
|
'status',
|
||||||
'created_at'
|
'created_at'
|
||||||
])
|
])
|
||||||
@@ -111,6 +113,7 @@ class Product
|
|||||||
'is_sale',
|
'is_sale',
|
||||||
'is_new',
|
'is_new',
|
||||||
'is_hot',
|
'is_hot',
|
||||||
|
'is_show',
|
||||||
'sort',
|
'sort',
|
||||||
'detail',
|
'detail',
|
||||||
'params' => '',
|
'params' => '',
|
||||||
@@ -183,7 +186,7 @@ class Product
|
|||||||
return error('请确认操作对象是否存在');
|
return error('请确认操作对象是否存在');
|
||||||
}
|
}
|
||||||
|
|
||||||
$product->is_sale = (int)!$product->is_sale;
|
$product->is_show = (int)!$product->is_show;
|
||||||
if (!$product->save()) {
|
if (!$product->save()) {
|
||||||
return error('操作失败');
|
return error('操作失败');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,9 +37,11 @@ class CreateProduct extends Migrator
|
|||||||
->addColumn('desc', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '产品描述'])
|
->addColumn('desc', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '产品描述'])
|
||||||
->addColumn('video_img', '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('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_new', 'boolean', ['default' => 0, 'null' => false, 'comment' => '是否新品:1新品,0非新品'])
|
||||||
->addColumn('is_hot', '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('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
|
||||||
->addColumn('detail', 'text', ['null' => true, 'comment' => '产品详情'])
|
->addColumn('detail', 'text', ['null' => true, 'comment' => '产品详情'])
|
||||||
->addColumn('status', 'boolean', ['null' => false, 'default' => 1, 'comment' => '状态:1启用,-1禁用'])
|
->addColumn('status', 'boolean', ['null' => false, 'default' => 1, 'comment' => '状态:1启用,-1禁用'])
|
||||||
|
|||||||
Reference in New Issue
Block a user