15313670163 5 месяцев назад
Родитель
Сommit
c1868cd1b1
2 измененных файлов с 26 добавлено и 1 удалено
  1. 24 1
      app/JsonRpc/PublicRpcService.php
  2. 2 0
      app/JsonRpc/PublicRpcServiceInterface.php

+ 24 - 1
app/JsonRpc/PublicRpcService.php

@@ -2690,6 +2690,29 @@ class PublicRpcService implements PublicRpcServiceInterface
         }
         return Result::success($sector);
     }
-
+    /**
+     * 自助建站-随机获取模板
+     */
+    public function randomWebTemplate(array $data): array
+    {
+        $web = Website::where('id',$data['website_id'])->first();
+        if(empty($web)){
+            return Result::error('此网站不存在!');
+        }
+        $template = Template::where('website_id',$data['website_id'])->where('tempalte_id',$data['template_id'])->first();
+        if(empty($template)){
+            return Result::error('此皮肤不存在!');
+        }
+        $rule = TemplateRule::first();
+        if(empty($rule)){
+            return Result::error('此规则不存在!');
+        }
+        $template_id = $data['template_id'];
+        $index = $this->randomPage($rule,$data['template_id']);
+        return Result::success($index);
+    }
+    public function randomPage($template_id,$rule){
+        // $sectors = Sector::where('tempalte_id',$template_id)->rand
+    }
     
 }

+ 2 - 0
app/JsonRpc/PublicRpcServiceInterface.php

@@ -211,6 +211,8 @@ interface PublicRpcServiceInterface
     public function updateComponentImg(array $data): array;
     //自助建站-获取通栏类型
     public function getSectorType(array $data): array;
+    // 自助建站-随机模板
+    public function randomWebTemplate(array $data): array;