Explorar o código

路由匹配(增加底部导航)

15313670163 hai 2 semanas
pai
achega
31fc9e1efe
Modificáronse 1 ficheiros con 9 adicións e 4 borrados
  1. 9 4
      app/JsonRpc/WebsiteService.php

+ 9 - 4
app/JsonRpc/WebsiteService.php

@@ -2146,11 +2146,16 @@ class WebsiteService implements WebsiteServiceInterface
             return Result::error("暂无该网站",0);
         }
         // return Result::success($data);
-        $result = WebsiteCategory::where('website_id',$data['website_id'])->where('aLIas_pinyin',$data['pinyin'])->first(['category_id']);
-        if (empty($result)) {
-            return Result::error("暂无此导航",0);
+        if (isset($data['pinyin']) &&!empty($data['pinyin'])) {
+            $result = WebsiteCategory::where('website_id',$data['website_id'])->where('aLIas_pinyin',$data['pinyin'])->first(['category_id']);
+        }
+        if(isset($data['foot_pinyin']) &&!empty($data['foot_pinyin'])){
+            $result = FooterCategory::where('website_id',$data['website_id'])->where('name_pinyin',$data['foot_pinyin'])->first(['id']);
         }
-        return Result::success($result['category_id']); 
+        if (!isset($result) || empty($result)) {
+            return Result::error("暂无该导航",0); 
+        }
+        return Result::success($result); 
     }