shish 2 жил өмнө
parent
commit
fe549b887c

+ 3 - 2
biz-ghs/cp/classes/CpClass.php

@@ -21,16 +21,17 @@ class CpClass extends BaseClass
             return false;
         }
         foreach ($oldCpClassList as $oldCpClass) {
+            $oldCpClassId = $oldCpClass['id'] ?? 0;
             unset($oldCpClass['addTime']);
             unset($oldCpClass['updateTime']);
             unset($oldCpClass['id']);
             $oldCpClass['mainId'] = $newMainId;
             $newCpClass = CpClassClass::add($oldCpClass, true);
             $newCpClassId = $newCpClass->id ?? 0;
-            $oldCpList = self::getAllByCondition(['mainId' => $oldMainId], null, '*');
+            $oldCpList = self::getAllByCondition(['classId' => $oldCpClassId], null, '*');
             if (!empty($oldCpList)) {
                 foreach ($oldCpList as $oldCp) {
-                    $oldCpId = $oldCp['id'];
+                    $oldCpId = $oldCp['id'] ?? 0;
                     unset($oldCp['addTime']);
                     unset($oldCp['updateTime']);
                     unset($oldCp['id']);