WIN-2308041133\Administrator 1 hari lalu
induk
melakukan
bf02a95b26
1 mengubah file dengan 24 tambahan dan 24 penghapusan
  1. 24 24
      app/system/controller/Product.php

+ 24 - 24
app/system/controller/Product.php

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