shish 3 лет назад
Родитель
Сommit
44a4ff2763
1 измененных файлов с 20 добавлено и 0 удалено
  1. 20 0
      console/controllers/InitController.php

+ 20 - 0
console/controllers/InitController.php

@@ -12,4 +12,24 @@ use yii\console\Controller;
 class InitController extends Controller
 {
 
+    public function actionCustom()
+    {
+        $customList = CustomClass::getAllByCondition(['id>0'], null, '*', null, true);
+        if (!empty($customList)) {
+            foreach ($customList as $custom) {
+                $userId = $custom->userId ?? 0;
+                $shopId = $custom->shopId ?? 0;
+                $customId = $custom->id ?? 0;
+                $hd = HdClass::getByCondition(['userId' => $userId, 'shopId' => $shopId], true);
+                if (!empty($hd)) {
+                    $hdId = $hd->id ?? 0;
+                    $hd->customId = $customId;
+                    $hd->save();
+                    $custom->hdId = $hdId;
+                    $custom->save();
+                }
+            }
+        }
+    }
+
 }