shish 4 лет назад
Родитель
Сommit
bfa7fb76ab
1 измененных файлов с 16 добавлено и 7 удалено
  1. 16 7
      app-ghs/controllers/ProductController.php

+ 16 - 7
app-ghs/controllers/ProductController.php

@@ -370,15 +370,24 @@ class ProductController extends BaseController
                 continue;
             }
 
-            $where = [];
-            $where['id'] = $id;
-            $where['shopId'] = $this->shopId;
-            $where['sjId'] = $this->sjId;
-            if (empty($val)) {
-                util::fail("参数错误!");
+//            $where = [];
+//            $where['id'] = $id;
+//            $where['shopId'] = $this->shopId;
+//            $where['sjId'] = $this->sjId;
+//            if (empty($val)) {
+//                util::fail("参数错误!");
+//            }
+//            $data = [$type => $val];
+//            ProductClass::updateByCondition($where, $data);
+
+            $currentProduct = ProductClass::getById($id, true);
+            if ($currentProduct->shopId != $this->shopId) {
+                util::fail('非常操作');
             }
+            $currentProduct->$type = $val;
+            $currentProduct->save();
             $data = [$type => $val];
-            ProductClass::updateByCondition($where, $data);
+
 
             //2021.7.6 linqh 如果是首店,则更新全部分店
             ProductClass::updateSyncProduct($id, $this->shopId, $data);