Selaa lähdekoodia

自助建站-修改获取搭建的网站模板

15313670163 4 kuukautta sitten
vanhempi
sitoutus
fdb8b65878
1 muutettua tiedostoa jossa 15 lisäystä ja 3 poistoa
  1. 15 3
      app/JsonRpc/WebsiteService.php

+ 15 - 3
app/JsonRpc/WebsiteService.php

@@ -1446,9 +1446,21 @@ class WebsiteService implements WebsiteServiceInterface
         }
         // return Result::success($result);
         $result['template_img'] = $template_img;
-        if (empty($result)) {
-            return Result::error("没有查找到相关数据", 0);
-        } else {
+        $result['page_type'] = $page_type;
+        // 查找 $template 在 $templates 数组中的索引
+        // $index = array_search($template['template_id'],  array_column($data['templates'], 'id'));
+
+        // 如果找到了 $template,则计算它所在的页码
+        // if ($index !== false) {
+        //     $page = floor($index / $data['pageSize']) + 1;
+        //     $result['page'] = $page;
+        //     echo "查询到的 template 在第 $page 页";
+        // } else {
+        //     echo "未找到查询到的 template";
+        // }
+        if(empty($result)){
+            return Result::error("没有查找到相关数据",0);
+        }else{
             return Result::success($result);
         }
     }