Kaynağa Gözat

公告图文选择

shish 10 ay önce
ebeveyn
işleme
990d1849e9
1 değiştirilmiş dosya ile 8 ekleme ve 8 silme
  1. 8 8
      app-ghs/controllers/PicTextController.php

+ 8 - 8
app-ghs/controllers/PicTextController.php

@@ -75,19 +75,19 @@ class PicTextController extends BaseController
         $switch = $post['switch'] ?? 0;
         $shopId = $this->shopId;
         $picTextId = intval($post['picTextId']);
-        $shop = $this->shop;
         $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
         if (empty($ext)) {
             util::fail('门店信息缺失呢');
         }
-        $ext->purchaseGuide = $picTextId;
-        $ext->save();
-        if($switch == 1){
-            $shop->buyNotice = 1;
-        }else{
-            $shop->buyNotice = 0;
+        if ($switch == 1) {
+            if (empty($picTextId) || !is_numeric($picTextId)) {
+                util::fail('请先择图文');
+            }
+            $ext->purchaseGuide = $picTextId;
+        } else {
+            $ext->purchaseGuide = 0;
         }
-        $shop->save();
+        $ext->save();
         util::complete('修改成功');
     }