Sfoglia il codice sorgente

Merge branch 'web_sannong_fr'

15313670163 3 settimane fa
parent
commit
08059619ce
1 ha cambiato i file con 17 aggiunte e 11 eliminazioni
  1. 17 11
      app/JsonRpc/WebsiteService.php

+ 17 - 11
app/JsonRpc/WebsiteService.php

@@ -2047,21 +2047,27 @@ class WebsiteService implements WebsiteServiceInterface
      */
     public function upWebFootInfo(array $data): array
     {
-        // return Result::success($data['website_id']);
-        $website = Website::where('id', $data['website_id'])->first();
-        if (empty($website)) {
+        // return Result::success($data);
+        $website = Website::where('id',$data['website_id'])->first();
+        if(empty($website)){
             return Result::error("请输入正确的网站id!", 0);
-
-        }
-        $where = ['website_id' => $data['website_id']];
+       
+        }  
+        $web = $data['website_id'];
         unset($data['website_id']);
-        // $result = WebsiteTemplateInfo::where($where)->first();
-        // if(empty($result)){
-        //     return Result::error("请先添加网站基础信息!",0); 
-        // } 
+        $where = ['website_id'=>$web];
+        // return Result::success($data);
+        $result = WebsiteTemplateInfo::where($where)->first();
+        if(empty($result)){
+            $data['website_id'] = $web;
+            $result = WebsiteTemplateInfo::insertGetId($data);
+            // return Result::error("请先添加网站基础信息!",0); 
+        } else{
+            $result = WebsiteTemplateInfo::where($where)->update($data);
+        }
         // $where = ['website_id'=>$data['website_id']];
         // unset($data['website_id']);
-        $result = WebsiteTemplateInfo::updateOrInsert($where, $data);
+        // $result = WebsiteTemplateInfo::updateOrInsert($where, $data);
         if(empty($result)){
             return Result::error("修改失败!",0); 
         }