shish před 3 roky
rodič
revize
66c2be4727
1 změnil soubory, kde provedl 22 přidání a 0 odebrání
  1. 22 0
      app-ghs/controllers/ProductController.php

+ 22 - 0
app-ghs/controllers/ProductController.php

@@ -30,6 +30,28 @@ class ProductController extends BaseController
     //修改预售 ssh 20221214
     public function actionChangePresell()
     {
+        $post = Yii::$app->request->post();
+        $id = $post['id'] ?? 0;
+        $info = ProductClass::getById($id, true);
+        ProductClass::check($info, $this->mainId);
+        $str = $post['date'] ?? '';
+        $presell = $post['presell'] ?? 0;
+        if (empty($string)) {
+            util::fail('请填写预售日期');
+        }
+        $arr = json_decode($str, true);
+        if (empty($arr)) {
+            util::fail('请填写预售日期');
+        }
+        $new = [];
+        foreach ($arr as $date) {
+            $new[] = strtotime($date);
+        }
+        asort($new);
+        $newStr = implode(',', $new);
+        $info->presell = $presell;
+        $info->presellDate = $newStr;
+        $info->save();
         util::complete();
     }