shish 1 год назад
Родитель
Сommit
99b6bc93e8
1 измененных файлов с 19 добавлено и 0 удалено
  1. 19 0
      app-ghs/controllers/CustomController.php

+ 19 - 0
app-ghs/controllers/CustomController.php

@@ -801,6 +801,25 @@ class CustomController extends BaseController
         util::complete();
     }
 
+    public function actionChangeHome()
+    {
+        $get = Yii::$app->request->get();
+        $home = isset($get['home']) ? $get['home'] : 0;
+        $customId = !empty($get['customId']) ?? 0;
+        $custom = CustomClass::getById($customId, true);
+        CustomClass::valid($custom, $this->shopId);
+        $ghsId = $custom->ghsId ?? 0;
+        $ghs = GhsClass::getById($ghsId, true);
+        if (empty($ghs)) {
+            util::fail('没有找到供货商');
+        }
+        $ghs->home = $home;
+        $ghs->save();
+        $custom->home = $home;
+        $custom->save();
+        util::complete();
+    }
+
     //允许月结开关 ssh 2021.1.8
     public function actionDebt()
     {