xieruidong 2 years ago
parent
commit
2f5cda781d
2 changed files with 4 additions and 1 deletions
  1. 1 1
      application/admin/controller/Goods.php
  2. 3 0
      thinkphp/library/think/Model.php

+ 1 - 1
application/admin/controller/Goods.php

@@ -220,7 +220,7 @@ class Goods extends Backend
         $skuId=[];
         $detailId=[];
         foreach ($data['sku'] as $key=>$_sku){
-            $sku=Arr::only($_sku,['amount_cost','amount_kill_ladder','amount_ladder','num_stock','num_stock_kill','temp_ids','id']);
+            $sku=Arr::only($_sku,(new GoodsSku)->columns());
             $sku['name']=$_sku['specValues'];
             $sku['goods_id']=$goods['id'];
             if(!empty($sku['id'])){

+ 3 - 0
thinkphp/library/think/Model.php

@@ -2373,4 +2373,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
     public function hasColumn($column){
         return in_array($column,$this->getTableInfo()['fields']);
     }
+    public function columns(){
+        return $this->getTableInfo()['fields'];
+    }
 }