moshaorui 4 months ago
parent
commit
539e6290fd

+ 21 - 2
app/Distributor/Controllers/SettingsController.php

@@ -60,6 +60,11 @@ HTML
             $form->text('contact_number')->value($distInfo->contact_number);
             $form->text('service_hotline')->value($distInfo->service_hotline);
             $form->text('whats_app')->value($distInfo->whats_app);
+            $form->text('facebook')->value($distInfo->facebook);
+            $form->text('instagram')->value($distInfo->instagram);
+            $form->text('youtube')->value($distInfo->youtube);
+            $form->text('linkedin')->value($distInfo->linkedin);
+            $form->text('tiktok')->value($distInfo->tiktok);
             $form->text('copy_right')->value($distInfo->copy_right);
             $form->text('seo_title')->value($distInfo->seo_title)->required();
             $form->text('seo_keywords')->value($distInfo->seo_keywords);
@@ -80,6 +85,7 @@ HTML
         if (!in_array($domainType, [0,1])) {
             return $form->response()->error('Invalid argument');
         }
+        /*
         if ($domainType == 1) {
             if (str_starts_with($customDomain,env('TOP_DOMAIN'))) {
                 return $form->response()->error('Error in domain format');
@@ -87,7 +93,8 @@ HTML
             if (!isDomainOnly($customDomain)) {
                 return $form->response()->error('Error in domain format');
             }
-        }
+        }*/
+        $customDomain = $this->removeHttpAndPort($customDomain);
         DistAdminDistributor::updateDomain($domainType,$customDomain);
 
         //站点配置
@@ -96,7 +103,6 @@ HTML
         return $form->response()->success('Success');
     }
 
-
     public function upload()
     {
         $disk = $this->disk('oss');
@@ -120,5 +126,18 @@ HTML
             : $this->responseErrorMessage('文件上传失败');
     }
 
+    private function removeHttpAndPort($url) {
+        // 使用正则表达式去除 http:// 和 https://
+        $url = preg_replace('#^https?://#', '', $url);
+        // 使用正则表达式去除端口号
+        $url = preg_replace('#:\d+/#', '/', $url);
+        $url = preg_replace('#:\d+$#', '', $url);
+        $url = trim($url);
+        $url = trim($url,'/');
+        $url = trim($url,'\\');
+        return $url;
+    }
+
+
 
 }

+ 5 - 0
app/Distributor/Repositories/DistAdminDistributor.php

@@ -50,6 +50,11 @@ class DistAdminDistributor extends EloquentRepository
         $row->contact_number = $info['contact_number'];
         $row->service_hotline = $info['service_hotline'];
         $row->whats_app = $info['whats_app'];
+        $row->facebook = $info['facebook'];
+        $row->instagram = $info['instagram'];
+        $row->youtube = $info['youtube'];
+        $row->linkedin = $info['linkedin'];
+        $row->tiktok = $info['tiktok'];
         $row->seo_title = $info['seo_title'];//seo_title
         $row->seo_keywords = $info['seo_keywords'];//seo_keywords
         $row->seo_description = $info['seo_description'];//seo_description