|
@@ -33,7 +33,7 @@ class Product extends BaseController
|
|
|
$where[] = ['pid', '=', $post['pid']];
|
|
$where[] = ['pid', '=', $post['pid']];
|
|
|
}
|
|
}
|
|
|
if (!empty($post['keyword'])) {
|
|
if (!empty($post['keyword'])) {
|
|
|
- $where[] = ['name', 'like', '%' . $post['keyword'] . '%'];
|
|
|
|
|
|
|
+ $where[] = ['cate_name', 'like', '%' . $post['keyword'] . '%'];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$result = (new StoreCategory())->getList($where, $post['page'], $post['pageSize']);
|
|
$result = (new StoreCategory())->getList($where, $post['page'], $post['pageSize']);
|
|
@@ -49,14 +49,14 @@ class Product extends BaseController
|
|
|
{
|
|
{
|
|
|
$post = UtilService::getMore([
|
|
$post = UtilService::getMore([
|
|
|
['id', 0],
|
|
['id', 0],
|
|
|
- ['name', '', 'empty', '请输入分类名称'],
|
|
|
|
|
|
|
+ ['cate_name', '', 'empty', '请输入分类名称'],
|
|
|
['pid', 0],
|
|
['pid', 0],
|
|
|
['sort', 0],
|
|
['sort', 0],
|
|
|
['status', 1],
|
|
['status', 1],
|
|
|
], $request);
|
|
], $request);
|
|
|
|
|
|
|
|
$data = [
|
|
$data = [
|
|
|
- 'name' => $post['name'],
|
|
|
|
|
|
|
+ 'cate_name' => $post['cate_name'],
|
|
|
'pid' => $post['pid'],
|
|
'pid' => $post['pid'],
|
|
|
'sort' => $post['sort'],
|
|
'sort' => $post['sort'],
|
|
|
'status' => $post['status'] == 1 ? 1 : 0,
|
|
'status' => $post['status'] == 1 ? 1 : 0,
|
|
@@ -92,7 +92,7 @@ class Product extends BaseController
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 检查是否有商品
|
|
// 检查是否有商品
|
|
|
- $hasProduct = Db::name('store_product')->where('category_id', $post['id'])->count();
|
|
|
|
|
|
|
+ $hasProduct = Db::name('store_product')->where('cate_id', $post['id'])->count();
|
|
|
if ($hasProduct > 0) {
|
|
if ($hasProduct > 0) {
|
|
|
return app('json')->fail('该分类下有商品,无法删除');
|
|
return app('json')->fail('该分类下有商品,无法删除');
|
|
|
}
|
|
}
|
|
@@ -121,7 +121,7 @@ class Product extends BaseController
|
|
|
|
|
|
|
|
$where = [];
|
|
$where = [];
|
|
|
if (!empty($post['keyword'])) {
|
|
if (!empty($post['keyword'])) {
|
|
|
- $where[] = ['name', 'like', '%' . $post['keyword'] . '%'];
|
|
|
|
|
|
|
+ $where[] = ['brand_name', 'like', '%' . $post['keyword'] . '%'];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$result = (new StoreBrand())->getList($where, $post['page'], $post['pageSize']);
|
|
$result = (new StoreBrand())->getList($where, $post['page'], $post['pageSize']);
|
|
@@ -137,15 +137,15 @@ class Product extends BaseController
|
|
|
{
|
|
{
|
|
|
$post = UtilService::getMore([
|
|
$post = UtilService::getMore([
|
|
|
['id', 0],
|
|
['id', 0],
|
|
|
- ['name', '', 'empty', '请输入品牌名称'],
|
|
|
|
|
- ['image', ''],
|
|
|
|
|
|
|
+ ['brand_name', '', 'empty', '请输入品牌名称'],
|
|
|
|
|
+ ['brand_logo', ''],
|
|
|
['sort', 0],
|
|
['sort', 0],
|
|
|
['status', 1],
|
|
['status', 1],
|
|
|
], $request);
|
|
], $request);
|
|
|
|
|
|
|
|
$data = [
|
|
$data = [
|
|
|
- 'name' => $post['name'],
|
|
|
|
|
- 'image' => $post['image'],
|
|
|
|
|
|
|
+ 'brand_name' => $post['brand_name'],
|
|
|
|
|
+ 'brand_logo' => $post['brand_logo'],
|
|
|
'sort' => $post['sort'],
|
|
'sort' => $post['sort'],
|
|
|
'status' => $post['status'] == 1 ? 1 : 0,
|
|
'status' => $post['status'] == 1 ? 1 : 0,
|
|
|
];
|
|
];
|
|
@@ -192,21 +192,21 @@ class Product extends BaseController
|
|
|
$post = UtilService::getMore([
|
|
$post = UtilService::getMore([
|
|
|
['page', 1],
|
|
['page', 1],
|
|
|
['pageSize', 20],
|
|
['pageSize', 20],
|
|
|
- ['category_id', ''],
|
|
|
|
|
|
|
+ ['cate_id', ''],
|
|
|
['brand_id', ''],
|
|
['brand_id', ''],
|
|
|
['keyword', ''],
|
|
['keyword', ''],
|
|
|
['status', ''],
|
|
['status', ''],
|
|
|
], $request);
|
|
], $request);
|
|
|
|
|
|
|
|
$where = [];
|
|
$where = [];
|
|
|
- if (!empty($post['category_id'])) {
|
|
|
|
|
- $where[] = ['category_id', '=', $post['category_id']];
|
|
|
|
|
|
|
+ if (!empty($post['cate_id'])) {
|
|
|
|
|
+ $where[] = ['cate_id', '=', $post['cate_id']];
|
|
|
}
|
|
}
|
|
|
if (!empty($post['brand_id'])) {
|
|
if (!empty($post['brand_id'])) {
|
|
|
$where[] = ['brand_id', '=', $post['brand_id']];
|
|
$where[] = ['brand_id', '=', $post['brand_id']];
|
|
|
}
|
|
}
|
|
|
if (!empty($post['keyword'])) {
|
|
if (!empty($post['keyword'])) {
|
|
|
- $where[] = ['title', 'like', '%' . $post['keyword'] . '%'];
|
|
|
|
|
|
|
+ $where[] = ['store_name', 'like', '%' . $post['keyword'] . '%'];
|
|
|
}
|
|
}
|
|
|
if ($post['status'] !== '' && in_array((string)$post['status'], ["0", "1"])) {
|
|
if ($post['status'] !== '' && in_array((string)$post['status'], ["0", "1"])) {
|
|
|
$where[] = ['is_show', '=', (int)$post['status']];
|
|
$where[] = ['is_show', '=', (int)$post['status']];
|
|
@@ -225,36 +225,36 @@ class Product extends BaseController
|
|
|
{
|
|
{
|
|
|
$post = UtilService::getMore([
|
|
$post = UtilService::getMore([
|
|
|
['id', 0],
|
|
['id', 0],
|
|
|
- ['category_id', '', 'empty', '请选择分类'],
|
|
|
|
|
|
|
+ ['cate_id', '', 'empty', '请选择分类'],
|
|
|
['brand_id', 0],
|
|
['brand_id', 0],
|
|
|
- ['title', '', 'empty', '请输入商品标题'],
|
|
|
|
|
|
|
+ ['store_name', '', 'empty', '请输入商品标题'],
|
|
|
['image', '', 'empty', '请上传商品图片'],
|
|
['image', '', 'empty', '请上传商品图片'],
|
|
|
- ['images', ''],
|
|
|
|
|
|
|
+ ['slider_image', ''],
|
|
|
['price', 0],
|
|
['price', 0],
|
|
|
- ['cost_price', 0],
|
|
|
|
|
|
|
+ ['cost', 0],
|
|
|
['ot_price', 0],
|
|
['ot_price', 0],
|
|
|
['stock', 0],
|
|
['stock', 0],
|
|
|
['sales', 0],
|
|
['sales', 0],
|
|
|
['unit_name', '件'],
|
|
['unit_name', '件'],
|
|
|
- ['description', ''],
|
|
|
|
|
|
|
+ ['content', ''],
|
|
|
['sort', 0],
|
|
['sort', 0],
|
|
|
['status', 1],
|
|
['status', 1],
|
|
|
['sku_list', '[]'],
|
|
['sku_list', '[]'],
|
|
|
], $request);
|
|
], $request);
|
|
|
|
|
|
|
|
$data = [
|
|
$data = [
|
|
|
- 'category_id' => $post['category_id'],
|
|
|
|
|
|
|
+ 'cate_id' => $post['cate_id'],
|
|
|
'brand_id' => $post['brand_id'],
|
|
'brand_id' => $post['brand_id'],
|
|
|
- 'title' => $post['title'],
|
|
|
|
|
|
|
+ 'store_name' => $post['store_name'],
|
|
|
'image' => $post['image'],
|
|
'image' => $post['image'],
|
|
|
- 'images' => $post['images'],
|
|
|
|
|
|
|
+ 'slider_image' => $post['slider_image'],
|
|
|
'price' => $post['price'],
|
|
'price' => $post['price'],
|
|
|
- 'cost_price' => $post['cost_price'],
|
|
|
|
|
|
|
+ 'cost' => $post['cost'],
|
|
|
'ot_price' => $post['ot_price'],
|
|
'ot_price' => $post['ot_price'],
|
|
|
'stock' => $post['stock'],
|
|
'stock' => $post['stock'],
|
|
|
'sales' => $post['sales'],
|
|
'sales' => $post['sales'],
|
|
|
'unit_name' => $post['unit_name'],
|
|
'unit_name' => $post['unit_name'],
|
|
|
- 'description' => $post['description'],
|
|
|
|
|
|
|
+ 'content' => $post['content'],
|
|
|
'sort' => $post['sort'],
|
|
'sort' => $post['sort'],
|
|
|
'is_show' => $post['status'] == 1 ? 1 : 0,
|
|
'is_show' => $post['status'] == 1 ? 1 : 0,
|
|
|
];
|
|
];
|
|
@@ -282,7 +282,7 @@ class Product extends BaseController
|
|
|
'product_id' => $productId,
|
|
'product_id' => $productId,
|
|
|
'suk' => $sku['suk'] ?? '',
|
|
'suk' => $sku['suk'] ?? '',
|
|
|
'price' => $sku['price'] ?? $post['price'],
|
|
'price' => $sku['price'] ?? $post['price'],
|
|
|
- 'cost_price' => $sku['cost_price'] ?? $post['cost_price'],
|
|
|
|
|
|
|
+ 'cost' => $sku['cost'] ?? $post['cost'],
|
|
|
'stock' => $sku['stock'] ?? 0,
|
|
'stock' => $sku['stock'] ?? 0,
|
|
|
'bar_code' => $sku['bar_code'] ?? '',
|
|
'bar_code' => $sku['bar_code'] ?? '',
|
|
|
];
|
|
];
|